hnluo
2023-02-05 cab7bdaa16ce1022c089e4ee46bbc68c67faf237
funasr/bin/asr_inference_paraformer_vad_punc.py
@@ -548,6 +548,7 @@
    def _forward(data_path_and_name_and_type,
                 raw_inputs: Union[np.ndarray, torch.Tensor] = None,
                 output_dir_v2: Optional[str] = None,
                 fs: dict = None,
                 param_dict: dict = None,
                 ):
        # 3. Build data-iterator
@@ -558,6 +559,7 @@
        loader = ASRTask.build_streaming_iterator(
            data_path_and_name_and_type,
            dtype=dtype,
            fs=fs,
            batch_size=1,
            key_file=key_file,
            num_workers=num_workers,
@@ -659,12 +661,8 @@
                        punc_id_list = ""
                        text_postprocessed_punc = ""
                    item = {'key': key, 'value': text_postprocessed_punc_time_stamp, 'text': text_postprocessed,
                            'time_stamp': time_stamp_postprocessed, 'punc': punc_id_list, 'token': token}
                    if outputs_dict:
                        item = {'text_punc': text_postprocessed_punc, 'text': text_postprocessed,
                                'punc_id': punc_id_list, 'token': token, 'time_stamp': time_stamp_postprocessed}
                        item = {'key': key, 'value': item}
                    item = {'key': key, 'value': text_postprocessed_punc, 'text_postprocessed': text_postprocessed,
                            'time_stamp': time_stamp_postprocessed, 'token': token}
                    asr_result_list.append(item)
                    finish_count += 1
                    # asr_utils.print_progress(finish_count / file_count)