The provided model for imagenet is broken
Closed this issue · 3 comments
wangpichao commented
When I downloaded the model, it could not unrar. Could you kindly please upload a new one? Many thanks.
xiequnyi commented
The pretrained model you apply is broken. Could you please check it ? THX
dhkim0225 commented
I had a same problem, and the solution was simple
asdf = torch.load('/downloaded/file/blahblah.pth.tgz')
print(asdf.keys())
dhkim0225 commented
Here are my codes working with torch 0.4.1, cpu-version
I hope this helps.
from collections import OrderedDict
def copyStateDict(state_dict):
if "module." in list(state_dict.keys())[0]: # This is when weight file is saved with multi gpu
new_state_dict = OrderedDict()
for k, v in state_dict.items():
name = k.replace('module.', '')
new_state_dict[name] = v
return new_state_dict
else:
return state_dict
model = PVANet()
asdf = torch.load('weights/pvanet_600epochs.checkpoint.pth.tar', map_location='cpu')
model.load_state_dict(copyStateDict(asdf['state_dict']))