OpenSource-Hub

FunASR

框架

modelscope/FunASR

工业级语音识别工具包,170倍实时速度。

项目简介

FunASR 是一个端到端语音识别工具包,支持 50 多种语言、说话人分离、情绪检测、流式识别和 OpenAI 兼容 API。实现 170 倍实时速度,提供 SenseVoice、Paraformer 等预训练模型。

README 预览

([简体中文](./README_zh.md)|English|[日本語](./README_ja.md)|[한국어](./README_ko.md))\n\n\n\n\n\n\n  Industrial speech recognition. 170x faster than Whisper. 50+ languages.\n  Speaker diarization · Emotion detection · Streaming · One API call\n\n\n\n  \n  \n  \n  \n\n\n\n\n\n\n\n  Quick Start · Colab · Benchmark · Model selection · Migration guide · Use cases · Deployment matrix · Models · Agent Integration · Docs · Contribute\n\n\n---\n\n## Quick Start\n\n[](https://colab.research.google.com/github/modelscope/FunASR/blob/main/examples/colab/funasr_quickstart.ipynb)\n\nNo local setup? Open the [Colab quickstart](./examples/colab/) to transcribe a public sample or upload your own audio in a browser.\n\n```bash\npip install torch torchaudio\npip install funasr\n```\n\n```python\nfrom funasr import AutoModel\n\nmodel = AutoModel(model="iic/SenseVoiceSmall", vad_model="fsmn-vad", spk_model="cam++", device="cuda")\nresult = model.generate(input="meeting.wav")\n```\n\n**Output** — structured text with speaker labels, timestamps, and punctuation:\n```\n[00:00.4 → 00:03.8] Speaker 0: Let's discuss the Q3 plan.\n[00:04.2 → 00:07.1] Speaker 1: Sounds good. I have three points.\n[00:07.5 → 00:12.3] Speaker 0: Go ahead. We have 30 minutes.\n```\n\nThat's it. **One model, one call** — VAD segmentation, speech recognition, punctuation, speaker diarization all happen automatically.\n\n### LLM-powered ASR: Fun-ASR-Nano\n\nFor highest accuracy across 31 languages (including Chinese dialects), use [Fun-ASR-Nano](https://github.com/FunAudioLLM/Fun-ASR) — an LLM-based ASR combining SenseVoice encoder with Qwen3-0.6B decoder:\n\n```python\nfrom funasr import AutoModel\n\nmodel = AutoModel(model="FunAudioLLM/Fun-ASR-Nano-2512", vad_model="fsmn-vad", device="cuda")\nresult = model.generate(input="meeting.wav")\n```\n\nWith vLLM acceleration (16x faster, batch processing):\n\n```python\nfrom funasr.auto.auto_model_vllm import AutoModelVLLM\n\nmodel = AutoModelVLLM(model="FunAudioLLM/Fun-ASR-Na

常见问题 (4)

故障排除
如何修复因源而构建的funasr的缓慢管道安装?

升级到 funasr v1.3.9 或更高版本,其中包括预先构建的通用轮胎 (‘py3-none-any’)。 这将避免源构建步骤。

来源 Issue #2943
故障排除
在 FunASR 1.3.7 中使用 vLLM 时如何修复 CUDA 错误“设备侧声明触发”?

这是由于 repetition_penalty 和 enable_prompt_embeds=True 之间的不兼容性在 vLLM 中造成的。 从 vllm_engine.generate() 调用中删除 repetition_penalty=1.3 作为 workaround,将音频分成 ≤ 25 秒片段来推断,并使用 truncate_repetition() 后处理函数来抑制重复。 示例中断逻辑: defuncate_repetition(text, min_repeat_len=5, max_repeats=3): ... . 下一个 FunASR 版本将正式采用chunking 和后处理。

来源 Issue #2950
故障排除
当 Qwen3-ASR 仅支持离线模式时,如何通过 WebSocket 进行实时语音识别?

Qwen3-ASR 不支持 WebSocket 实时流媒体(仅通过 AutoModel 离线)。 对于 WebSocket 流媒体,使用 Fun-ASR-Nano 模型与 FunASR 的实时服务器。 安装: pip install funasr>=1.3.5 vllm>=0.12.0(版本 1.3.5 修复了 ModuleNotFoundError 对于 dynamic_vadvllm.inputs.data 进口问题)。 启动服务器: python examples/industrial_data_pretraining/_funasr_nano/serve_realtime_ws.py --port 10095 --language 中文. 客户端:在浏览器中打开 client_mic.html 或使用 `client_python

来源 Issue #2886
故障排除
如何修复FunASR实时服务下载故障与未经验证的Hugging Face请求?

设置一个 Hugging Face 代币以避免率限制和下载问题。在运行服务器前导出 HF_TOKEN='your_token',或使用 huggingface-cli 登录来缓存身份证件。如果下载仍然失败,请手动从 https://huggingface.co/FunAudioLLM/Fun-ASR-Nano-2512 下载模型,并指向 -model 到本地路径。

来源 Issue #2917