Skip to content

Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.

fix modelscope inference result is empty

lzr265946fede6462002a
diff --git a/funasr/bin/modelscope_infer.py b/funasr/bin/modelscope_infer.py
index 3be6d03f3..bc24340b5 100755
--- a/funasr/bin/modelscope_infer.py
+++ b/funasr/bin/modelscope_infer.py
@@ -82,6 +82,9 @@ if __name__ == '__main__':
wav_id, wav_path = line.strip().split()
logging.info("decoding, utt_id: ['{}']".format(wav_id))
rec_result = inference_pipeline(audio_in=wav_path)
- text = rec_result["text"]
+ if 'text' in rec_result:
+ text = rec_result["text"]
+ else:
+ text = ''
f_out.write(wav_id + " " + text + "\n")
logging.info("best hypo: {} \n".format(text))