Qwen3 ASR model for fasr
Project description
fasr-asr-qwen3asr
英文文档地址: README_EN.md
Qwen3-ASR 语音识别插件,使用内置的 Qwen3-ASR vLLM 后端。同一个模型实例支持离线批量识别和累计式流式识别。
安装
pip install fasr-asr-qwen3asr
注册模型
| 注册名 | size 选择的类 |
适用场景 |
|---|---|---|
qwen3asr |
Qwen3ASRSmall 或 Qwen3ASRLarge |
GPU ASR,无词级时间戳 |
size="small" 使用 Qwen/Qwen3-ASR-0.6B,size="large" 使用 Qwen/Qwen3-ASR-1.7B。
流水线使用
from fasr import AudioPipeline
pipeline = (
AudioPipeline()
.add_pipe("detector", model="fsmn")
.add_pipe(
"recognizer",
model="qwen3asr",
size="small",
gpu_memory_utilization=0.7,
max_new_tokens=2048,
)
.add_pipe("sentencizer", model="ct_transformer")
)
| 目标 | 写法 | 效果 |
|---|---|---|
| 降低显存 | size="small" |
使用 0.6B checkpoint |
| 提高能力 | size="large" |
使用 1.7B checkpoint,需要更多显存 |
| 给 GPU 留余量 | gpu_memory_utilization=0.6 |
vLLM 预留更少显存 |
| 长文本输出 | max_new_tokens=4096 或更高 |
允许生成更长文本 |
| 偏置专有名词 | hotwords=[...] |
通过 Qwen3-ASR 官方 context 通道提供热词 |
| 固定语言 | language="zh" |
使用固定语言提示 |
Confection 配置
[asr_model]
@asr_models = "qwen3asr"
size = "small"
gpu_memory_utilization = 0.7
max_new_tokens = 2048
language = "Chinese"
hotwords = ["fasr", "Qwen3-ASR"]
放在流水线里:
[pipeline]
@pipelines = "AudioPipeline.v1"
pipe_order = ["recognizer"]
[pipeline.pipes]
[pipeline.pipes.recognizer]
@pipes = "thread_pipe"
batch_size = 1
[pipeline.pipes.recognizer.component]
@components = "recognizer"
[pipeline.pipes.recognizer.component.model]
@asr_models = "qwen3asr"
size = "small"
gpu_memory_utilization = 0.7
max_new_tokens = 2048
language = "Chinese"
hotwords = ["fasr", "Qwen3-ASR"]
单独使用
from fasr.config import registry
model = registry.asr_models.get("qwen3asr")(
size="small",
gpu_memory_utilization=0.7,
)
spans = model.transcribe(audio_spans)
for span in spans:
print(span.text)
流式模式返回累计文本,上层应覆盖显示最新文本,不要拼接 delta:
model = registry.asr_models.get("qwen3asr")(
size="small",
chunk_size_ms=2000,
language="zh",
)
for chunk in audio_chunks:
span = model.push_chunk(chunk)
if span is not None:
print(span.text)
参数
| 参数 | 类型 / 范围 | 默认值 | 调高 / 开启时 | 调低 / 关闭时 | 什么时候改 |
|---|---|---|---|---|---|
size |
"small" 或 "large" |
"small" |
"large" 能力更强,显存更高 |
"small" 更省资源 |
精度或资源预算变化 |
gpu_memory_utilization |
float,(0, 1] |
0.8 |
vLLM 预留更多显存 | 给其它进程留更多显存 | vLLM OOM 或显存未充分使用 |
max_new_tokens |
int >= 1 |
4096 |
允许更长输出 | 计算和显存更省 | 文本截断或资源紧张 |
max_inference_batch_size |
int,-1 或正数 |
-1 |
-1 交给后端 |
更低峰值显存 | 批量推理 OOM |
max_model_len |
int 或 None |
None |
更长 prompt+输出上下文 | 更省内存 | 长上下文或 OOM |
language |
str 或 None |
None |
固定语言提示 | 自动语言行为 | 已知语言 |
hotwords |
list[str] |
[] |
更强热词偏置 | 更少 prompt 偏置 | 专有名词漏识别 |
chunk_size_ms |
int 或 None |
None |
流式解码更少,输出更晚 | 更实时,开销更高 | 流式延迟/吞吐调优 |
输出
- 离线模式写入
span.raw_text。 - 流式模式返回累计
AudioSpan(raw_text=...)。 - 当前插件不返回词级或字级时间戳。
依赖
fasrtransformers == 4.57.6huggingface-hub >= 0.34.0, < 1.0vllm == 0.14.0accelerate == 1.12.0librosasoundfile- 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_qwen3asr-0.5.8.tar.gz
(119.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fasr_asr_qwen3asr-0.5.8.tar.gz.
File metadata
- Download URL: fasr_asr_qwen3asr-0.5.8.tar.gz
- Upload date:
- Size: 119.7 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ad3b09cfcef77759cd10860acfc9bb7243f0f32cee7a08a8d52baa867725b50
|
|
| MD5 |
ebc338b1f15647ba6434c81dde142153
|
|
| BLAKE2b-256 |
f08b2e799575eff3217d0deec0d654fcba81baeff27be8de4007f88a066513f5
|
File details
Details for the file fasr_asr_qwen3asr-0.5.8-py3-none-any.whl.
File metadata
- Download URL: fasr_asr_qwen3asr-0.5.8-py3-none-any.whl
- Upload date:
- Size: 122.1 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0dd086fd1a9bf8bd987c30b1d5454c1bde12013fa063234c549934f0c9364931
|
|
| MD5 |
c8133da144fd1f11547350cf39fbb85f
|
|
| BLAKE2b-256 |
314e84010ed06657c9b8787d159c0a7018ff2d71c2e44cf21730519f079c156b
|