espnet / espnet_onnx

Onnx wrapper for espnet infrernce model
MIT License
156 stars 23 forks source link

"indices element out of data bounds" while inferencing #63

Open jinggaizi opened 1 year ago

jinggaizi commented 1 year ago

hi , i try to inference wav as the document "import librosa from espnet_onnx import Speech2Text speech2text = Speech2Text(tag_name='') y, sr = librosa.load('sample.wav', sr=16000) nbest = speech2text(y)" but when run "nbest = speech2text(y)" , occur a error like "onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Non-zero status code returned while running Gather node. Name:'Gather_4' Status Message: indices element out of data bounds, idx=525 must be within the inclusive range [-512,511]" my feats_lengths is 526, why this error occurs

Masao-Someki commented 1 year ago

Hi @jinggaizi , you can set max_seq_len operation as the following:

from espnet_onnx.export import ASRModelExport

m = ASRModelExport()
m.set_export_config(
    max_seq_len=1024
)
m.export_from_pretrained(...)