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

RuntimeError: Error(s) in loading state_dict for QuantizedFasterRCNN: #1123

Open
adityapandey369 opened this issue Oct 20, 2024 · 1 comment
Labels

Comments

@adityapandey369
Copy link

I have fine-tuned and quantized faster_rcnn model for the use but when I load it...

RuntimeError Traceback (most recent call last)
in <cell line: 10>()
8
9 # Load the quantized model weights
---> 10 quantized_model.load_state_dict(torch.load('/content/drive/MyDrive/Aditya Pandey/global_wheat_detection-2-20241004T044942Z-001/global_wheat_detection-2/Copy of faster_rcnn_40MB.pth', map_location=torch.device('cpu')))
11
12 # Set the model to evaluation mode

/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py in load_state_dict(self, state_dict, strict, assign)
2213
2214 if len(error_msgs) > 0:
-> 2215 raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
2216 self.class.name, "\n\t".join(error_msgs)))
2217 return _IncompatibleKeys(missing_keys, unexpected_keys)

RuntimeError: Error(s) in loading state_dict for QuantizedFasterRCNN:
Missing key(s) in state_dict: "model.backbone.body.conv1.weight", "model.backbone.body.bn1.weight", "model.backbone.body.bn1.bias", "model.backbone.body.bn1.running_mean", "model.backbone.body.bn1.running_var", "model.backbone.body.layer1.0.conv1.weight", "model.backbone.body.layer1.0.bn1.weight", "model.backbone.body.layer1.0.bn1.bias", "model.backbone.body.layer1.0.bn1.running_mean", "model.backbone.body.layer1.0.bn1.running_var", "model.backbone.body.layer1.0.conv2.weight", "model.backbone.body.layer1.0.bn2.weight", "model.backbone.body.layer1.0.bn2.bias", "model.backbone.body.layer1.0.bn2.running_mean", "model.backbone.body.layer1.0.bn2.running_var", "model.backbone.body.layer1.0.conv3.weight", "model.backbone.body.layer1.0.bn3.weight", "model.backbone.body.layer1.0.bn3.bias", "model.backbone.body.layer1.0.bn3.running_mean", "model.backbone.body.layer1.0.bn3.running_var", "model.backbone.body.layer1.0.downsample.0.weight", "model.backbone.body.layer1.0.downsample.1.weight", "model.backbone.body.layer1.0.downsample.1.bias", "model.backbone.body.layer1.0.downsample.1.running_mean", "model.backbone.body.layer1.0.downsample.1.running_var", "model.backbone.body.layer1.1.conv1.weight", "model.backbone.body.layer1.1.bn1.weight", "model.backbone.body.layer1.1.bn1.bias", "model.backbone.body.layer1.1.bn1.running_mean", "model.backbone.body.layer1.1.bn1.running_var", "model.backbone.body.layer1.1.conv2.weight", "model.backbone.body.layer1.1.bn2.weight", "model.backbone.body.lay...
Unexpected key(s) in state_dict: "faster_rcnn.backbone.body.conv1.weight", "faster_rcnn.backbone.body.conv1.bias", "faster_rcnn.backbone.body.conv1.scale", "faster_rcnn.backbone.body.conv1.zero_point", "faster_rcnn.backbone.body.bn1.weight", "faster_rcnn.backbone.body.bn1.bias", "faster_rcnn.backbone.body.bn1.running_mean", "faster_rcnn.backbone.body.bn1.running_var", "faster_rcnn.backbone.body.layer1.0.conv1.weight", "faster_rcnn.backbone.body.layer1.0.conv1.bias", "faster_rcnn.backbone.body.layer1.0.conv1.scale", "faster_rcnn.backbone.body.layer1.0.conv1.zero_point", "faster_rcnn.backbone.body.layer1.0.bn1.weight", "faster_rcnn.backbone.body.layer1.0.bn1.bias", "faster_rcnn.backbone.body.layer1.0.bn1.running_mean", "faster_rcnn.backbone.body.layer1.0.bn1.running_var", "faster_rcnn.backbone.body.layer1.0.conv2.weight", "faster_rcnn.backbone.body.layer1.0.conv2.bias", "faster_rcnn.backbone.body.layer1.0.conv2.scale", "faster_rcnn.backbone.body.layer1.0.conv2.zero_point", "faster_rcnn.backbone.body.layer1.0.bn2.weight", "faster_rcnn.backbone.body.layer1.0.bn2.bias", "faster_rcnn.backbone.body.layer1.0.bn2.running_mean", "faster_rcnn.backbone.body.layer1.0.bn2.running_var", "faster_rcnn.backbone.body.layer1.0.conv3.weight", "faster_rcnn.backbone.body.layer1.0.conv3.bias", "faster_rcnn.backbone.body.layer1.0.conv3.scale", "faster_rcnn.backbone.body.layer1.0.conv3.zero_point", "faster_rcnn.backbone.body.layer1.0.bn3.weight", "faster_rcnn.backbone.body.layer1.0.bn3.bias", "fas...

@jerryzh168
Copy link
Contributor

how did you get the quantized model?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants