본문 바로가기
에러모음집

torch.load mapping location

by 미라미라킴227 2021. 9. 5.

RuntimeError: Attempting to deserialize object on CUDA device 3 but torch.cuda.device_count() is 1. Please use torch.load with map_location to map your storages to an existing device.

 

https://github.com/computationalmedia/semstyle/issues/3

 

RuntimeError: Attempting to deserialize object on CUDA device 2 but torch.cuda.device_count() is 1. Please use torch.load with m

After running python img_to_text.py --test_folder photos, I'm getting File "/home/ahrzb/.pyenv/versions/2.7.15/envs/mzh2.7/lib/python2.7/site-packages/torch/serialization.py", line 35...

github.com

 

 

loaded_state = torch.load(model_path+seq_to_seq_test_model_fname,map_location='cuda:0')

여러 대의 gpu로 training 된 경우, 저렇게 mapping location을 따로 언급해줘야함!