vt-vl-lab / 3d-photo-inpainting

[CVPR 2020] 3D Photography using Context-aware Layered Depth Inpainting
https://shihmengli.github.io/3D-Photo-Inpainting/
Other
6.91k stars 1.11k forks source link

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=torch.device('cpu') to map your storages to the CPU. #102

Closed Naozumi520 closed 2 years ago

Naozumi520 commented 4 years ago

Start Running 3D_Photo ... Loading edge model at 1599448678.443707 0%| | 0/1 [00:11<?, ?it/s] Traceback (most recent call last): File "main.py", line 79, in depth_edge_weight = torch.load(config['depth_edge_model_ckpt'], File "/Users/jackyyeung/opt/miniconda3/lib/python3.8/site-packages/torch/serialization.py", line 585, in load return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args) File "/Users/jackyyeung/opt/miniconda3/lib/python3.8/site-packages/torch/serialization.py", line 765, in _legacy_load result = unpickler.load() File "/Users/jackyyeung/opt/miniconda3/lib/python3.8/site-packages/torch/serialization.py", line 721, in persistent_load deserialized_objects[root_key] = restore_location(obj, location) File "/Users/jackyyeung/opt/miniconda3/lib/python3.8/site-packages/torch/serialization.py", line 803, in restore_location return default_restore_location(storage, str(map_location)) File "/Users/jackyyeung/opt/miniconda3/lib/python3.8/site-packages/torch/serialization.py", line 174, in default_restore_location result = fn(storage, location) File "/Users/jackyyeung/opt/miniconda3/lib/python3.8/site-packages/torch/serialization.py", line 150, in _cuda_deserialize device = validate_cuda_device(location) File "/Users/jackyyeung/opt/miniconda3/lib/python3.8/site-packages/torch/serialization.py", line 134, 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=torch.device('cpu') to map your storages to the CPU.

Abwassr commented 4 years ago

I had the same error when running inside a Virtual Machine, you can fix this by setting "gpu_ids" inside the argument.yml to -1. This will make sure that Torch uses your CPU for the model.

CharStiles commented 3 years ago

I was also getting this error, it was because i didnt have cuda installed.

zeitphase commented 3 years ago

I had the same Error when running inside a Virtual Machine, you can fix this by setting "gpu_ids" inside the argument.yml to -1. This will make sure that Torch uses your CPU for the Model.

That helped me on my MacOS. Thank you for the hint!