Skip to main content

fasr-asr-paraformer

英文文档地址: README_EN.md

Paraformer 语音识别插件。离线模型返回带时间戳的 token,seaco_paraformer 额外支持热词偏置。

安装

pip install fasr-asr-paraformer

注册模型

注册名 适用场景
paraformer Paraformer 离线 ASR,带 token 时间戳
seaco_paraformer SeacoParaformer 离线 ASR,支持热词
paraformer_online ParaformerOnline 流式 Paraformer ASR

流水线使用

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")
)

热词识别使用 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 配置

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

放在流水线里:

[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

单独使用

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)

参数

参数 类型 / 范围 默认值 调高 / 开启时 调低 / 关闭时 什么时候改
batch_size int >= 1 10000 吞吐更高,占用更多内存 内存更省,吞吐更低 批量太慢或内存太高
device str | null null 显式指定设备,例如 cuda:0cpu 如果 CUDA 可用则自动选 cuda:0,否则选 cpu 想覆盖自动设备选择时
disable_update bool True 跳过 FunASR 更新检查 允许检查更新 需要稳定启动或发现更新
disable_log bool True 隐藏后端日志 显示后端日志 调试加载或推理
disable_pbar bool True 隐藏进度条 显示进度条 交互式脚本需要进度
compile_model bool,仅 online False 使用 torch.compile,预热慢但稳态可能更快 无编译预热 长期运行流式服务
chunk_size_ms int,仅 online 600 调用更少,输出更晚 更实时,调度更多 流式延迟/吞吐调优

输出

  • paraformerseaco_paraformer 会填充 span.raw_text
  • 有时间戳时,span.tokens 中的 start_ms / end_ms 是 channel 绝对时间。
  • 如果不传 device,模型会在检测到 CUDA 时自动选 cuda:0, 否则回退到 cpu 并给出提醒日志。
  • seaco_paraformer 可通过 hotwords=[...] 传热词。

依赖

  • fasr
  • funasr
  • Python 3.10-3.12

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.8.tar.gz (7.6 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.8-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fasr_asr_paraformer-0.5.8.tar.gz
  • Upload date:
  • Size: 7.6 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.8.tar.gz
Algorithm Hash digest
SHA256 a2054860d3c488b0c60d7916bdf843bcdd1076ac84c48e506c57bf55e8b65dec
MD5 75ee403b8ea0ae213ace79f6e7cd79e4
BLAKE2b-256 ec146c65739bf531cf63956a31c1d69cdecc9c3fcf87d721bad067b512182866

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fasr_asr_paraformer-0.5.8-py3-none-any.whl
  • Upload date:
  • Size: 10.4 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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 98f803c0df1117f3c8c29cba65c90a67c537da53427c00195c23e1635dc2665a
MD5 7a57c3db921ded562eac09286676915a
BLAKE2b-256 e3e69a2ce3212e5e1ca7ba908d14f7f75374f5b851cd0aa7147c305c182f206f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.5.8 This release

2 files

0.5.7

1 file

0.5.3

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

0.3.9

2 files

Supported by

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