TensorRT cannot parse some ONNX models transferred from Paddle

Hi,

We are using PaddlePaddle to train our models, but TensorRT cannot directly parse Paddle Models, so we use Paddle2ONNX to transfer Paddle models to ONNX models, then use TensorRT ONNX parser to parse our models indirectly

But we encounter one issue, some ONNX models cannot be parsed by TensorRT although most of them can be parsed, the issue is as below:

onnx: treatment_classification.onnx
[libprotobuf ERROR google/protobuf/text_format.cc:298] Error parsing text-format onnx2trt_onnx.ModelProto: 1:1: Invalid control characters encountered in text.
[libprotobuf ERROR google/protobuf/text_format.cc:298] Error parsing text-format onnx2trt_onnx.ModelProto: 1:17: Message type “onnx2trt_onnx.ModelProto” has no field named “PaddlePaddle”.
Failed to parse ONNX model from filetreatment_classification.onnx
Network must have at least one output
could not build engine
trtexec: trtexec.cpp:338: nvinfer1::ICudaEngine* onnxToTRTModel(): Assertion `false’ failed.
Aborted

This issue has blocked us moving forward, please help to check it

Hi,

It looks like your onnx file somehow cannot be recognized by the protobuf library.
Please help to confirm if the file is valid or not first.

Thanks.

Hi,

I have checked the ONNX file has no problems, we use same way to transfer Paddle models to ONNX models, and the all of the ONNX files can be read by some other tools like Netron.

Do you have some method to check whether the ONNX file match TensorRT Parser format?

Hi,

Error parsing text-format onnx2trt_onnx.ModelProto: 1:17: Message type "onnx2trt_onnx.ModelProto" has no field named "PaddlePaddle".

It looks like the issue comes from the PaddlePaddle field.
Which doesn’t be supported by onnx2trt yet:
https://github.com/onnx/onnx-tensorrt/blob/master/operators.md

Thanks.

Hi,

I have found the root cause, which is the protobuffer versions with Paddle2ONNX and TensorRT are not compatible, causing unexpected errors.

Now the issue has been solved.

Thanks

Hi,

Can you mention the compatible versions.

Thanks.