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


Beginning ONNX file parsing
Completed parsing of ONNX file
Building an engine…

AttributeError Traceback (most recent call last)
----> 1 main()

in main()
1 def main():
2 # initialize TensorRT engine and parse ONNX model
----> 3 engine, context = build_engine(ONNX_FILE_PATH)
4 # get sizes of input and output and allocate memory required for input data and for output data
5 for binding in engine:

in build_engine(onnx_file_path)
27 print(‘Building an engine…’)
28 engine = builder.build_cuda_engine(network)
—> 29 context = engine.create_execution_context()
30 print(“Completed creating Engine”)


TensorRT Version:
GPU Type:
Nvidia Driver Version: 460.39
CUDA Version: V10.2.89
CUDNN Version: 8.0.5
Operating System + Version: ubuntu18.04
Python Version (if applicable): 3.7
TensorFlow Version (if applicable):
PyTorch Version (if applicable): 1.7.1
Baremetal or Container (if container which image + tag):

Relevant Files

python_tensorRT_learn_opencv.ipynb (11.6 KB)

Please attach or include links to any models, data, files, or scripts necessary to reproduce your issue. (Github repo, Google Drive, Dropbox, etc.)

Steps To Reproduce

Please include:

  • Exact steps/commands to build your repro
  • Exact steps/commands to run your repro
  • Full traceback of errors encountered

Hi @Hodu,

You can convert pytorch model to tesorrt via onnx.
For your reference,
pytorch - onnx


Thank you.

1 Like