Media-Smart/volksdep

AttributeError: 'NoneType' object has no attribute 'create_execution_context'

rsj007 opened this issue · 3 comments

Hi! I want to convert my onnx to tensorrt model. The error is shown below. Could you please tell me how to solve it?

[TensorRT] ERROR: INVALID_ARGUMENT: getPluginCreator could not find plugin ScatterND version 1
In node -1 (importFallbackPluginImporter): UNSUPPORTED_NODE: Assertion failed: creator && "Plugin not found, are the plugin name, version, and namespace correct?"
[TensorRT] ERROR: Network must have at least one output
[TensorRT] ERROR: Network validation failed.
Traceback (most recent call last):
File "zed_onnx2trt.py", line 9, in
trt_model = onnx2trt(model)
File "/home/nvidia/.local/lib/python3.6/site-packages/volksdep/converters/onnx2trt.py", line 119, in onnx2trt
trt_model = TRTModel(engine)
File "/home/nvidia/.local/lib/python3.6/site-packages/volksdep/converters/base.py", line 50, in init
self.context = self.engine.create_execution_context()
AttributeError: 'NoneType' object has no attribute 'create_execution_context'

hxcai commented

@rsj007 Some of your onnx operation is not supported by TensorRT. Do you use PyTorch to generate your onnx model? And which opset version do you use?

@hxcai Yes, my pytorch model contains grid_sampler which is not supported by ONNX. I use Tensorrt OSS to build this custom operator as "https://github.com/TrojanXu/onnxparser-trt-plugin-sample" said. In this way, I have converted pytorch to onnx. But the onnx file cannot be converted to tensorrt and the error is above shown.
The opset is 11.

hxcai commented

@rsj007 You may compile grid sampler following "https://github.com/TrojanXu/onnxparser-trt-plugin-sample" because our tool dose not contain operation plugin. And we suggest to use opset 9.