You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi bor:
when I try to run test.py, and when the code go into line 58:
trainer.load_checkpoint(log_dir + 'checkpoint')
then an error happend at here.
''' 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.
'''
this looks like means I must run these code on a cuda device.
or because of this test model is trained on a cuda device, I must build a new model which supported on CPU only?
The text was updated successfully, but these errors were encountered:
Hello knowasdf, I tried to reproduce the issue but did not succeed. I searched your question and find this. So I propose to replace the line 219 of trainer.py by
"""
state_dict = torch.load(checkpoint_path, map_location={'cuda:0': 'cpu'})
"""
I hope that could help you solve the problem :)
Hey bro:
cool job!! it's WORKING now.
for adaptability, I revised some code like these: trainer.py at line 218,219: def load_checkpoint(self, checkpoint_path, device={'cuda:0': 'cpu'}):
state_dict = torch.load(checkpoint_path, device) train.py at line 77: epoch_0 = trainer.load_checkpoint(opts.checkpoint, device) test.py at line 56: trainer.load_checkpoint(opts.checkpoint, device) test.py at line 58: trainer.load_checkpoint(log_dir + 'checkpoint', device)
Hi bor:
when I try to run test.py, and when the code go into line 58:
trainer.load_checkpoint(log_dir + 'checkpoint')
then an error happend at here.
'''
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.
'''
this looks like means I must run these code on a cuda device.
or because of this test model is trained on a cuda device, I must build a new model which supported on CPU only?
The text was updated successfully, but these errors were encountered: