Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.
Python asraudiochineseemotion-recognitionfunasrmcp-servermultilingual-asropenai-compatible-apiparaformerpunctuationpytorchreal-time-asrspeaker-diarizationspeech-recognitionspeech-to-textstreaming-asrtranscriptionvllmvoice-activity-detectionwhisper-alternative
fix empty timestamp list inference
shixian.shi13c2af5de44d
diff --git a/funasr/bin/asr_inference_launch.py b/funasr/bin/asr_inference_launch.pyindex bc62b51a2..ffb0b26f8 100644--- a/funasr/bin/asr_inference_launch.py+++ b/funasr/bin/asr_inference_launch.py@@ -409,7 +409,7 @@ def inference_paraformer(ibest_writer["rtf"][key] = rtf_curif text is not None:- if use_timestamp and timestamp is not None:+ if use_timestamp and timestamp is not None and len(timestamp):postprocessed_result = postprocess_utils.sentence_postprocess(token, timestamp)else:postprocessed_result = postprocess_utils.sentence_postprocess(token)@@ -421,7 +421,7 @@ def inference_paraformer(else:text_postprocessed, word_lists = postprocessed_result[0], postprocessed_result[1]item = {'key': key, 'value': text_postprocessed}- if timestamp_postprocessed != "":+ if timestamp_postprocessed != "" or len(timestamp) == 0:item['timestamp'] = timestamp_postprocessedasr_result_list.append(item)finish_count += 1@@ -686,7 +686,7 @@ def inference_paraformer_vad_punc(text, token, token_int = result[0], result[1], result[2]time_stamp = result[4] if len(result[4]) > 0 else None- if use_timestamp and time_stamp is not None:+ if use_timestamp and time_stamp is not None and len(time_stamp):postprocessed_result = postprocess_utils.sentence_postprocess(token, time_stamp)else:postprocessed_result = postprocess_utils.sentence_postprocess(token)@@ -711,7 +711,7 @@ def inference_paraformer_vad_punc(item = {'key': key, 'value': text_postprocessed_punc}if text_postprocessed != "":item['text_postprocessed'] = text_postprocessed- if time_stamp_postprocessed != "":+ if time_stamp_postprocessed != "" or len(time_stamp) == 0:item['time_stamp'] = time_stamp_postprocesseditem['sentences'] = time_stamp_sentence(punc_id_list, time_stamp_postprocessed, text_postprocessed)