Size mismatch for gpt_model.load_state_dict(model_weight, strict=False)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 328
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
I use "python autoregressive/sample/sample_t2i.py
--vq-ckpt /data/checkpoints/vq/vq_ds16_t2i.pt
--gpt-ckpt /data/checkpoints/t2i/ControlAR/canny_MR.safetensors
--gpt-model GPT-XL --image-size 512
--condition-type seg --seed 0 --condition-path condition/example/t2i/multigen/bird.jpg
--prompt 'A bird made of blue crystal'
--adapter-size small
--control-strength 0.6"
But it report:"File "ControlAR-main/autoregressive/sample/sample_t2i.py", line 68, in main
gpt_model.load_state_dict(model_weight, strict=False)
File "/root/miniconda3/envs/varsr/lib/python3.9/site-packages/torch/nn/modules/module.py", line 2153, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for Transformer:
size mismatch for condition_mlp.uncond_embedding: copying a param with shape torch.Size([2304, 1280]) from checkpoint, the shape in current model is torch.Size([1024, 1280]). "
It seems that the weight is not correct when "/canny_MR.safetensors" weight is loaded, can you help me solve it?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at autoregressive/sample/sample_t2i.py line 68 and reproduce the provided command with the GPT-XL setting and canny_MR.safetensors checkpoint. Compare the model configuration with the checkpoint's condition_mlp.uncond_embedding shape. Done means the checkpoint loads without the reported mismatch and the sample command proceeds successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100