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?

yanbing-j pushed a commit to yanbing-j/ao that referenced this issue Dec 9, 2024
This PR makes torchchat support multi-modality model definition and constructions. To show our power in multi-modality area, we integrate flamingo component into our system.
Note that this is only for bare-minimum support for model definition. Please check openai_api_multimodal branch for e2e, and pytorch#1123 (comment) for better structure and llama3.1 support
yanbing-j pushed a commit to yanbing-j/ao that referenced this issue Dec 9, 2024
* added model source and type for torchtune flamingo support

* added model source and type for torchtune flamingo support

* grab missing enum

* fix ModelArgs init

* create init func for ModelArgs for BC

* update pipeline for ModleSource and ModelType

* revert lintrunner update on ET

* introduce flamingo modules form torchtune

* back up to move to linux

* mitigate building issue

* pass local test

* structual model builder

* update torchtune address

* update install requirement

* support new torchtune flamingo component

* specific version for vision and ao

* unify text-only model generation pipeline

* convert installation back and bypass torchtune

* restructual model definition

* update exportation variable name

* remove redunctant function

* 1/n torchtune 3.1 8b

* installation update

* torchtune 3.1 8b / 30b

* bring torchchat llama3.1 back

* bring tok vali back to torchchat model + revert install_requirements.sh

* solve bugs related to tt model support

* bypass torchtune import issue

* solve Jack's wonderful comments

* remveo extra dot

* add type.Callable

* fix torchchat typos

* solve bug when args.model is None

* support builder_args.params_table is None

* remove all .DS_Store

* bring gguf back

* remove reduntant updates

* bring checkpoint back

* debug

* debug

* debug

* new factory func to produce Model from modelargs

* solve comments
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