SenseVoice icon indicating copy to clipboard operation
SenseVoice copied to clipboard

如何限定语言

Open MonolithFoundation opened this issue 1 year ago • 4 comments

Hi,目前默认的模式经常会将中文识别成日语,有啥办法只输出中文,或者说限定语言吗

MonolithFoundation avatar Sep 23 '24 07:09 MonolithFoundation

例子的注释里有讲到: res = m.inference( data_in=f"{kwargs ['model_path']}/example/en.mp3", language="auto", # "zh", "en", "yue", "ja", "ko", "nospeech" use_itn=False, ban_emo_unk=False, **kwargs, ) 只需要把auto换成zh就可以。

Zer0TheObserver avatar Oct 02 '24 11:10 Zer0TheObserver

这个是如何实现的?用onnxruntime推理的话如何给模型指定?

MonolithFoundation avatar Oct 08 '24 06:10 MonolithFoundation

这个是如何实现的?用onnxruntime推理的话如何给模型指定?

/其实demo就有,我把代码放在这里: from pathlib import Path from funasr_onnx import SenseVoiceSmall from funasr_onnx.utils.postprocess_utils import rich_transcription_postprocess model_dir = "PATH" model = SenseVoiceSmall(model_dir, batch_size=10, quantize=True) #inference wav_or_scp=["z2.mp3"] res = model(wav_or_scp, language=["auto"], use_itn=True)#这里auto换成zh print([rich_transcription_postprocess(i) for i in res])

Zer0TheObserver avatar Oct 09 '24 05:10 Zer0TheObserver

我意思是模型是如何使用language这个向量作为指导生成的

MonolithFoundation avatar Oct 09 '24 08:10 MonolithFoundation