wenet-e2e / wetts

Production First and Production Ready End-to-End Text-to-Speech Toolkit
Apache License 2.0
368 stars 58 forks source link

Hi, onnx issue when running the inference part of examples/chinese_prosody_polyphone/run.sh #133

Open dyustc opened 1 year ago

dyustc commented 1 year ago

Hi, I went to the frontend folder, it seems the g2p_prosody.py is a ready-to-go inference script, only with this missing files. So where am I suppose to find these files in this repo? Correct me if you would, thanks. usage: g2p_prosody.py [-h] --text TEXT --hanzi2pinyin_file HANZI2PINYIN_FILE --polyphone_phone_file POLYPHONE_PHONE_FILE --polyphone_prosody_model POLYPHONE_PROSODY_MODEL

dyustc commented 1 year ago

hi, when I am running examples/chinese_prosody_polyphone/run.sh, the last part is inference part, I got the following error [E:onnxruntime:, sequential_executor.cc:369 Execute] Non-zero status code returned while running Reshape node. Name:'/transform/self_attn/Reshape_4' Status Message: /onnxruntime_src/onnxruntime/core/providers/cpu/tensor/reshape_helper.h:40 onnxruntime::ReshapeHelper::ReshapeHelper(const onnxruntime::TensorShape&, onnxruntime::TensorShapeVector&, bool) gsl::narrow_cast<int64_t>(input_shape.Size()) == size was false. The input tensor cannot be reshaped to the requested shape. Input shape:{7,1,768}, requested shape:{10,8,96}

also before that, when I convert .pt file to .onnx file, it also hints me to use onnx version 14 instead of version 13, otherwise the conversion would fail

mszpc commented 1 year ago

I have also encountered the same problem. I'm not sure if you have found a solution to this problem

wk448378469 commented 1 year ago

The pre trained model provided by the official uses the onnx file exported from Torch version 1.13.1. However, there is no limited version in requirements. txt, so the 2.0.1 torch will be downloaded.

Solution:

Option 1: requirements. txt torch==1.13.1 Option 2: Modify wetts/frontend/export_onnx. py dummy_input shape, such as 1 512, and then limit the input length to 1 512 when using your own ONNX model,and download torch nightly version。

If the specific reason is unclear, why is the dynamic in torch. onnx. export included in version 2.x The first axis of the input in axes has been set to "T", representing "dynamic", but it has not taken effect

Jackiexiao commented 9 months ago

pytorch 2.0+ bug: see: https://github.com/pytorch/pytorch/issues/99701