NVIDIA-AI-IOT / torch2trt

An easy to use PyTorch to TensorRT converter
MIT License
4.58k stars 675 forks source link

'NoneType' object has no attribute 'create_execution_context' #728

Open wang-TJ-20 opened 2 years ago

wang-TJ-20 commented 2 years ago

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 commented 2 years ago

how to solve this question

jaybdub commented 2 years ago

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

oskaradermecker commented 2 years ago

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