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.

Error(s) in loading state_dict for Xception

See original GitHub issue

As your document, the xception has error from the issue https://github.com/Cadene/pretrained-models.pytorch/issues/62 I am using your API and xception network size of 256. I got the error as the below log. Could you tell me how could I fix it using your API This is my code

model = make_model(
    'xception',
    pretrained=True,
    num_classes=100,
    dropout_p=0.2,
    input_size=(256, 256)
)

This is log

RuntimeError: Error(s) in loading state_dict for Xception:
	size mismatch for block1.rep.0.pointwise.weight: copying a param of torch.Size([128, 64, 1, 1]) from checkpoint, where the shape is torch.Size([128, 64]) in current model.
	size mismatch for block1.rep.3.pointwise.weight: copying a param of torch.Size([128, 128, 1, 1]) from checkpoint, where the shape is torch.Size([128, 128]) in current model.
	size mismatch for block2.rep.1.pointwise.weight: copying a param of torch.Size([256, 128, 1, 1]) from checkpoint, where the shape is torch.Size([256, 128]) in current model.
	size mismatch for block2.rep.4.pointwise.weight: copying a param of torch.Size([256, 256, 1, 1]) from checkpoint, where the shape is torch.Size([256, 256]) in current model.
	size mismatch for block3.rep.1.pointwise.weight: copying a param of torch.Size([728, 256, 1, 1]) from checkpoint, where the shape is torch.Size([728, 256]) in current model.
	size mismatch for block3.rep.4.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block4.rep.1.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block4.rep.4.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block4.rep.7.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block5.rep.1.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block5.rep.4.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block5.rep.7.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block6.rep.1.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block6.rep.4.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block6.rep.7.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block7.rep.1.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block7.rep.4.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block7.rep.7.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block8.rep.1.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block8.rep.4.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block8.rep.7.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block9.rep.1.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block9.rep.4.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block9.rep.7.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block10.rep.1.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block10.rep.4.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block10.rep.7.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block11.rep.1.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block11.rep.4.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block11.rep.7.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block12.rep.1.pointwise.weight: copying a param of torch.Size([728, 728, 1, 1]) from checkpoint, where the shape is torch.Size([728, 728]) in current model.
	size mismatch for block12.rep.4.pointwise.weight: copying a param of torch.Size([1024, 728, 1, 1]) from checkpoint, where the shape is torch.Size([1024, 728]) in current model.
	size mismatch for conv3.pointwise.weight: copying a param of torch.Size([1536, 1024, 1, 1]) from checkpoint, where the shape is torch.Size([1536, 1024]) in current model.
	size mismatch for conv4.pointwise.weight: copying a param of torch.Size([2048, 1536, 1, 1]) from checkpoint, where the shape is torch.Size([2048, 1536]) in current model.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
creafzcommented, Aug 22, 2018

@John1231983 I have made a temporary workaround in 648aadd, Xception should work with PyTorch 0.4 now. You can install the latest version of the library from GitHub or update it via pip (version 0.5.1 contains the fix).

1reaction
creafzcommented, Aug 23, 2018

@John1231983 For now setting dropout_p > 0 will always add a new layer between a feature extractor and a classifier.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RuntimeError: Error(s) in loading state_dict for ResNet
I was using Pytorch 0.4.1 but Jupyter Notebook which I loaded uses 0.4.0. So I added strict=False attribute to load_state_dict().
Read more >
RuntimeError: Error(s) in loading state_dict for Net #100
Hi Mr. Zhang: When I test pre-trained model on MINC-2500 using: python main.py --dataset minc --model deepten --nclass 23 --resume ...
Read more >
RuntimeError: Error(s) in loading state_dict for DynamicUnet
Here, I aim to load the model and weights to run inference with new datasets. Versions: torch==1.7.1; fastai==2.7.7; fastcore==1.5.6; torch==1.7 ...
Read more >
mobilenetv2 ssd pytorch
Load the pre-trained model and stack the classification layers on top. ... Error(s) in loading state_dict for SSD: Unexpected key(s) in state_dict: ...
Read more >
Getting Started with PyTorch Image Models (timm)
Loading datasets from TensorFlow Datasets ... which pose a problem for most other libraries; an excellent explanation of how this works is described...
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