Skip to content

Commit 8316fc4

Browse files
authored
docs(readme): update onnx example import path and cache location (#2607)
The example code in README files was updated to use the correct import path for Paraformer from the runtime package instead of the top-level module. The wav path was also modified to use Path.home() for cross-platform compatibility and to include the missing 'models' directory in the cache path. These changes ensure the examples work correctly with the current package structure.
1 parent a750595 commit 8316fc4

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,16 @@ res = model.export(quantize=False)
315315
### Test ONNX
316316
```python
317317
# pip3 install -U funasr-onnx
318-
from funasr_onnx import Paraformer
318+
from pathlib import Path
319+
from runtime.python.onnxruntime.funasr_onnx.paraformer_bin import Paraformer
320+
321+
322+
home_dir = Path.home()
323+
319324
model_dir = "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch"
320325
model = Paraformer(model_dir, batch_size=1, quantize=True)
321326

322-
wav_path = ['~/.cache/modelscope/hub/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav']
327+
wav_path = [f"{home_dir}/.cache/modelscope/hub/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav"]
323328

324329
result = model(wav_path)
325330
print(result)

README_zh.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,16 @@ res = model.export(quantize=False)
315315
### 测试ONNX
316316
```python
317317
# pip3 install -U funasr-onnx
318-
from funasr_onnx import Paraformer
318+
from pathlib import Path
319+
from runtime.python.onnxruntime.funasr_onnx.paraformer_bin import Paraformer
320+
321+
322+
home_dir = Path.home()
323+
319324
model_dir = "damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch"
320325
model = Paraformer(model_dir, batch_size=1, quantize=True)
321326

322-
wav_path = ['~/.cache/modelscope/hub/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav']
327+
wav_path = [f"{home_dir}/.cache/modelscope/hub/models/damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch/example/asr_example.wav"]
323328

324329
result = model(wav_path)
325330
print(result)

0 commit comments

Comments
 (0)