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

Uploaded Python 3

File details

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

File metadata

  • Download URL: fasr_asr_paraformer-0.5.2.tar.gz
  • Upload date:
  • Size: 6.1 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_paraformer-0.5.2.tar.gz
Algorithm Hash digest
SHA256 b2f04a11a4cf1caf0b19545a57485c81c9bcb6eea65c2832dddb67cc25dd05c1
MD5 34c084f6f6f1ebf4b5fef10e6b60bd8d
BLAKE2b-256 88132441ce757fd7ba089b86862dd12899db569ae84d142df06c5887a218800a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fasr_asr_paraformer-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 8.9 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_paraformer-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 55a813d6d025be96d67d95210d4c2c804149df66665accbae2c6e5d242bd276a
MD5 ec2f2468d62eff978c244ded6d42d3a5
BLAKE2b-256 8444f69a8b5d392520cf79daac9cf1f1d8930d0374058f8368532281f7819f5a

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