mihaidusmanu/d2-net

Small bug when running on CPU-only machines

uzpaka opened this issue · 1 comments

self.load_state_dict(torch.load(model_file)['model'])

With this line, pytorch tries to load the weights on the GPU and throws an error if it can't. The following update should solve the issue:

if model_file is not None:
if use_cuda:
self.load_state_dict(torch.load(model_file)['model'])
else:
self.load_state_dict(torch.load(model_file, map_location='cpu')['model'])

This should be fixed by the latest commit. Thank you!