torch2trt
torch2trt copied to clipboard
AttributeError: 'NoneType' object has no attribute 'serialize'
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:
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'
Hi, were you able to solve this? I have the same issue…
I have the same question,how to solve it?