sherpa-onnx icon indicating copy to clipboard operation
sherpa-onnx copied to clipboard

When I run the quantized version of kokoro using the Python API, an error occurred.

Open guoguo1314 opened this issue 9 months ago • 6 comments

the quantized of kokoro is here: https://huggingface.co/onnx-community/Kokoro-82M-v1.0-ONNX/blob/main/onnx/model_quantized.onnx

the sherpa-onnx as follow: sherpa-onnx 1.10.45

use the command:

python sherpa-onnx/python-api-examples/offline-tts-play.py \
  --kokoro-model onnx-community/Kokoro-82M-v1.0-ONNX/onnx/model_quantized.onnx \
  --kokoro-tokens onnx-community/Kokoro-82M-v1.0-ONNX/tokens.txt \
  --kokoro-data-dir=onnx-community/Kokoro-82M-v1.0-ONNX/espeak-ng-data \
  --kokoro-dict-dir=onnx-community/Kokoro-82M-v1.0-ONNX/dict \
  --kokoro-lexicon=onnx-community/Kokoro-82M-v1.0-ONNX/lexicon-us-en.txt,onnx-community/Kokoro-82M-v1.0-ONNX/lexicon-zh.txt \
  --output-filename test.wav \
  --sid 0 \
  --speed 1.0 \
  --provider cpu \
  "今天天气真不错"

it cause the error as follow: 2025-02-26 14:00:50,567 INFO [offline-tts-play.py:513] Loading model ... Traceback (most recent call last): File "/home/lyg/Codes/sherpa-onnx/python-api-examples/offline-tts-play.py", line 576, in <module> main() File "/home/lyg/Codes/sherpa-onnx/python-api-examples/offline-tts-play.py", line 514, in main tts = sherpa_onnx.OfflineTts(tts_config) RuntimeError: Failed to load model with error: /shared/onnxruntime/core/graph/model_load_utils.h:46 void onnxruntime::model_load_utils::ValidateOpsetForDomain(const std::unordered_map<std::basic_string<char>, int>&, const onnxruntime::logging::Logger&, bool, const string&, int) ONNX Runtime only *guarantees* support for models stamped with official released onnx opset versions. Opset 5 is under development and support for this is limited. The operator schemas and or other functionality may change before next ONNX release and in this case ONNX Runtime will not guarantee backward compatibility. Current official support for domain ai.onnx.ml is till opset 4.

thank you!

guoguo1314 avatar Feb 26 '25 06:02 guoguo1314

please follow https://github.com/k2-fsa/sherpa-onnx/pull/1719

to update the onnxruntime in sherpa-onnx. currently, we use onnxruntime 1.17.1

csukuangfj avatar Feb 26 '25 06:02 csukuangfj

when I update the onnxruntime, the error also exist. Please note that, apart from the model_quantized.onnx file, the tokens.txt, espeak-ng-data, dict, lexicon-us-en.txt, and lexicon-zh.txt files were all copied from the sherpa-onnx's kokoro-multi-lang-v1_0.tar.bz2 archive https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/kokoro-multi-lang-v1_0.tar.bz2

guoguo1314 avatar Feb 26 '25 08:02 guoguo1314

when I update the onnxruntime,

which version of onnxruntime are you using? please also describe how you update it.

csukuangfj avatar Feb 26 '25 09:02 csukuangfj

Image 1.17.1, pip install onnxruntime==1.17.1dirctly

guoguo1314 avatar Feb 26 '25 09:02 guoguo1314

I hope you follow my first comment to update onnxruntime in sherpa-onnx.

csukuangfj avatar Feb 26 '25 09:02 csukuangfj

Facing the same issue. onnxruntime version is 1.21.0, onnx version is 1.17.0.

saumye avatar Mar 31 '25 13:03 saumye