Fix underscore in conformer models

This commit is contained in:
2026-02-10 10:39:29 +08:00
parent 3a5f996508
commit 4aebd0a465

View File

@@ -203,12 +203,14 @@ def test_funasr(audio_file, lang):
# paraformer模型会一个字一个字输出中间夹太多空格会影响1-cer的结果 # paraformer模型会一个字一个字输出中间夹太多空格会影响1-cer的结果
if lang == "zh": if lang == "zh":
text = text.replace(" ", "") text = text.replace(" ", "")
text = text.replace("_", " ")
elif model_type == "conformer": elif model_type == "conformer":
res = model.generate( res = model.generate(
input=segment_path, input=segment_path,
batch_size_s=300 batch_size_s=300
) )
text = res[0]["text"] text = res[0]["text"]
text = text.replace("_", " ")
# elif model_type == "uni_asr": # elif model_type == "uni_asr":
# if i == 0: # if i == 0:
# os.remove(segment_path) # os.remove(segment_path)