Closed albertyou2 closed 3 years ago
Hi @albertyou2,
It seems like the map_location
argument in the torch.load
function does not support an indexed CPU device.
I changed the cpu device defined in option.py from torch.device('cpu', 0)
to torch.device('cpu')
.
Please update the code and it should be working.
But beware that CPU inference could be very slow.
Thankyou very much! I've solved this problem!
MACOS 10.15.5 PYTHON :3.6.4 PYTORCH :1.7.1
HI @SeungjunNah : I try to run demo with this code : python main.py --device_type cpu --save_dir REDS_L1 --demo true --demo_input_dir ../input --demo_output_dir ../output then I got an error :
===> Loading demo dataset: Demo Loading model from ../experiment/REDS_L1/models/model-200.pt ../experiment/REDS_L1/models/model-200.pt cpu:0 Loading optimizer from ../experiment/REDS_L1/optim/optim-200.pt Traceback (most recent call last): File "main.py", line 67, in
main()
File "main.py", line 64, in main
main_worker(args.rank, args)
File "main.py", line 18, in main_worker
optimizer = Optimizer(args, model)
File "/Users/youyin/Documents/AI/DeepDeblur-PyTorch/src/optim/init.py", line 148, in init
self.load(args.load_epoch)
File "/Users/youyin/Documents/AI/DeepDeblur-PyTorch/src/optim/init.py", line 198, in load
self.load_state_dict(torch.load(self._save_path(epoch), map_location=self.args.device), epoch=epoch)
File "/Users/youyin/.local/lib/python3.6/site-packages/torch/serialization.py", line 593, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "/Users/youyin/.local/lib/python3.6/site-packages/torch/serialization.py", line 773, in _legacy_load
result = unpickler.load()
File "/Users/youyin/.local/lib/python3.6/site-packages/torch/serialization.py", line 729, in persistent_load
deserialized_objects[root_key] = restore_location(obj, location)
File "/Users/youyin/.local/lib/python3.6/site-packages/torch/serialization.py", line 811, in restore_location
return default_restore_location(storage, str(map_location))
File "/Users/youyin/.local/lib/python3.6/site-packages/torch/serialization.py", line 183, in default_restore_location
Do you have any idea about this ?Thank you !