Open yutao007 opened 4 years ago
modify
self.net_map.load_state_dict(torch.load(map_net_pth,map_location='cuda:1'))
at line 132 of demo.py to
self.net_map.load_state_dict(torch.load(map_net_pth,map_location='cuda:0'))
thanks ,i have done it
------------------ 原始邮件 ------------------ 发件人: "aymenmir1/pix2surf" <notifications@github.com>; 发送时间: 2020年8月28日(星期五) 晚上8:52 收件人: "aymenmir1/pix2surf"<pix2surf@noreply.github.com>; 抄送: "愚人"<1450526966@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [aymenmir1/pix2surf] it's wrong when i use gpu ,just cpu is ok (#8)
modify self.net_map.load_state_dict(torch.load(map_net_pth,map_location='cuda:1')) at line 132 of demo.py to self.net_map.load_state_dict(torch.load(map_net_pth,map_location='cuda:0'))
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Excuse me,how to run it with CPU? I can't run with GPU either.
Traceback (most recent call last): File "demo.py", line 200, in
demo.run()
File "demo.py", line 186, in run
self.forward()
File "demo.py", line 132, in forward
self.net_map.load_state_dict(torch.load(map_net_pth,map_location='cuda:1'))
File "/home/bova/anaconda3/envs/pix2surf/lib/python3.6/site-packages/torch/serialization.py", line 386, in load
return _load(f, map_location, pickle_module, **pickle_load_args)
File "/home/bova/anaconda3/envs/pix2surf/lib/python3.6/site-packages/torch/serialization.py", line 573, in _load
result = unpickler.load()
File "/home/bova/anaconda3/envs/pix2surf/lib/python3.6/site-packages/torch/serialization.py", line 536, in persistent_load
deserialized_objects[root_key] = restore_location(obj, location)
File "/home/bova/anaconda3/envs/pix2surf/lib/python3.6/site-packages/torch/serialization.py", line 403, in restore_location
return default_restore_location(storage, map_location)
File "/home/bova/anaconda3/envs/pix2surf/lib/python3.6/site-packages/torch/serialization.py", line 119, in default_restore_location
result = fn(storage, location)
File "/home/bova/anaconda3/envs/pix2surf/lib/python3.6/site-packages/torch/serialization.py", line 95, in _cuda_deserialize
device = validate_cuda_device(location)
File "/home/bova/anaconda3/envs/pix2surf/lib/python3.6/site-packages/torch/serialization.py", line 89, in validate_cuda_device
device, torch.cuda.device_count()))
RuntimeError: Attempting to deserialize object on CUDA device 1 but torch.cuda.device_count() is 1. Please use torch.load with map_location to map your storages to an existing device