Skip to content

SenseVoice 官方模型仓库无法开箱即用:quantize 参数 + 模型文件缺失 #101

Description

@gzq-myy

现象

按 README 安装 uv sync --extra sensevoice 并配置模型路径后,转写时报错或无法加载模型。经排查有两个问题叠加,导致用户按“官方 ONNX 模型仓库”配置必然失败。

问题 1:未传 quantize=True,官方仓库只有量化版

src/b2t/transcribers/sensevoice_local.py 第 71 行:

self._model = SenseVoiceSmall(str(self.model_dir))

funasr_onnx 的 SenseVoiceSmall 默认 quantize=False,会加载 model.onnx;但官方 ONNX 模型仓库(ModelScope iic/SenseVoiceSmall-onnx、HuggingFace FUNASR/SenseVoiceSmall-onnx)只提供 model_quant.onnx。结果:找不到 model.onnx 时 funasr_onnx 会尝试“导出 ONNX”,依赖未安装的 funasr 包并报错。

问题 2:官方 ONNX 仓库缺少必需文件

SenseVoiceSmall.__init__ 加载时硬性需要:

  • config.yaml
  • am.mvn
  • chn_jpn_yue_eng_ko_spectok.bpe.model(sentencepiece tokenizer)

但官方 ONNX 仓库文件列表只有:.gitattributes / am.mvn / config.yaml / configuration.json / model_quant.onnx / README.md / tokens.json,缺少 chn_jpn_yue_eng_ko_spectok.bpe.model。即使补上 quantize 问题,加载也会因缺 tokenizer 文件失败。

建议

  1. SenseVoiceSmall 调用改为 SenseVoiceSmall(str(self.model_dir), quantize=True)
  2. bootstrap 向导目前只让用户填一个本地路径、不提供模型下载指引,README 也未说明模型从哪获取。建议:支持直接填 ModelScope 模型名(如 iic/SenseVoiceSmall-onnx)自动下载,或在文档中写明需要补充下载 chn_jpn_yue_eng_ko_spectok.bpe.model(来自 iic/SenseVoiceSmall 仓库)。

环境

  • macOS (Apple Silicon), Python 3.12 (uv), funasr-onnx 0.4.1
  • bili2text 0.3.0(main 分支,2026-08 拉取)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions