YOLOX
YOLOX copied to clipboard
AttributeError: 'NoneType' object has no attribute 'serialize'
Hello, I'm getting errors from running
python tools/trt.py -n yolox-s -c yolox_s.pth
Here is the error log.
2021-10-23 13:59:13.411 | INFO | __main__:main:54 - loaded checkpoint done.
[TensorRT] WARNING: Tensor DataType is determined at build time for tensors not marked as input or output.
[TensorRT] WARNING: Half2 support requested on hardware without native FP16 support, performance will be negatively affected.
[TensorRT] ERROR: ../rtSafe/safeRuntime.cpp (25) - Cuda Error in allocate: 2 (out of memory)
[TensorRT] ERROR: ../rtSafe/safeRuntime.cpp (25) - Cuda Error in allocate: 2 (out of memory)
2021-10-23 13:59:16.822 | ERROR | __main__:<module>:80 - An error has been caught in function '<module>', process 'MainProcess' (7349), thread 'MainThread' (140130501818176):
Traceback (most recent call last):
> File "tools/trt.py", line 80, in <module>
main()
└ <function main at 0x7f71bbbaae18>
File "tools/trt.py", line 67, in main
torch.save(model_trt.state_dict(), os.path.join(file_name, "model_trt.pth"))
│ │ │ │ │ │ │ └ './YOLOX_outputs/yolox_s'
│ │ │ │ │ │ └ <function join at 0x7f72acb66400>
│ │ │ │ │ └ <module 'posixpath' from '/usr/lib/python3.6/posixpath.py'>
│ │ │ │ └ <module 'os' from '/usr/lib/python3.6/os.py'>
│ │ │ └ <function Module.state_dict at 0x7f71c883b598>
│ │ └ TRTModule()
│ └ <function save at 0x7f72a883d158>
└ <module 'torch' from '/home/techid2000/Desktop/YOLOX/venv/lib/python3.6/site-packages/torch/__init__.py'>
File "/home/techid2000/Desktop/YOLOX/venv/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1261, in state_dict
hook_result = hook(self, destination, prefix, local_metadata)
│ │ │ │ └ {'version': 1}
│ │ │ └ ''
│ │ └ OrderedDict()
│ └ TRTModule()
└ <function TRTModule._on_state_dict at 0x7f71c7ffc620>
File "/home/techid2000/Desktop/YOLOX/venv/lib/python3.6/site-packages/torch2trt-0.3.0-py3.6.egg/torch2trt/torch2trt.py", line 436, in _on_state_dict
state_dict[prefix + "engine"] = bytearray(self.engine.serialize())
│ │ │ └ None
│ │ └ TRTModule()
│ └ ''
└ OrderedDict()
AttributeError: 'NoneType' object has no attribute 'serialize'
This is my installation.
Ubuntu 18.04
CUDA 11.1
NVIDIA driver 455.32.00
Graphics: GeForce GTX 960M/PCIe/SSE2
RAM: 8 GB
#pip freeze
nvidia-cublas==11.5.1.101
nvidia-cuda-nvrtc==11.1.105
nvidia-cuda-runtime==11.3.58
nvidia-cudnn==8.2.0.51
nvidia-pyindex==1.0.9
nvidia-tensorrt==7.2.3.4
torch==1.10.0
torch2trt==0.3.0
torchvision==0.11.1
I've tried to reduce the --workspace
and the result was Segmentation fault (core dumped)
(venv) techid2000@techid2000-ubuntu-18-04:~/Desktop/YOLOX$ python tools/trt.py -n yolox-s -c yolox_s.pth -w 28
2021-10-23 14:17:12.442 | INFO | __main__:main:54 - loaded checkpoint done.
[TensorRT] WARNING: Tensor DataType is determined at build time for tensors not marked as input or output.
[TensorRT] WARNING: Half2 support requested on hardware without native FP16 support, performance will be negatively affected.
Segmentation fault (core dumped)
Hope to get your help, thank you.
same problem!
same prolem AttributeError: 'NoneType' object has no attribute 'serialize'
I try to adjust the --workspace from 32 to 16, then it works and can be converted!
Hi everyone,
Did you solved this issue ?