Skip to main content

Fun ASR model for fasr

Project description

fasr-asr-funasr

Chinese documentation

Fun-ASR-Nano speech recognition for fasr. This plugin wraps funasr.AutoModel and writes whole-utterance text to AudioSpan.raw_text. It does not produce word or character timestamps.

Install

pip install fasr-asr-funasr

Registered Model

Registry name Class Best for
fun_asr_nano FunASRNano Lightweight FunASR recognition without timestamps

The default checkpoint is FunAudioLLM/Fun-ASR-Nano-2512.

Pipeline Usage

from fasr import AudioPipeline

pipeline = (
    AudioPipeline()
    .add_pipe("detector", model="fsmn")
    .add_pipe(
        "recognizer",
        model="fun_asr_nano",
        device="cuda:0",
        language="中文",
        itn=True,
    )
    .add_pipe("sentencizer", model="ct_transformer")
)

Quick choices:

Goal Use Result
CPU inference device="cpu" Runs without CUDA, usually slower
First GPU device="cuda:0" Uses GPU 0
Disable number/date normalization itn=False Keeps raw spoken text form
Force language hint language="中文" Passes the language label to FunASR

Confection Config

[asr_model]
@asr_models = "fun_asr_nano"
device = "cuda:0"
language = "中文"
itn = true
batch_size = 1

Inside a pipeline:

[pipeline]
@pipelines = "AudioPipeline.v1"
pipe_order = ["recognizer"]

[pipeline.pipes]

[pipeline.pipes.recognizer]
@pipes = "thread_pipe"
batch_size = 4

[pipeline.pipes.recognizer.component]
@components = "recognizer"

[pipeline.pipes.recognizer.component.model]
@asr_models = "fun_asr_nano"
device = "cuda:0"
language = "中文"
itn = true
batch_size = 1

Direct Model Usage

from fasr.config import registry

model = registry.asr_models.get("fun_asr_nano")()
model.device = "cuda:0"

# `transcribe` mutates and returns the input AudioSpan list.
spans = model.transcribe(audio_spans, hotwords=["fasr"], language="中文")
for span in spans:
    print(span.text)

Use local weights:

model.load_checkpoint("/path/to/Fun-ASR-Nano")

Parameters

Parameter Type / range Default Higher / true Lower / false Change when
device str "cuda:0" Selects a CUDA device such as "cuda:1" "cpu" runs on CPU Deployment target changes
language str "中文" Stronger language hint Use another supported label Audio language is known
itn bool True Normalizes numbers, dates, and similar text Keeps less-normalized text You need spoken-form output
batch_size int >= 1 1 Better throughput, more memory Lower memory, less throughput Batch inference needs tuning
trust_remote_code bool True Allows custom checkpoint code Safer, but some checkpoints may fail Running untrusted checkpoints

Generic checkpoint fields such as checkpoint, cache_dir, endpoint, revision, and force_download are inherited from the base model.

Output

  • span.raw_text is populated.
  • span.tokens is not populated because Fun-ASR-Nano does not return timestamps.
  • span.text reads the recognized text.

Dependencies

  • fasr
  • funasr
  • Python 3.10-3.12

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fasr_asr_funasr-0.5.3.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fasr_asr_funasr-0.5.3-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file fasr_asr_funasr-0.5.3.tar.gz.

File metadata

  • Download URL: fasr_asr_funasr-0.5.3.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for fasr_asr_funasr-0.5.3.tar.gz
Algorithm Hash digest
SHA256 f80c0bb6a42f805fb77248508132f6ae16456aaf2e8b8f903abb4f61dbf9e706
MD5 45dc9ab4357adcefb714b827f60a32c7
BLAKE2b-256 907191e67080409010876af820c2b24a8092e51908f77e09599512cbb86b9d47

See more details on using hashes here.

File details

Details for the file fasr_asr_funasr-0.5.3-py3-none-any.whl.

File metadata

  • Download URL: fasr_asr_funasr-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for fasr_asr_funasr-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0f500e28405638ae66bf5e307980bec8a06d8b320b613d589ebfc2d3bd543aef
MD5 88b864f714fed8a4c064d2c2939544af
BLAKE2b-256 4a8f5445d77a4308f4ecbaa21b2f22ea58c13de07fe60ae2c40427b763a55f1d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page