Skip to main content

paraformer asr model for fasr

Project description

fasr-asr-paraformer

Chinese documentation

Paraformer speech recognition for fasr. The offline models return timestamped tokens, and seaco_paraformer adds hotword support.

Install

pip install fasr-asr-paraformer

Registered Models

Registry name Class Best for
paraformer Paraformer Offline ASR with token timestamps
seaco_paraformer SeacoParaformer Offline ASR with hotword biasing
paraformer_online ParaformerOnline Streaming Paraformer ASR

Pipeline Usage

from fasr import AudioPipeline

pipeline = (
    AudioPipeline()
    .add_pipe("detector", model="fsmn")
    .add_pipe(
        "recognizer",
        model="paraformer",
        batch_size=64,
        disable_log=True,
    )
    .add_pipe("sentencizer", model="ct_transformer")
)

For hotwords, use seaco_paraformer:

pipeline = (
    AudioPipeline()
    .add_pipe("detector", model="fsmn")
    .add_pipe("recognizer", model="seaco_paraformer")
    .add_pipe("sentencizer", model="ct_transformer")
)

audio = pipeline.run("meeting.wav", hotwords=["Paraformer", "fasr"])[0]

Confection Config

[asr_model]
@asr_models = "paraformer"
batch_size = 64
device = "cuda:0"
disable_update = true
disable_log = true
disable_pbar = true

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 = "paraformer"
batch_size = 64
device = "cuda:0"
disable_log = true
disable_pbar = true

Direct Model Usage

from fasr.config import registry

model = registry.asr_models.get("paraformer")(batch_size=64)
spans = model.transcribe(audio_spans)
for span in spans:
    print(span.text)
    for token in span.tokens or []:
        print(token.text, token.start_ms, token.end_ms)

Use local weights:

model.load_checkpoint("/path/to/paraformer")

Parameters

Parameter Type / range Default Higher / true Lower / false Change when
batch_size int >= 1 10000 More throughput, more memory Lower memory, lower throughput Batch size is too memory-heavy or too slow
device str | null null Explicit device selection such as cuda:0 or cpu Auto-selects cuda:0 when CUDA is available, otherwise cpu You want to override the automatic device choice
disable_update bool True Skips FunASR update checks Allows update checks Reproducible startup or update discovery
disable_log bool True Suppresses backend logs Shows backend logs Debugging loading or inference
disable_pbar bool True Hides progress bars Shows progress bars Interactive scripts
compile_model bool, online only False Uses torch.compile, slower warm-up but faster steady state No compile warm-up Long-running streaming service
chunk_size_ms int, online only 600 Fewer streaming calls, later output More responsive, more overhead Streaming latency/throughput tuning

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

Output

  • paraformer and seaco_paraformer populate span.raw_text.
  • When timestamps are available, span.tokens contains absolute start_ms / end_ms values on the channel timeline.
  • If device is omitted, the model auto-selects cuda:0 when CUDA is available, otherwise it falls back to cpu and logs a warning.
  • seaco_paraformer accepts hotwords through the pipeline run call or transcribe(..., hotwords=[...]).

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_paraformer-0.5.3.tar.gz (6.1 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_paraformer-0.5.3-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fasr_asr_paraformer-0.5.3.tar.gz
  • Upload date:
  • Size: 6.1 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_paraformer-0.5.3.tar.gz
Algorithm Hash digest
SHA256 582c3dc1f6e7280f558dc351cc5bb5aa700e055050f21092e5af73636a9c8b8a
MD5 2997effcfdf59f5dc851c94e0c72369f
BLAKE2b-256 b455de2cfb08a7188d152271336e76c827076912eb084236c665db734bf807ee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fasr_asr_paraformer-0.5.3-py3-none-any.whl
  • Upload date:
  • Size: 8.7 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_paraformer-0.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d9bbd89c38b01f685ad57ebfbe38e69523352a260a5f9cdc7e381a8d8f2fea33
MD5 aff66523c5b61c75dc604a598c012de2
BLAKE2b-256 f3d0d91e03793a1f34b0ed534c4cda8946a333285acb52e1629585e094ec62a3

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