question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Size mismatch when importing pretrained vqa model

See original GitHub issue

❓ Questions and Help

Hello,

I have encountered a size mismatch problem when loading the state dictionary of the pretrained vqa model.

In particular, when running python -u habitat_baselines/run.py --exp-config habitat_baselines/config/eqa/il_vqa.yaml --run-type eval

I receive the following error RuntimeError: Error(s) in loading state_dict for VqaLstmCnnAttentionModel: size mismatch for cnn.encoder_seg.weight: copying a param with shape torch.Size([40, 512, 1, 1]) from checkpoint, the shape in current model is torch.Size([41, 512, 1, 1]). size mismatch for cnn.encoder_seg.bias: copying a param with shape torch.Size([40]) from checkpoint, the shape in current model is torch.Size([41]). size mismatch for cnn.score_pool2_seg.weight: copying a param with shape torch.Size([40, 16, 1, 1]) from checkpoint, the shape in current model is torch.Size([41, 16, 1, 1]). size mismatch for cnn.score_pool2_seg.bias: copying a param with shape torch.Size([40]) from checkpoint, the shape in current model is torch.Size([41]). size mismatch for cnn.score_pool3_seg.weight: copying a param with shape torch.Size([40, 32, 1, 1]) from checkpoint, the shape in current model is torch.Size([41, 32, 1, 1]). size mismatch for cnn.score_pool3_seg.bias: copying a param with shape torch.Size([40]) from checkpoint, the shape in current model is torch.Size([41]).

Could it be that the problem is in the pretrained vqa model? The size of these cnn-related tensors does not match when compared to the ones specified in il models (41 vs 40)…

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
mukulkhannacommented, Jan 14, 2021

Thanks @nilinykh for pointing this out. It seems the VQA checkpoint provided in the README is an outdated one. I’ll share the latest one here in a few hours, and also open a new PR to update the README.

1reaction
mukulkhannacommented, Sep 8, 2022

Hi @rpartsey, I just created a PR for the same (#942). Thanks for pointing this out!

We can close this issue as soon as it’s merged.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Training my pretrained model in different dataset and I got an ...
size mismatch for crop_encoder.bn1.embed.weight: copying a param with shape torch. ... from models.discriminator import ImageDiscriminator
Read more >
LXMERT - Hugging Face
It's a vision and language transformer model, pretrained on a variety of multi-modal datasets comprising of GQA, VQAv2.0, MSCOCO captions, and Visual genome, ......
Read more >
Size mismatch error when attempting to load_pretrained ...
I've created a model, trained it, and saved it as follows: # Create output directory if needed if not os.path.exists(args.output_dir) and ...
Read more >
vqa.pytorch - Model Zoo
features from a pretrained Resnet-152 (with images of size 3x448x448) for the image model,; our proposed Mutan (based on a Tucker Decomposition) for...
Read more >
CHANGELOG - AllenNLP v2.10.1
get() that allows you to re-initialize the pretrained weights of a transformer model, using layer indices or regex strings. Added attribute ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found