Skip to main content

fasr-asr-firered

英文文档地址: README_EN.md

FireRedASR2 语音识别插件,提供 AED 解码和 LLM 解码。AED 可返回 token 时间戳,LLM 更偏向整段文本识别,不返回时间戳。

安装

pip install fasr-asr-firered

注册模型

注册名 类 适用场景
firered FireRedAEDForASR AED 模式默认别名
firered_aed FireRedAEDForASR 带时间戳 AED 识别
firered_llm FireRedLLMForASR LLM 解码,无时间戳

流水线使用

from fasr import AudioPipeline

pipeline = (
    AudioPipeline()
    .add_pipe("detector", model="fsmn")
    .add_pipe(
        "recognizer",
        model="firered_aed",
        device="cuda",
        beam_size=3,
        return_timestamp=True,
    )
    .add_pipe("sentencizer", model="ct_transformer")
)
目标 写法 效果
需要 token 时间戳 model="firered_aed", return_timestamp=True 填充 span.tokens
只要整段文本 model="firered_llm" 填充 span.raw_text,无时间戳
降低 AED 显存 use_half=True GPU 上 FP16 推理
CPU 推理 device="cpu" 不依赖 CUDA,但更慢
更宽搜索 beam_size=5 可能更准,但更慢

Confection 配置

[asr_model]
@asr_models = "firered_aed"
device = "cuda"
beam_size = 3
return_timestamp = true
use_half = true

放在流水线里:

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

[pipeline.pipes]

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

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

[pipeline.pipes.recognizer.component.model]
@asr_models = "firered_aed"
device = "cuda"
beam_size = 3
return_timestamp = true

参数

公共参数

参数 类型 / 范围 默认值 调高 / 开启时 调低 / 关闭时 什么时候改
device str 或 None None "cuda" 使用 GPU "cpu" 使用 CPU 部署设备变化
beam_size int >= 1 3 搜索更宽,更慢更耗内存 更快,可能精度下降 精度/速度取舍
decode_max_len int >= 0 0 允许更长输出 更短上限;0 交给后端 输出被截断或过长

AED 参数

参数 类型 / 范围 默认值 调高 / 开启时 调低 / 关闭时 什么时候改
use_half bool True 显存更低,GPU 更快 FP32 更稳定 显存或数值稳定性问题
return_timestamp bool True 返回 token 时间戳 只返回文本 是否需要时间戳
nbest int >= 1 1 返回更多候选 只返回最佳结果 需要候选结果
elm_weight float 0.0 外部语言模型影响更强 0.0 关闭外部 LM 提供 elm_dir 时

LLM 参数

参数 类型 / 范围 默认值 调高时 调低时 什么时候改
decode_min_len int >= 0 0 强制更长最小输出 允许更短输出 输出过早结束
repetition_penalty float 1.2 更强重复抑制 更允许重复 出现重复短语
temperature float >= 0 1.0 更发散 更确定 需要稳定或多样性

输出

  • AED 写入 span.raw_text。
  • return_timestamp=True 时 AED 也填充 span.tokens。
  • LLM 只写入 span.raw_text。

依赖

  • fasr
  • torch >= 2.0.0
  • torchaudio
  • transformers >= 4.36
  • librosa >= 0.10.0
  • kaldiio >= 2.18.0
  • kaldi-native-fbank >= 1.19.0
  • Python 3.10-3.12

Metadata

Release files for fasr-asr-firered 0.5.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fasr-asr-firered 0.5.8
File Size Uploaded
fasr_asr_firered-0.5.8.tar.gz 30.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fasr-asr-firered 0.5.8
File Interpreter ABI Platform
fasr_asr_firered-0.5.8-py3-none-any.whl Python 3 none any Details

Total release size: 67.6 kB

Release files / fasr_asr_firered-0.5.8.tar.gz

Download URL fasr_asr_firered-0.5.8.tar.gz
Size 30.4 kB
Tags Source
SHA-256 checksum
How to use checksums
485dc1f7b785eca99aa8c30f47b90e7d61f09b8e040c1c5013e737ab2d54843b
BLAKE2b-256 checksum
How to use checksums
e1c17720fa445287de5a73635453ff2b6b20799e72a8adf32c6d45306fa32fc1
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / fasr_asr_firered-0.5.8-py3-none-any.whl

Download URL fasr_asr_firered-0.5.8-py3-none-any.whl
Size 37.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fdebd6b93fcd983d4157774048828d63fb3717cfc0bde28e66976447930bf0e6
BLAKE2b-256 checksum
How to use checksums
431dc9c74115da2f09928d8558f105d088ba080a441446771348433c48023fe3
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release history Release notifications | RSS feed

This release

0.5.8 This release

2 release files

0.5.7

1 release file

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.9

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page