Yes, I use the commands as below:
model_path = os.path.join(args.checkpoint,‘model_epoch_{}.pth’.format(str(ep)))
checkpoint = torch.load(model_path)
model = Unet_BiCLSTM()
model.load_state_dict(checkpoint[“model”].state_dict())
where Unet_BiCLSTM() is my network which only have different forward function as the pretrained model. Then I obtain mistakes as below:
RuntimeError: Error(s) in loading state_dict for Unet_BiCLSTM:
Missing key(s) in state_dict: “feature_ext.conv0.weight”, “feature_ext.norm0.weight”, “feature_ext.norm0.bias”, “feature_ext.norm0.running_mean”, “feature_ext.norm0.running_var”, …
Is there something wrong about it?
Thanks very much!