TrojanXu / onnxparser-trt-plugin-sample

A sample for onnxparser working with trt user defined plugins for TRT7.0
Apache License 2.0
166 stars 36 forks source link

Linking the Custom plugins for the Conversion(while converting from ONNX to TRT Model) #5

Open Darshcg opened 3 years ago

Darshcg commented 3 years ago

Hi @TrojanXu,

Thanks for your wonderful work.

I have Implemented two custom Plugins for two unsupported Ops. I want to link those custom Plugins for the conversion(while converting from ONNX to TRT Model). Can you please assist me in doing the same? Would be a great help.

Thanks and Regards, Darshan

Darshcg commented 3 years ago

Hi @TrojanXu ,

Actually, I am facing difficulty during converting the ONNX model to TRT with a Custom plugin. It would be a great help if you can help me in the same.

Waiting for your reply.

Thanks, Darshan

TrojanXu commented 3 years ago

With latest TRT release, you can modify the onnx file to map the onnx op to a TRT plugin op, refer to https://github.com/TrojanXu/onnxparser-trt-plugin-sample/blob/master/test_plugin_result.py#L116

Darshcg commented 3 years ago

Hi @TrojanXu,

Thanks for your kind reply.

For now, I have created the .so files for the two custom Plugins. What are the next steps? (what are the commands?). As I am doing this for the first time, your help would be highly appreciable. Do I need to do anything with the TRT OSS Project?.

Environment: TRT Version: 7.1.3 CUDA: 10.2 OS: Ubuntu 18.04. GPU: RTX 2060.

Thanks and Regards, Darshan C G

Darshcg commented 3 years ago

Hi @TrojanXu ,

I got to know about the same. It is about including the .so file while conversion. Example: ./trtexec --onnx=model.onnx --explicitBatch --shapes=input1:1x1x1x1 --plugins=layer.so

But when I run this I am getting an issue as: Einsum_194: PluginV2Layer must be V2DynamicExt when there are runtime input dimensions

The image of the error has been attached below: Screenshot from 2021-02-22 01-04-57

Can you please help me to resolve this error? Where Exactly I am going wrong? what's the solution for this?

Thanks and Regards, Darshan C G

TrojanXu commented 3 years ago

You used "--shapes=input1:1x1x1x1", it means the network is using dynamic shape. Just as the error said, you need to extend V2DynamicExt class instead of PluginV2