Closed cvJie closed 5 years ago
I have the same problem. Have you solved it?
I ran through in cpu mode, modified as follows:
checkpoint = torch.load(model_path, torch.device('cpu'))
if 'state_dict' in checkpoint.keys(): checkpoint = checkpoint['state_dict']
temp_dict = {} model_dict = self.model.state_dict() for i, key in enumerate(checkpoint.keys()): if key.startswith('module'): key2 = key[7:] else: key2 = key temp_dict[key2] = checkpoint[key] model_dict.update(temp_dict) self.model.load_state_dict(model_dict)
2. In XXX_arch.py:
change cuda() to cpu()
I want to quick run the test.py ,download pre-trained model and mv to models, add SRSolver.py 305:checkpoint = torch.load(model_path,map_location='cpu'), but errors :
File "/*/srfbn/solvers/SRSolver.py", line 308, in load else self.model.module.load_state_dict
AttributeError: 'SRFBN' object has no attribute 'module'
please give me some advices, thanks