PaddlePaddle / Paddle2ONNX

ONNX Model Exporter for PaddlePaddle
Apache License 2.0
705 stars 162 forks source link

Error Converting SVTR to ONNX and OpenVINO IR #811

Closed Simardeep27 closed 1 month ago

Simardeep27 commented 2 years ago

Describe the bug

The paddle SVTR model uses grid_sampler function which is prevents conversion to onnx. The grid sampler function is added in opset v16 for onnx, when will there be an addition of version16? Is there any workaround regarding this?

Informations (please complete the following information):

Additional context I have tried using an alternative custom function of grid_sampler written originally in torch. Is there any method that I could use to use torch.tensor instead of paddle.tensor for creating a static graph while converting the model to onnx?

jiangjiajun commented 2 years ago

we have implemented a grid_sampler which is composed by some common operators here https://github.com/PaddlePaddle/Paddle2ONNX/blob/develop/paddle2onnx/legacy/op_mapper/custom_paddle_op/grid_sampler.py

Please try to convert your Paddle model with flag --enable_dev_version False

Simardeep27 commented 2 years ago

Thanks a lot for the solution. I am able to convert the model to onnx but while converting it to OpenVino IR. I am getting a concat_axis error, possibly due to axis of a concat layer being -1. The error is as follow: RuntimeError: Check 'concat_axis == 0' failed at C:\j\workspace\private-ci\ie\build-windows-vs2019@3\b\repos\openvino\src\common\transformations\src\transformations\common_optimizations\simplify_shape_of_sub_graph.cpp:243: axis is not valid for matched Concat with 1D output.

Is there any possible solution for this?