tenosrrt錯誤AttributeError: 'NoneType' object has no attribute 'serialize, 解決方法:更換版本


File "/usr/local/lib/python3.6/dist-packages/torch2trt-0.1.0-py3.6-linux-x86_64.egg/torch2trt/torch2trt.py", line 419, in _on_state_dict state_dict[prefix + "engine"] = bytearray(self.engine.serialize()) AttributeError: 'NoneType' object has no attribute 'serialize

錯誤產生環境:

trt_pose(https://github.com/NVIDIA-AI-IOT/trt_pose)

  if not os.path.exists(OPTIMIZED_MODEL):
                print('-- Converting TensorRT models. This may takes several minutes...')
                model.load_state_dict(torch.load(MODEL_WEIGHTS))
                self.model_trt = torch2trt.torch2trt(model, [data], fp16_mode=True, max_workspace_size=1 << 25)
                torch.save(self.model_trt.state_dict(), OPTIMIZED_MODEL)


解決方法:

將tenosrRT版本從7.2.2.3更換為7.1.3.4

#export LD_LIBRARY_PATH=/home/tonyyan/Documents/TensorRT-7.2.2.3/lib

export LD_LIBRARY_PATH=/home/tonyyan/Documents/TensorRT-7.1.3.4.Ubuntu-18.04.x86_64-gnu.cuda-10.2.cudnn8.0/TensorRT-7.1.3.4/lib:$LD_LIBRARY_PATH


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM