FunASR
FunASR copied to clipboard
使用说话人确认(cam++)报错: IndexError: string index out of range
spk_model使用cam++后会报”string index out of range“,去掉后则没有问题
附源代码:
from funasr import AutoModel
# paraformer-zh is a multi-functional asr model
# use vad, punc, spk or not as you need
path = "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/vad_example.wav"
model = AutoModel(model="paraformer-zh", model_revision="v2.0.4",
vad_model="fsmn-vad", vad_model_revision="v2.0.4",
punc_model="ct-punc", punc_model_revision="v2.0.4",
spk_model="cam++", spk_model_revision="v2.0.2",
)
res = model.generate(input=path, batch_size_s=300, hotword='')
print(res)
我遇到了同样的问题,可以将funasr/auto/auto_model.py文件的第575行改一下,将result["text"]改为raw_text,像这样
elif self.punc_model is not None:
punc_res = self.inference(
raw_text, #result["text"],
model=self.punc_model,
kwargs=self.punc_kwargs,
**cfg
)
改一下就可以成功运行了,这样改最简单,但这不是最好的改法,这里punc_model推理了两次导致了文本标点符号多了。
我遇到了同样的问题,可以将
funasr/auto/auto_model.py文件的第575行改一下,将result["text"]改为raw_text,像这样elif self.punc_model is not None: punc_res = self.inference( raw_text, #result["text"], model=self.punc_model, kwargs=self.punc_kwargs, **cfg )改一下就可以成功运行了,这样改最简单,但这不是最好的改法,这里punc_model推理了两次导致了文本标点符号多了。
谢谢,确实是可以了。这应该是Bug吧?
是的
我遇到了同样的问题,可以将
funasr/auto/auto_model.py文件的第575行改一下,将result["text"]改为raw_text,像这样elif self.punc_model is not None: punc_res = self.inference( raw_text, #result["text"], model=self.punc_model, kwargs=self.punc_kwargs, **cfg )改一下就可以成功运行了,这样改最简单,但这不是最好的改法,这里punc_model推理了两次导致了文本标点符号多了。
When I was processing long audio when calling the cam++ model of spk_model, I also encountered the same error. After modifying the code according to the above modification method, the actual error has been solved. Thank you very much. :)
1.2.5有这个问题。1.2.4没有发现此问题
同样问题 File "/data/audio-srt-converter/main.py", line 39, in main srt_path = srt_gen.generate_srt(wav_path, args.output_dir) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/audio-srt-converter/core/srt_generator.py", line 34, in generate_srt result = self.model.generate(input=wav_path, batch_size_s=300)[0] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/audio-srt-converter/venv/lib/python3.12/site-packages/funasr/auto/auto_model.py", line 306, in generate return self.inference_with_vad(input, input_len=input_len, **cfg) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/data/audio-srt-converter/venv/lib/python3.12/site-packages/funasr/auto/auto_model.py", line 626, in inference_with_vad sentence_list = timestamp_sentence( ^^^^^^^^^^^^^^^^^^^ File "/data/audio-srt-converter/venv/lib/python3.12/site-packages/funasr/utils/timestamp_tools.py", line 163, in timestamp_sentence sentence_text_seg[:-1] if sentence_text_seg[-1] == " " else sentence_text_seg ~~~~~~~~~~~~~~~~~^^^^ IndexError: string index out of range
1.2.5有问题, 1.2.6已修复,可以确认下。
相同问题
1.2.5有问题, 1.2.6已修复,可以确认下。
我是1.2.6版本,多线程并发的时候会出这个错误,单线程的时候不会出现