funasr_onnx and funasr_torch SenseVoiceSmall ignore use_itn: use_itn=True still sends the woitn query

Aperta
#3,859 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@tanishqbaweja ci sta già lavorando.

Dal 8/11/2026.

  • #3860 di @tanishqbaweja — aperta
  • #3861 di @LauraGPT — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python, pytorch

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
21.2k
Fork
2.2k
Merge medio
5h 38m
PR unite (30g)
116

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di modelscope/FunASR

Tutte le issue di modelscope/FunASR

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.