维石
2024-06-03 509d09f50d4ed73cec79e6a73de8bf30ab798e8c
runtime/python/libtorch/demo.py
@@ -1,8 +1,9 @@
from funasr_torch import Paraformer
from pathlib import Path
model_dir = (
    "/nfs/zhifu.gzf/export/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch"
    "iic/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch"
)
model = Paraformer(model_dir, batch_size=1)  # cpu
@@ -11,7 +12,7 @@
# 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 = "YourPath/xx.wav"
wav_path = "{}/.cache/modelscope/hub/{}/example/asr_example.wav".format(Path.home(), model_dir)
result = model(wav_path)
print(result)