| | |
| | | args = parser.parse_args() |
| | | |
| | | |
| | | from funasr.runtime.python.libtorch.torch_paraformer import Paraformer |
| | | from funasr.runtime.python.libtorch.funasr_torch import Paraformer |
| | | if args.backend == "onnx": |
| | | from funasr.runtime.python.onnxruntime.rapid_paraformer import Paraformer |
| | | from funasr.runtime.python.onnxruntime.funasr_onnx import Paraformer |
| | | |
| | | model = Paraformer(args.model_dir, batch_size=1, quantize=args.quantize, intra_op_num_threads=args.intra_op_num_threads) |
| | | |
| | |
| | | for i, wav_path_i in enumerate(wav_files): |
| | | wav_name, wav_path = wav_path_i.strip().split() |
| | | result = model(wav_path) |
| | | text_i = "{} {}\n".format(wav_name, result[0]) |
| | | token_i = "{} {}\n".format(wav_name, result[1]) |
| | | text_i = "{} {}\n".format(wav_name, result[0]['preds'][0]) |
| | | token_i = "{} {}\n".format(wav_name, result[0]['preds'][1]) |
| | | text_f.write(text_i) |
| | | text_f.flush() |
| | | token_f.write(token_i) |