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
update timestamp for batch inference
shixian.shi8c732716d62a
diff --git a/funasr/bin/asr_inference_paraformer_vad_punc.py b/funasr/bin/asr_inference_paraformer_vad_punc.pyindex 855544932..edaad379b 100644--- a/funasr/bin/asr_inference_paraformer_vad_punc.py+++ b/funasr/bin/asr_inference_paraformer_vad_punc.py@@ -3,6 +3,7 @@import jsonimport argparseimport logging+from re import Limport sysimport timeimport os@@ -635,6 +636,9 @@ def inference_modelscope(result[0] += restored_data[j][0]result[1] += restored_data[j][1]result[2] += restored_data[j][2]+ for t in restored_data[j][4]:+ t[0] += vadsegments[j][0]+ t[1] += vadsegments[j][0]result[4] += restored_data[j][4]# result = [result[k]+restored_data[j][k] for k in range(len(result[:-2]))]@@ -642,16 +646,6 @@ def inference_modelscope(# result = result_segments[0]text, token, token_int = result[0], result[1], result[2]time_stamp = None if len(result) < 5 else result[4]- # post process timestamp- offset_list = [0]- offset = 0- for i in range(1, len(time_stamp)):- if time_stamp[i][0] < time_stamp[i-1][1]:- offset += time_stamp[i-1][1]- offset_list.append(offset)- for i in range(1, len(time_stamp)):- time_stamp[i][0] += offset_list[i]- time_stamp[i][1] += offset_list[i]if use_timestamp and time_stamp is not None:postprocessed_result = postprocess_utils.sentence_postprocess(token, time_stamp)