From 509d09f50d4ed73cec79e6a73de8bf30ab798e8c Mon Sep 17 00:00:00 2001
From: 维石 <shixian.shi@alibaba-inc.com>
Date: 星期一, 03 六月 2024 15:00:46 +0800
Subject: [PATCH] libtorch demo
---
runtime/python/libtorch/demo.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/runtime/python/libtorch/demo.py b/runtime/python/libtorch/demo.py
index 1ef9a20..c8eae78 100644
--- a/runtime/python/libtorch/demo.py
+++ b/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)
--
Gitblit v1.9.1