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 strNone 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

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_firered-0.5.8.tar.gz (30.4 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_firered-0.5.8-py3-none-any.whl (37.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fasr_asr_firered-0.5.8.tar.gz
  • Upload date:
  • Size: 30.4 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_firered-0.5.8.tar.gz
Algorithm Hash digest
SHA256 485dc1f7b785eca99aa8c30f47b90e7d61f09b8e040c1c5013e737ab2d54843b
MD5 2b04e3a7448c6715104062789e158010
BLAKE2b-256 e1c17720fa445287de5a73635453ff2b6b20799e72a8adf32c6d45306fa32fc1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fasr_asr_firered-0.5.8-py3-none-any.whl
  • Upload date:
  • Size: 37.2 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_firered-0.5.8-py3-none-any.whl
Algorithm Hash digest
SHA256 fdebd6b93fcd983d4157774048828d63fb3717cfc0bde28e66976447930bf0e6
MD5 06657828b1facb763bf9eb4850c78b63
BLAKE2b-256 431dc9c74115da2f09928d8558f105d088ba080a441446771348433c48023fe3

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