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.2.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.2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fasr_asr_funasr-0.5.2.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","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.2.tar.gz
Algorithm Hash digest
SHA256 e23a6a012f327997d850f3bb1e640976719e2c9841105b11d49c8d5a801a97d0
MD5 7512f7e836d0bdbe31921592d557ea98
BLAKE2b-256 eed8cb7635ff201997bcf2e221e264250c7c4945b07f9e10f2e0352ba4ccd8b5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fasr_asr_funasr-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c281ca70770b14c3ac92630764824b9cb1f7ef69605dfd7cdb509efca4489c4e
MD5 d03952ec6fbbe9f9b57ac5c886dcdf20
BLAKE2b-256 4460ff880f8d32b20775d692ea6da1a06349da20a04e713301fd05b7a75c2f5b

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