torch2trt icon indicating copy to clipboard operation
torch2trt copied to clipboard

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

Open uniyushu opened this issue 3 years ago • 2 comments

root@51a03800c3eb:/data/track# python3 tools/trt.py -f exps/example/mot/yolox_s_mix_det.py -c bytetrack_s_mot17.pth.tar 2021-12-22 08:51:09.491 | INFO | main:main:49 - loaded checkpoint done. [TensorRT] WARNING: Tensor DataType is determined at build time for tensors not marked as input or output. [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-12-22 08:52:18.504 | ERROR | main::74 - An error has been caught in function '', process 'MainProcess' (3427), thread 'MainThread' (548167286800): Traceback (most recent call last):

File "tools/trt.py", line 74, in main() -> <function main at 0x7f1e9449d8>

File "tools/trt.py", line 61, in main torch.save(model_trt.state_dict(), os.path.join(file_name, "model_trt.pth")) | | | | | | | -> './YOLOX_outputs/yolox_s_mix_det' | | | | | | -> <function join at 0x7fa10e0510> | | | | | -> <module 'posixpath' from '/usr/lib/python3.6/posixpath.py'> | | | | -> <module 'os' from '/usr/lib/python3.6/os.py'> | | | -> <function Module.state_dict at 0x7f46c48840> | | -> TRTModule() | -> <function save at 0x7fa0fa9f28> -> <module 'torch' from '/usr/local/lib/python3.6/dist-packages/torch/init.py'>

File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 909, in state_dict hook_result = hook(self, destination, prefix, local_metadata) | | | | -> {'version': 1} | | | -> '' | | -> OrderedDict() | -> TRTModule() -> <function TRTModule._on_state_dict at 0x7f46510840>

File "/usr/local/lib/python3.6/dist-packages/torch2trt-0.3.0-py3.6-linux-aarch64.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'

uniyushu avatar Dec 22 '21 08:12 uniyushu

Hi, were you able to solve this? I have the same issue…

AmitNativ1984 avatar Jan 22 '23 20:01 AmitNativ1984

I have the same question,how to solve it?

zishano avatar May 07 '24 02:05 zishano