PaddleSpeech icon indicating copy to clipboard operation
PaddleSpeech copied to clipboard

试图加载deepspeech2online_wenetspeech的onnx文件,但是报错

Open zhijianli opened this issue 1 year ago • 1 comments

试图加载deepspeech2online_wenetspeech的onnx文件,代码如下

# 动态图导出的ONNX模型测试
import time
import numpy as np
from onnxruntime import InferenceSession
audio = np.random.randn(1, 498, 161).astype('float32')
audio_len = np.random.randn(1).astype("int64")
text = np.random.randn(1, 1, 1).astype('float32')
text_len = np.random.randn(1, 2, 1).astype('float32')

# 加载ONNX模型
deepspeech_onnx = InferenceSession('/data/deepspeech2_online_wenetspeech/onnx/model.quant.int8.onnx')
ort_inputs = {'chunk_state_c_box': text_len,
              'chunk_state_h_box': text,
              'audio_chunk_lens': audio_len,
              'audio_chunk': audio
              }
ort_outs = deepspeech_onnx.run(None,ort_inputs)

但报错: onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Non-zero status code returned while running Split node. Name:'p2o.Split.0' Status Message: Input cannot be split evenly on selected axis. Input shape={1,1,1} Axis=0 NumOutputs=5

看起来似乎是 text = np.random.randn(1, 1, 1).astype('float32') 这一行的形状没有设置对,想问一下,这个text和text_len的形状是什么,有人知道吗?

zhijianli avatar Aug 17 '22 04:08 zhijianli

可以run通下这个example, https://github.com/PaddlePaddle/PaddleSpeech/blob/develop/speechx/examples/ds2_ol/onnx/README.md。 这个是对应的shape https://github.com/PaddlePaddle/PaddleSpeech/blob/develop/speechx/examples/ds2_ol/onnx/run.sh#L76

zh794390558 avatar Aug 22 '22 05:08 zh794390558