fasr-asr-funasr
英文文档地址: README_EN.md
Fun-ASR-Nano 语音识别插件。该插件封装 funasr.AutoModel,把整段识别文本写入
AudioSpan.raw_text,不返回词级或字级时间戳。
安装
pip install fasr-asr-funasr
注册模型
| 注册名 | 类 | 适用场景 |
|---|---|---|
fun_asr_nano |
FunASRNano |
轻量 FunASR 识别,无时间戳输出 |
默认 checkpoint 是 FunAudioLLM/Fun-ASR-Nano-2512。
流水线使用
from fasr import AudioPipeline
pipeline = (
AudioPipeline()
.add_pipe("detector", model="fsmn")
.add_pipe(
"recognizer",
model="fun_asr_nano",
device="cuda:0",
language="中文",
itn=True,
)
.add_pipe("sentencizer", model="ct_transformer")
)
| 目标 | 写法 | 效果 |
|---|---|---|
| CPU 推理 | device="cpu" |
不依赖 CUDA,但通常更慢 |
| 使用第一张 GPU | device="cuda:0" |
使用 GPU 0 |
| 关闭数字/日期规范化 | itn=False |
保留更接近口语的文本 |
| 固定语言提示 | language="中文" |
把语言标签传给 FunASR |
Confection 配置
[asr_model]
@asr_models = "fun_asr_nano"
device = "cuda:0"
language = "中文"
itn = true
batch_size = 1
放在流水线里:
[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 = "fun_asr_nano"
device = "cuda:0"
language = "中文"
itn = true
batch_size = 1
单独使用
from fasr.config import registry
model = registry.asr_models.get("fun_asr_nano")()
model.device = "cuda:0"
spans = model.transcribe(audio_spans, hotwords=["fasr"], language="中文")
for span in spans:
print(span.text)
使用本地权重:
model.load_checkpoint("/path/to/Fun-ASR-Nano")
参数
| 参数 | 类型 / 范围 | 默认值 | 调高 / 开启时 | 调低 / 关闭时 | 什么时候改 |
|---|---|---|---|---|---|
device |
str |
"cuda:0" |
选择 CUDA 设备,如 "cuda:1" |
"cpu" 使用 CPU |
部署设备变化 |
language |
str |
"中文" |
更强语言提示 | 换成其它支持的语言标签 | 已知音频语言 |
itn |
bool |
True |
规范化数字、日期等 | 保留较原始文本 | 需要口语形式输出 |
batch_size |
int >= 1 |
1 |
吞吐更高,占用更多内存 | 内存更省,吞吐更低 | 批量推理调优 |
trust_remote_code |
bool |
True |
允许加载 checkpoint 自定义代码 | 更安全,但部分模型可能加载失败 | 使用不可信 checkpoint |
输出
- 写入
span.raw_text。 - 不填充
span.tokens,因为 Fun-ASR-Nano 不返回时间戳。 - 读取
span.text即可得到识别文本。
依赖
fasrfunasr- Python 3.10-3.12
Metadata
Release files for fasr-asr-funasr 0.5.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fasr_asr_funasr-0.5.8.tar.gz | 6.5 kB | Without provenance | Details for fasr_asr_funasr-0.5.8.tar.gz |
Release files / fasr_asr_funasr-0.5.8.tar.gz
| Download URL | fasr_asr_funasr-0.5.8.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a12f856797e8ec86b238b716af2ea2402a901789c91e93942a973581c38726cb
|
|
BLAKE2b-256 checksum How to use checksums |
24acea5499a673f5117df6e07494aa7fffaeac0e566bb8cbc98c19f7db00d270
|
| 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}
|
Security for fasr-asr-funasr 0.5.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.