CornerNet-Lite icon indicating copy to clipboard operation
CornerNet-Lite copied to clipboard

RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False.

Open yangqing-yq opened this issue 5 years ago • 8 comments

when run python demo.py, I met this question: `python demo.py total parameters: 116969339 loading from /home/qing/ngs/CornerNet-Lite/core/../cache/nnet/CornerNet_Saccade/CornerNet_Saccade_500000.pkl

Traceback (most recent call last): File "demo.py", line 7, in detector = CornerNet_Saccade() File "/home/qing/ngs/CornerNet-Lite/core/detectors.py", line 49, in init super(CornerNet_Saccade, self).init(coco, cornernet, cornernet_saccade_inference, model=model_path) File "/home/qing/ngs/CornerNet-Lite/core/base.py", line 14, in init self._nnet.load_pretrained_params(model) File "/home/qing/ngs/CornerNet-Lite/core/nnet/py_factory.py", line 123, in load_pretrained_params params = torch.load(f) File "/home/qing/anaconda3/envs/CornerNet_Lite/lib/python3.7/site-packages/torch/serialization.py", line 367, in load return _load(f, map_location, pickle_module) File "/home/qing/anaconda3/envs/CornerNet_Lite/lib/python3.7/site-packages/torch/serialization.py", line 538, in _load result = unpickler.load() File "/home/qing/anaconda3/envs/CornerNet_Lite/lib/python3.7/site-packages/torch/serialization.py", line 504, in persistent_load data_type(size), location) File "/home/qing/anaconda3/envs/CornerNet_Lite/lib/python3.7/site-packages/torch/serialization.py", line 113, in default_restore_location result = fn(storage, location) File "/home/qing/anaconda3/envs/CornerNet_Lite/lib/python3.7/site-packages/torch/serialization.py", line 94, in _cuda_deserialize device = validate_cuda_device(location) File "/home/qing/anaconda3/envs/CornerNet_Lite/lib/python3.7/site-packages/torch/serialization.py", line 78, in validate_cuda_device raise RuntimeError('Attempting to deserialize object on a CUDA ' RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location='cpu' to map your storages to the CPU. `

CUDA Version 8.0.44

I have 4 Nvidia P40 GPUs

yangqing-yq avatar Apr 21 '19 08:04 yangqing-yq

Hi, Thanks for trying out CornerNet-Lite! Were you able to resolve this? Note that the code in this repo as-is requires CUDA 10. Perhaps you can check if your conda environment contains the correct PyTorch installation for your local setup. Otherwise, upgrading your CUDA should resolve this. Yun

Yunski avatar Apr 21 '19 18:04 Yunski

I met the same problem. Have you solved it? My CUDA is 10.0.

zhangli-0812 avatar May 03 '19 16:05 zhangli-0812

@yangqing-yq Hi,how do you solve this problem?? I made this mistake, too. Thank you!

yghcats avatar May 05 '19 04:05 yghcats

I met the same problem. Have you solved it? My CUDA is 10.0.

@yghcats @Tension001 Sorry, My CUDA is 9.2, I still not try 10.0 version yet. I will let you know my result as soon as I tried it out.

yangqing-yq avatar May 05 '19 04:05 yangqing-yq

@yangqing-yq I have a problem with the driver to correct it. Thank you

yghcats avatar May 05 '19 08:05 yghcats

I have solved this problem by upgrading my NVIDIA driver. My former driver is 384, which does not match CUDA 10.0. CUDA 10.0 needs 410 or 418.

zhangli-0812 avatar May 06 '19 07:05 zhangli-0812

my cuda is CUDA Version 8.0.61 .solve this problem by using pytorch 1.0.0 py3.7_cuda9.0.176_cudnn7.4.1_1

KeeaattJj avatar Jul 31 '19 02:07 KeeaattJj

@KeeaattJj Does this mean there is a way to get around needing CUDA 10?

jg925 avatar Aug 05 '19 20:08 jg925