Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed loading checkpoint #15

Open
ranpin opened this issue May 9, 2024 · 0 comments
Open

Failed loading checkpoint #15

ranpin opened this issue May 9, 2024 · 0 comments

Comments

@ranpin
Copy link

ranpin commented May 9, 2024

Hi, I'm trying to use your code as a backbone and load the pre-training weights, but have found some issues.

I have not modified anything in efficientVMamba.py and the environment is configured correctly. I refer to your loading method in detection/test_ckpt.py and the code is as follows when I load it:

# image_encoder = Backbone_EfficientVSSM( pretrained='checkpoints/efficient_vmamba_tiny.ckpt' )
# image_encoder = Backbone_EfficientVSSM( pretrained='checkpoints/efficient_vmamba_small.ckpt' )
   image_encoder = Backbone_EfficientVSSM( pretrained='checkpoints/efficient_vmamba_base.ckpt' )

And to verify that it was loaded correctly, I changed just one line of code in Class Backbone_EfficientVSSM in efficientVMamba.py as follows:

# incompatibleKeys = self.load_state_dict(new_state_dict, strict=False) #your before
incompatibleKeys = self.load_state_dict(new_state_dict, strict=True) # changed by me

But I found the following error reported:

Successfully loaded checkpoint from checkpoints/efficient_vmamba_base.ckpt
Failed loading checkpoint from checkpoints/efficient_vmamba_base.ckpt: Error(s) in loading state_dict for Backbone_EfficientVSSM:
Missing key(s) in state_dict: "layers.0.blocks.0.norm2.weight", "layers.0.blocks.0.norm2.bias", "layers.0.blocks.0.mlp.fc1.weight", "layers.0.blocks.0.mlp.fc1.bias", "layers.0.blocks.0.mlp.fc2.weight", "layers.0.blocks.0.mlp.fc2.bias", "layers.0.blocks.1.norm2.weight", "layers.0.blocks.1.norm2.bias", "layers.0.blocks.1.mlp.fc1.weight", "layers.0.blocks.1.mlp.fc1.bias", "layers.0.blocks.1.mlp.fc2.weight", "layers.0.blocks.1.mlp.fc2.bias", "layers.0.downsample.1.weight", "layers.0.downsample.1.bias", "layers.0.downsample.3.weight", "layers.0.downsample.3.bias", "layers.1.blocks.0.norm2.weight", "layers.1.blocks.0.norm2.bias", "layers.1.blocks.0.mlp.fc1.weight", "layers.1.blocks.0.mlp.fc1.bias", "layers.1.blocks.0.mlp.fc2.weight", "layers.1.blocks.0.mlp.fc2.bias", "layers.1.blocks.1.norm2.weight", "layers.1.blocks.1.norm2.bias", "layers.1.blocks.1.mlp.fc1.weight", "layers.1.blocks.1.mlp.fc1.bias", "layers.1.blocks.1.mlp.fc2.weight", "layers.1.blocks.1.mlp.fc2.bias", "layers.1.downsample.1.weight", "layers.1.downsample.1.bias", "layers.1.downsample.3.weight", "layers.1.downsample.3.bias", "layers.2.11.1.weight", "layers.2.11.1.bias", "layers.2.11.3.weight", "layers.2.11.3.bias", "outnorm0.weight", "outnorm0.bias", "outnorm1.weight", "outnorm1.bias", "outnorm2.weight", "outnorm2.bias", "outnorm3.weight", "outnorm3.bias".
Unexpected key(s) in state_dict: "classifier.norm.weight", "classifier.norm.bias", "classifier.head.weight", "classifier.head.bias", "layers.0.downsample.reduction.weight", "layers.0.downsample.norm.weight", "layers.0.downsample.norm.bias", "layers.1.downsample.reduction.weight", "layers.1.downsample.norm.weight", "layers.1.downsample.norm.bias", "layers.2.11.reduction.weight", "layers.2.11.norm.weight", "layers.2.11.norm.bias".

The similar problem occurs when loading the other two weights. May I ask if there is a mismatch between the currently uploaded weights and the model code? Or am I missing something? Looking forward to your reply, thanks!

@ranpin ranpin mentioned this issue May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant