facebookresearch / VMZ

VMZ: Model Zoo for Video Modeling
Apache License 2.0
1.04k stars 156 forks source link

ir_csn_152 size mismatch: Error(s) in loading state_dict for VideoResNet #129

Open KhHTran opened 3 years ago

KhHTran commented 3 years ago

I follow the installation guide to install VMZ locally. When I try to load the pretrained ir_csn_152 model to PyTorch: from vmz.models import ir_csn_152 model = ir_csn_152(pretraining="ig65m_32frms") I received an error saying that there is a size mismatch with fc.weight and fc.bias. I assumed this is a bug where the finetuned model was given the pretrained model weights or vice versa. image

ningbende commented 3 years ago

same problem+1

hoonkai commented 3 years ago

Same problem here. Is this solved?

KhHTran commented 3 years ago

I'm not sure. But you can solve the issue pretty easily.

GriesserP commented 3 years ago

I'm not sure. But you can solve the issue pretty easily.

Hello, could you give the solution please ?

KhHTran commented 3 years ago

You load an empty model then load the state of the pre-trained model. `url = 'https://github.com/bjuncek/VMZ/releases/download/test_models/irCSN_152_ft_kinetics_from_ig65m_f126851907.pth' dic = torch.hub.load_state_dict_from_url(url, progress = True)

model = ir_csn_152() model.load_state_dict(dic)`