PaddleSpeech
PaddleSpeech copied to clipboard
试图加载deepspeech2online_wenetspeech的onnx文件,但是报错
试图加载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的形状是什么,有人知道吗?
可以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