Problem
Running the interaction example fails at model loading:
python Interaction_inference.py --device cpu
RuntimeError: Error(s) in loading state_dict for MultiOutputModel:
Missing key(s) in state_dict: "fc.weight", "fc.bias".
Unexpected key(s) in state_dict: "fc1.weight", "fc1.bias", "fc2.weight", "fc2.bias".
size mismatch for base_model.1.conv.3.weight: copying a param with shape
torch.Size([8, 32, 1, 1]) from checkpoint, the shape in current model is
torch.Size([16, 32, 1, 1]).
[...252 size mismatches total]
(my environment is Python 3.7.4, PyTorch from requirements.txt, Linux, CPU)
Cause
The current Interaction_model/model/checkpoint-000100.pth was trained with a different architecture than the one modelv2.py / Mobilev2.py build:
- Classifier head: checkpoint has
fc1 (100→128) + fc2 (128→1); code builds a single fc (100→1) - Backbone: checkpoint is MobileNetV2 at
width_mult=0.5 (channels 8/48/480, last_channel=128); code builds width_mult=1.0 (16/96/960, last_channel=1280) - GCN layers: checkpoint
gc1 is (100, 256) and gc2 is (256, 128); code builds (100, 512) and (512, 1280)
Total: 4 unexpected keys, 2 missing keys, 252 size mismatches.
git log shows the checkpoint was replaced after the model code was uploaded, and the code was never updated to match, so I think that's the likely origin.
checkpoint-000100.pth : ca280e5, 4fed02f
modelv2.py : 4fed02f
Mobilev2.py : 4fed02f
Fix (Verified)
The original checkpoint from 4fed02f loads into the current code with zero missing keys, extra keys, or size mismatches, and the pipeline then
runs to completion, producing a valid output/CCI_out.csv:
git show 4fed02f:Interaction_model/model/checkpoint-000100.pth > Interaction_model/model/checkpoint-000100.pth
It looks like ca280e5 overwrote the working checkpoint by mistake. Reverting that file resolves the issue.
Problem
Running the interaction example fails at model loading:
(my environment is Python 3.7.4, PyTorch from requirements.txt, Linux, CPU)
Cause
The current
Interaction_model/model/checkpoint-000100.pthwas trained with a different architecture than the onemodelv2.py/Mobilev2.pybuild:fc1(100→128) +fc2(128→1); code builds a singlefc(100→1)width_mult=0.5(channels 8/48/480,last_channel=128); code buildswidth_mult=1.0(16/96/960,last_channel=1280)gc1is (100, 256) andgc2is (256, 128); code builds (100, 512) and (512, 1280)Total: 4 unexpected keys, 2 missing keys, 252 size mismatches.
git logshows the checkpoint was replaced after the model code was uploaded, and the code was never updated to match, so I think that's the likely origin.Fix (Verified)
The original checkpoint from
4fed02floads into the current code with zero missing keys, extra keys, or size mismatches, and the pipeline thenruns to completion, producing a valid
output/CCI_out.csv:git show 4fed02f:Interaction_model/model/checkpoint-000100.pth > Interaction_model/model/checkpoint-000100.pthIt looks like
ca280e5overwrote the working checkpoint by mistake. Reverting that file resolves the issue.