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 list index out of range error (#2122)
Nixon5dbe6898cac1
diff --git a/funasr/utils/postprocess_utils.py b/funasr/utils/postprocess_utils.pyindex c4a078931..10aa29f7d 100644--- a/funasr/utils/postprocess_utils.py+++ b/funasr/utils/postprocess_utils.py@@ -125,9 +125,11 @@ def abbr_dispose(words: List[Any], time_stamp: List[List] = None) -> List[Any]:if time_stamp is not None:end = time_stamp[ts_nums[num]][1]ts_lists.append([begin, end])- else:- word_lists.append(words[num])- if time_stamp is not None and words[num] != " ":+ else:+ # length of time_stamp may not equal to length of words because of the (somehow improper) threshold set in timestamp_tools.py line 46, e.g., length of time_stamp can be zero but length of words is not.+ # Moreover, move "word_lists.append(words[num])" into if clause, to keep length of word_lists and length of ts_lists equal.+ if time_stamp is not None and ts_nums[num]<len(time_stamp) and words[num] != " ":+ word_lists.append(words[num])begin = time_stamp[ts_nums[num]][0]end = time_stamp[ts_nums[num]][1]ts_lists.append([begin, end])diff --git a/funasr/utils/timestamp_tools.py b/funasr/utils/timestamp_tools.pyindex 369dc1bc3..995e179c4 100644--- a/funasr/utils/timestamp_tools.py+++ b/funasr/utils/timestamp_tools.py@@ -84,7 +84,8 @@ def ts_prediction_lfr6_standard(timestamp_list.append([_end * TIME_RATE, num_frames * TIME_RATE])new_char_list.append("<sil>")else:- timestamp_list[-1][1] = num_frames * TIME_RATE+ if len(timestamp_list)>0:+ timestamp_list[-1][1] = num_frames * TIME_RATEif vad_offset: # add offset time in model with vadfor i in range(len(timestamp_list)):timestamp_list[i][0] = timestamp_list[i][0] + vad_offset / 1000.0