Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.
Python asraudiochineseemotion-recognitionfunasrmcp-servermultilingual-asropenai-compatible-apiparaformerpunctuationpytorchreal-time-asrspeaker-diarizationspeech-recognitionspeech-to-textstreaming-asrtranscriptionvllmvoice-activity-detectionwhisper-alternative
merge vllm: new dynamic VAD + unified server + updated benchmark
游雁005e9d845888
diff --cc docs/vllm_guide.mdindex 605480188,62950051a..7ad6daf57--- a/docs/vllm_guide.md+++ b/docs/vllm_guide.md@@@ -369,69 -363,37 +369,71 @@@ Client Serve## 6. 性能对比-### 离线推理+### Benchmark 结果(184 files, 11541s audio, 1947 VAD segments)+- | 模型 | 方法 | 耗时 | RTFx | CER | 加速 |- |------|------|------|------|-----|------|- | Fun-ASR-Nano | PyTorch | 589s | 19.6 | 8.94% | 基准 |- | Fun-ASR-Nano | **vLLM (ours)** | **29.3s** | **393.9** | **8.91%** | **20.7x** |- | Fun-ASR-Nano | yuekaizhang vLLM | 42.7s | 273.0 | 17.07% | 14.3x |- | GLM-ASR-Nano | PyTorch | 338s | 34.4 | 12.94% | 基准 |- | GLM-ASR-Nano | **vLLM (ours)** | **43.9s** | **263.2** | **12.92%** | **7.6x** |++| 模型 | 方法 | RTFx | CER | 加速 |++|------|------|------|-----|------|++| Fun-ASR-Nano | PyTorch (fixed VAD) | 19.6 | 8.94% | 基准 |++| Fun-ASR-Nano | **vLLM batch (fixed VAD)** | **393.9** | **8.91%** | **20.7x** |++| Fun-ASR-Nano | **vLLM server (dynamic VAD)** | **68.3** | **8.14%** | **3.5x** |++| Fun-ASR-Nano | yuekaizhang vLLM | 273.0 | 17.07% | 14.3x |++| GLM-ASR-Nano | PyTorch | 34.4 | 12.94% | 基准 |++| GLM-ASR-Nano | **vLLM (ours)** | **263.2** | **12.92%** | **7.6x** |++**关键结论:**- - vLLM 与 PyTorch CER 完全一致(Fun-ASR-Nano 差 0.03%,GLM-ASR 差 0.02%)- - Fun-ASR-Nano 加速 20.7x,GLM-ASR 加速 7.6x- - 比第三方 yuekaizhang/Fun-ASR-vllm 快 44%,且 CER 优 8%++- vLLM batch 与 PyTorch CER 完全一致(差 < 0.05%)++- 新动态 VAD(保留长段 ≤60s)CER 降至 **8.14%**,优于 PyTorch 的 8.94%++- Fun-ASR-Nano batch 加速 20.7x,服务模式加速 3.5x++- 比第三方 yuekaizhang/Fun-ASR-vllm 快 44%,且 CER 优 9%++### 统一 vLLM 服务(serve_vllm.py)++集成动态 VAD + SPK + 时间戳 + vLLM 推理的统一服务,提供三种接口:++```bash+CUDA_VISIBLE_DEVICES=0 python examples/industrial_data_pretraining/fun_asr_nano/serve_vllm.py --port 8899+```++| 接口 | 路径 | 功能 |+|------|------|------|+| HTTP REST | `POST /asr` | 文件上传,返回 text + segments + timestamps + speaker |+| OpenAI API | `POST /v1/audio/transcriptions` | Whisper 兼容,支持 verbose_json |+| WebSocket | `ws://host:port/ws` | 流式音频,实时返回结果 |-| 配置 | 5.6s 音频延迟 | 相对加速 |-|------|-------------|---------|-| PyTorch (baseline) | 0.89s | 1x |-| vLLM 1-GPU | 0.30s | **3x** |-| vLLM 2-GPU TP | ~0.20s | **4.5x** |+**HTTP REST 示例:**+```bash+curl -X POST http://localhost:8899/asr -F "[email protected]" -F "language=中文" -F "spk=true" -F "timestamp=true"+```-### 批量吞吐+**OpenAI API 示例:**+```bash+curl -X POST http://localhost:8899/v1/audio/transcriptions -F "[email protected]" -F "model=fun-asr-nano" -F "response_format=verbose_json"+```-| Batch Size | 1-GPU | 2-GPU | 4-GPU |-|-----------|-------|-------|-------|-| 1 | ~1.5x | ~2x | ~2.5x |-| 16 | ~4x | ~7x | ~12x |-| 32 | ~5x | ~9x | ~15x |+**性能(227s 音频):** RTF=0.015,处理时间 3.4s-### WebSocket 实时服务+### 复现 Benchmark-| 指标 | 数值 |-|------|------|-| RTF | < 0.08 |-| 首字延迟 | ~480ms |-| 30s 音频总耗时 | ~2.3s |-| 并发 | 多 WebSocket 连接 |+```bash+# Fun-ASR-Nano+CUDA_VISIBLE_DEVICES=0 python benchmark_vllm.py \+ --model FunAudioLLM/Fun-ASR-Nano-2512 \+ --audio-dir /path/to/benchmark_audio \+ --label-json /path/to/benchmark_testset.json-### VAD + vLLM Pipeline+# GLM-ASR-Nano+CUDA_VISIBLE_DEVICES=0 python benchmark_vllm.py \+ --model zai-org/GLM-ASR-Nano-2512 \+ --audio-dir /path/to/benchmark_audio \+ --label-json /path/to/benchmark_testset.json-| 场景 | PyTorch 串行 | vLLM 批量 | 加速 |-|------|-------------|-----------|------|-| 10 段 x 5s | ~9s | ~1.5s | **6x** |-| 20 段 x 5s | ~18s | ~2.5s | **7x** |+# Quick test (first 20 files, skip PyTorch)+CUDA_VISIBLE_DEVICES=0 python benchmark_vllm.py \+ --model FunAudioLLM/Fun-ASR-Nano-2512 \+ --max-files 20 --skip-pytorch \+ --audio-dir /path/to/benchmark_audio \+ --label-json /path/to/benchmark_testset.json+```---