pytorch / pytorch/vision

Pretrained inception_v3 without aux_logits

Open
#3,648 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Description

🐛 Bug

RuntimeError: Error(s) in loading state_dict for Inception3:
Unexpected key(s) in state_dict: "AuxLogits.conv0.conv.weight", "AuxLogits.conv0.bn.weight", "AuxLogits.conv0.bn.bias", "AuxLogits.conv0.bn.running_mean", "AuxLogits.conv0.bn.running_var", "AuxLogits.conv1.conv.weight", "AuxLogits.conv1.bn.weight", "AuxLogits.conv1.bn.bias", "AuxLogits.conv1.bn.running_mean", "AuxLogits.conv1.bn.running_var", "AuxLogits.fc.weight", "AuxLogits.fc.bias".

To Reproduce

import torchvision.models
my_model = torchvision.models.inception_v3(pretrained=True, aux_logits=False)

Expected behavior

From the common sense perspective, I'm not sure if it makes any sense to load a pretrained inception_v3 without aux_logits? If it doesn't make any sense to use it like this, it would be useful to print a warning instead of (or in addition to) the current error for unexpected key(s).

But if it actually makes sense to load the model like this, this could be a fix for it:
(torchvision/models/inception.py)

model.load_state_dict(state_dict, strict=model.aux_logits)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in torchvision/models/inception.py at the pretrained Inception3 loading path and reproduce the reported aux_logits=False failure using the snippet in the issue. Resolve the expected behavior for the unexpected AuxLogits state entries and verify that the chosen behavior is covered by a regression check; the issue does not name an existing test file.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
computer-vision, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.