shixian.shi
2023-05-11 b3bc53e33264e5b289d2e044859dd001213b207e
update timestamp for batch inference
1个文件已修改
11 ■■■■■ 已修改文件
funasr/bin/asr_inference_paraformer_vad_punc.py 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
funasr/bin/asr_inference_paraformer_vad_punc.py
@@ -642,7 +642,16 @@
            # 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)