nasnet-pytorch icon indicating copy to clipboard operation
nasnet-pytorch copied to clipboard

NasNet Missing key(s) in state_dict

Open alixiu opened this issue 3 years ago • 0 comments

I defined a new function def build_and_load_model(path, nas_type): model = NASNetALarge(1001) if nas_type == 'large' else NASNetAMobile(1001) filename_model = os.path.join(path, 'pytorch', nas_type == 'large' and 'nasnet_a_large.pth' or 'nasnet_a_mobile.pth') state_dict = torch.load(filename_model, map_location='cpu') model.load_state_dict(state_dict) return model Among them, "tf-models/pytorch/nasnet_a_mobile.pth file is from the pth file you provided

The ported model files are provided: NASNet-A_Mobile_224, NASNet-A_large_331.

Now, I met the following error when call build_and_load_model() RuntimeError: Error(s) in loading state_dict for NASNet: Missing key(s) in state_dict: "aux_features.2.weight", "aux_features.3.running_var", "aux_features.3.bias", "aux_features.3.weight", "aux_features.3.running_mean", "aux_features.5.weight", "aux_features.6.running_var", "aux_features.6.bias", "aux_features.6.weight", "aux_features.6.running_mean", "aux_linear.bias", "aux_linear.weight". Is it not match that nasnet_a_mobile.pth provided and the model that NASNetAMobile(1001) function defines?

alixiu avatar Jan 11 '21 04:01 alixiu