Open abhisingh32 opened 5 years ago
Same error here, can't load the pre-trained model. Has someone solved it? Thanks in advance
change model.load_state_dict(checkpoint['state_dict'])
to
state_dict = model.state_dict()
for k1, k2 in zip(state_dict.keys(), checkpoint.keys()):
state_dict[k1] = checkpoint[k2]
model.load_state_dict(state_dict)
Hi, thanks for sharing the great codes! When I load the pre-trained model, the number of class for saved weights of classifier.6 is 487. Is there any explanation on that?
---> 32 model.load_state_dict(checkpoint['state_dict']) 33 # model.load_state_dict(torch.load("C:\Users####\pytorch-video-recognition\c3d-pretrained.pth.tar", map_location=lambda storage, loc: storage)) 34
KeyError: 'state_dict'
model = C3D.C3D(num_classes=101, pretrained=True)
# checkpoint = torch.load('c3d-pretrained.pth', map_location=lambda storage, loc: storage)
# model.load_state_dict(checkpoint['state_dict'])
model.to(device)
model.eval()
That's OK
thanks for the code! any clue where I can find model.load_state_dict(checkpoint['state_dict'])
---> 32 model.load_state_dict(checkpoint['state_dict']) 33 # model.load_state_dict(torch.load("C:\Users####\pytorch-video-recognition\c3d-pretrained.pth.tar", map_location=lambda storage, loc: storage)) 34
KeyError: 'state_dict'