wenet icon indicating copy to clipboard operation
wenet copied to clipboard

export ONNX format issue for CPU

Open Fred-cell opened this issue 3 years ago • 6 comments

ENV: onnx = 1.10.0, torch=1.11.0 when i export onnx format of encoder by setting chunk_size -1, the output node is as follows: output [Addoutput_dim_0, T, 256] r_att_cache [12,4,T_CACHE,128] r_cnn_cache [12,1,256,Concatr_cnn_cache_dim_3] the dimension name "Addoutput_dim_0" and "Concatr_cnn_cache_dim_3" should be fixed to 1 and 7?

another is decoder onnx, the output is as follows: score [LogSoftmaxscore_dim_0,L,4233] r_score there is any mistake for these two output node's dimension.

Fred-cell avatar May 02 '22 00:05 Fred-cell

@xingchensong @lzhin please follow the issue.

robin1001 avatar May 03 '22 02:05 robin1001

I cannot reproduce this issue, please provide more info. Are u using u2pp_conformer or just standard conformer? whats your num_left_chunks? please show us all of your hyperparameters.

xingchensong avatar May 03 '22 05:05 xingchensong

@xingchensong Yes, i use u2++_conformer model, and my export script is as below: python wenet/bin/export_onnx_cpu.py --config exp/u2++_conformer/train.yaml --checkpoint exp/u2++_conformer/final.pt --chunk_size -1 --beam 15 --num_decoding_left_chunks -1 --output_dir ./onnx/ my OS is centos7 image

Fred-cell avatar May 03 '22 05:05 Fred-cell

I think this doesn't affect the decoding result, since Addoutput_dim_0 and Concat_cnn_cache_dim_3 can be inferred during runtime.

xingchensong avatar May 03 '22 06:05 xingchensong

I will try it for inference, and this may be a issue for onnx export, i think nbest need be set to a fixed value when exporting.

Fred-cell avatar May 03 '22 06:05 Fred-cell

Have you solved the problem? I cannot feed the r_cnn_cache with an uncertain dimension to the encoder.

Ryuk17 avatar Jun 01 '22 11:06 Ryuk17

Discussed it offline, close this issue

xingchensong avatar Feb 21 '23 04:02 xingchensong