-
Notifications
You must be signed in to change notification settings - Fork 928
Closed
Description
Line 112 in ce07620
net.load_state_dict(copyStateDict(torch.load(args.trained_model))) |
When I run test.py on my computer that does not have cuda installed, I get the following error even though --cuda=False
. I attached the picture, but I also put the error below.
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 = 'cpu' to map your storages to the CPU.
In this case, modify the following line in main
of test.py
and the code will run well. Can you add this part to main code for cpu-only users? I put an example below.
net.load_state_dict(copyStateDict(torch.load(args.trained_model)))
An example of a modified code:
if args.cuda:
net.load_state_dict(copyStateDict(torch.load(args.trained_model)))
else:
net.load_state_dict(copyStateDict(torch.load(args.trained_model, map_location='cpu')))
Thank you for publishing this good STD model.
AyushP123
Metadata
Metadata
Assignees
Labels
No labels