Open jackywangtj66 opened 1 year ago
Found the problem myself. Resume_exclude_scopes should be under 'model' instead of 'model.classification'. Suggestion: would you consider putting the scopes arguments under 'pretrained'? Since they will be useless without a pretrained model.
I tried to load a pretrained mobilevit model downloaded from model zoo for fine-tuning on a classification task with 6 labels. I do have excluded the last layer:
But I still encountered the following error: 2023-08-16 15:05:22 - ERROR - Unable to load pretrained weights from ./TrainedModels/Models/MobileVitv1/mobilevit_xxs.pt. Error: Error(s) in loading state_dict for MobileViT: size mismatch for classifier.fc.weight: copying a param with shape torch.Size([1000, 320]) from checkpoint, the shape in current model is torch.Size([6, 320]). size mismatch for classifier.fc.bias: copying a param with shape torch.Size([1000]) from checkpoint, the shape in current model is torch.Size([6]).. Exiting!!!
Do you have any idea?