size mismatch for aspp when loading pre-trained model
See original GitHub issueHi!
Very nice repo! I’m currently trying to integrate your model into our framework (https://github.com/DIVA-DIA/DeepDIVA, feel free to check it out!). However, when I load the provided weights for deeplabv3 I get the following error:
size mismatch for aspp.conv_1x1_4.weight: copying a param with shape torch.Size([20, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([8, 256, 1, 1]).
size mismatch for aspp.conv_1x1_4.bias: copying a param with shape torch.Size([20]) from checkpoint, the shape in current model is torch.Size([8]). (deeplabv3.py:50)
I am using exactly the Resnet (ResNet18_OS8) and the ASPP (no bottleneck) that you are using in your code. Do you know what could be causing this?
Thank you very much already in advance.
Cheers, Linda
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Pytorch-size mismatch when loading the pretrained model
I want to load my pretrained models for reinforcement learning. That's how I save and load the model: def save(self, folder_to_save='.
Read more >Size mismatch when loading pretrained model #1340 - GitHub
I'm seeing this: In [1]: import pytorch_transformers In [2]: m=pytorch_transformers.AutoModel.from_pretrained('roberta-base') ...
Read more >Transfer learning with different model shapes (error: size ...
Loading my 2-category model weights into the ConvLearner that has been primed with scalar-shaped data leads to two errors: size mismatch for ......
Read more >Size mismatch for decoder.rule_logits.weight , bias and ...
I am wondering if there is any fix I can do to solve this and perform inference with the pre-trained model. Thanks a...
Read more >you may consider adding `ignore_mismatched_sizes=true` in the ...
I'm trying to load a pretrained pytorch Bert model with a different ... Kindly specify the way to load model with size mismatch,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The pre-trained resnets are taken straight from torchvision, i.e., downloaded from the urls at the top of https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py.
Thank you so much for your quick response! Yes, my model has a different number of classes.
Somewhat unrelated question: the pre-trained weights provided for the resnets are for the cityscape model aswell, or from something else?