游雁
2023-08-09 7845806cd8016bdc7220ad1e278e78b45dd71a4d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from funasr_onnx import Paraformer
from pathlib import Path
 
model_dir = "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch"
model = Paraformer(model_dir, batch_size=1, quantize=True)
# model = Paraformer(model_dir, batch_size=1, device_id=0)  # gpu
 
# when using paraformer-large-vad-punc model, you can set plot_timestamp_to="./xx.png" to get figure of alignment besides timestamps
# model = Paraformer(model_dir, batch_size=1, plot_timestamp_to="test.png")
 
wav_path = ['{}/.cache/modelscope/hub/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav'.format(Path.home())]
 
result = model(wav_path)
print(result)