funasr_onnx and funasr_torch SenseVoiceSmall ignore use_itn: use_itn=True still sends the woitn query
維護者通常 1 天內回覆
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 停滯
研究方向
Read runtime/python/onnxruntime/funasr_onnx/sensevoice_bin.py and runtime/python/libtorch/funasr_torch/sensevoice_bin.py, especially the SenseVoiceSmall.__call__ handling of textnorm. The issue provides a model-free reproduction; use it to check the use_itn=True case in both packages. Done means both wrappers send withitn for use_itn=True, consistent with the documented behavior.
由索引模型根據 Issue 內容生成。
描述
SenseVoiceSmall.__call__ in runtime/python/onnxruntime/funasr_onnx/sensevoice_bin.py (line 155) and runtime/python/libtorch/funasr_torch/sensevoice_bin.py (line 150) reads only the textnorm keyword:
textnorm_input = kwargs.get("textnorm", "woitn")
use_itn is never read. So model(wav_or_scp, language="auto", use_itn=True) sends the woitn query (15), the same as use_itn=False. That is the call in runtime/python/onnxruntime/demo_sencevoice_small.py, runtime/python/libtorch/demo_sensevoice_small.py, examples/industrial_data_pretraining/sense_voice/demo_onnx.py and demo_libtorch.py, and in the ONNX and Libtorch sections of the SenseVoice README (also README_zh.md and README_ja.md). The README describes use_itn as "Whether the output result includes punctuation and inverse text normalization". SenseVoiceSmall.inference (AutoModel) sends the withitn query (14) for use_itn=True, as the C++ runtime does for svs_itn (default true).
Repro without model files, from the repository root with PYTHONPATH=runtime/python/onnxruntime (the same with funasr_torch and PYTHONPATH=runtime/python/libtorch):
from funasr_onnx import SenseVoiceSmall
class Stop(Exception):
pass
def read_tags(language_input, textnorm_input): # the first step of __call__
print(textnorm_input)
raise Stop
model = SenseVoiceSmall.__new__(SenseVoiceSmall) # skip loading the model files
model.read_tags = read_tags
for kwargs in ({}, {"use_itn": False}, {"use_itn": True}, {"textnorm": "withitn"}):
try:
model("en.mp3", language="auto", **kwargs)
except Stop:
pass
Output on main (20f26b7c4), for both packages:
woitn
woitn
woitn
withitn
Expected: withitn on the third line (use_itn=True).
This is a regression from 925910c59 ("update onnx batch inference"). The use_itn=True call came with aa3fe1a35 and c5f7f11b5, which made both wrappers read use_itn like SenseVoiceSmall.inference; the next day, 925910c59 replaced that with the textnorm list/file reader and dropped use_itn. Passing textnorm="withitn" works around it.
Environment: Windows 11, Python 3.11.17, onnxruntime 1.23.2, torch 2.10.0+cpu; funasr_onnx and funasr_torch from runtime/python on main.
- 主要語言
- Python
- 星號
- 21.2k
- 分支
- 2.2k
- 平均合併
- 5 小時 38 分鐘
- 30 天內合併 PR
- 116
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
modelscope/FunASR 的其他 Issue
-
[Bug] ClusterBackend passes torch.Tensor to UMAP 0.6.0, causing a torch.float32 dtype TypeError可能已有人在做 @hansazilinon-art 於 18 天前認領。 未關閉bug needs triage
難度 2/5 1-3 小時 新手友好度 84/100
modelscope/FunASR#3908 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
modelscope/FunASR#3801 · 3 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
modelscope/FunASR#3796 · 3 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
modelscope/FunASR#3762 · 1 則留言 ·
維護者通常 1 天內回覆
-
Bug: blank lines in wav.scp / jsonl file lists crash prepare_data_iterator (IndexError / JSONDecodeError)可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉needs feedback
難度 2/5 1-3 小時 新手友好度 85/100
modelscope/FunASR#3757 · 1 則留言 ·
維護者通常 1 天內回覆
查看 modelscope/FunASR 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
AIR-Bench Foundation reads the first letter of the word after "answer" as the model's choice可能已有人在做 @beartester34 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 84/100
modelscope/evalscope#2330 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 74/100
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
Distribution plot crashes when a numeric feature is constant in the train or test set可能已有人在做 @adembilge 今天認領。 未關閉bug good first issue
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 10 天內回覆