适用边界
先判断它是否适合你的生产约束
适合
- 不希望安装 Python 推理环境
- 桌面、边缘、离线批量与低依赖私有部署
- 需要兼容 OpenAI 的本地音频接口或 SenseVoice 多语言流式 partial
不适合
- 需要词级时间戳或严格低延迟在线流式
- 只允许使用正式 tagged release 的生产环境
- 尚未在目标硬件完成容量与准确率复测的公网服务
| 模型 | Fun-ASR-Nano-2512 / SenseVoice-Small |
|---|---|
| 硬件 | cpu / nvidia-gpu / desktop-edge-gpu |
| 操作系统 | Linux / macOS / Windows |
| 接口 | CLI / OpenAI-compatible HTTP / Buffered streaming CLI/SSE |
运行路径
从安装到已知音频验证
以下命令来自当前验证清单;上线前固定依赖、模型和硬件。
安装
git clone https://github.com/0xShug0/audio.cpp.git && cd audio.cpp
git checkout 979e070fc130bd499ad3fabeefc42b3884fff23a
bash scripts/build_linux.sh --backend cpu --model-set custom --models fun_asr_nano,sense_asr --target audiocpp_cli --target audiocpp_server
python3 tools/model_manager_v2.py install fun_asr_nano
python3 tools/model_manager_v2.py install sensevoice_small_q8
启动
build/linux-cpu-release/bin/audiocpp_cli --task asr --family fun_asr_nano --model models/Fun-ASR-Nano-2512-GGUF/fun-asr-nano-2512-q8_0.gguf --backend cpu --audio speech.wav --text-out transcript.txt
build/linux-cpu-release/bin/audiocpp_cli --task asr --family sense_asr --model models/SenseVoice-Small-GGUF/sensevoice-small-q8-audiocpp-v1.gguf --backend cpu --audio speech.wav --text-out sensevoice.txt
build/linux-cpu-release/bin/audiocpp_cli --task asr --family sense_asr --model models/SenseVoice-Small-GGUF/sensevoice-small-q8-audiocpp-v1.gguf --backend cpu --mode streaming --audio - --request-option audio_chunk_duration_sec=5 --request-option audio_chunk_mode=none < 16k_s16.pcm
printf '%s\n' '{"host":"127.0.0.1","port":8080,"backend":"cpu","threads":4,"lazy_load":true,"models":[{"id":"fun-asr-nano","family":"fun_asr_nano","path":"models/Fun-ASR-Nano-2512-GGUF/fun-asr-nano-2512-q8_0.gguf","task":"asr","mode":"offline"},{"id":"sense-asr","family":"sense_asr","path":"models/SenseVoice-Small-GGUF/sensevoice-small-q8-audiocpp-v1.gguf","task":"asr","mode":"streaming"}]}' > server.json
build/linux-cpu-release/bin/audiocpp_server --config server.json
健康检查
curl -fsS http://127.0.0.1:8080/health
curl -fsS http://127.0.0.1:8080/v1/models
Smoke test
发布前必须通过的最小验证
curl -fsS http://127.0.0.1:8080/v1/audio/transcriptions -F model=fun-asr-nano -F language=auto -F file=@speech.wav
curl -fsS http://127.0.0.1:8080/v1/audio/transcriptions -F model=sense-asr -F language=auto -F file=@speech.wav
运行与容量
把可运行推进到可运营
运行检查
- 固定 audio.cpp 主线提交与两份 GGUF revision
- 先用已知 WAV 核对两种模型的 transcript 再接业务流量
- 分别记录冷启动、预热 RTF、内存、流式窗口与并发队列
容量变量
- 音频时长、语言、声道和 VAD 分段分布
- 并发、队列等待、预热与模型缓存状态
- 精确硬件、驱动、运行时和线程配置
故障排查
- 先用 CPU + Q8_0 路径排除 GPU 环境问题
- 构建 backend 必须与运行参数一致
- SenseVoice 输入异常时先核对 schema-v1 GGUF revision、WAV 或 16 kHz 单声道 PCM
安全边界
生产入口默认不信任
- 服务默认绑定 127.0.0.1 或可信内网
- 在反向代理限制上传大小、MIME、认证与并发
- 只加载经过 SHA-256 校验的 GGUF 和配置
已知限制
SenseVoice 已合并到 audio.cpp main@979e070f,但尚未进入 tagged release;正式包发布前应固定该主线提交,且当前两条路径都不提供词级 timestamps。
公开基准仅用于复现起点,不替代目标业务负载测试。
证据与反馈