torch2trt icon indicating copy to clipboard operation
torch2trt copied to clipboard

'NoneType' object has no attribute 'create_execution_context'

Open wang-TJ-20 opened this issue 3 years ago • 3 comments

File "ai_py/test/test_pose_detect.py", line 67, in test(img_list, folder) File "ai_py/test/test_pose_detect.py", line 32, in test pos_detector = PoseDetector(PiP_IMAGE_DIM, PiP_MODEL_PATH, PiP_POSE_FILE) File "/home/zitong.wang1/pip/ai_py/worker/PoseDetector.py", line 40, in init self.model_trt.load_state_dict(torch.load(self.optimized_model)) File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1468, in load_state_dict load(self) File "/opt/conda/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1462, in load module._load_from_state_dict( File "/opt/conda/lib/python3.8/site-packages/torch2trt-0.3.0-py3.8.egg/torch2trt/torch2trt.py", line 538, in _load_from_state_dict self.context = self.engine.create_execution_context() AttributeError: 'NoneType' object has no attribute 'create_execution_context'

wang-TJ-20 avatar Apr 25 '22 07:04 wang-TJ-20

how to solve this question

wang-TJ-20 avatar Apr 25 '22 07:04 wang-TJ-20

Hi @wang-TJ-20 ,

Thanks for reaching out!

This typically indicates that the TensorRT conversion failed for some reason.

Are you able to share the PyTorch model you're attempting to convert?

Best, John

jaybdub avatar May 05 '22 19:05 jaybdub

Same issue here with a P100 GPU... Oddly enough, when I use a T4 everything works smoothly.

oskaradermecker avatar Jun 16 '22 00:06 oskaradermecker