isl-org / lang-seg

Language-Driven Semantic Segmentation
MIT License
722 stars 91 forks source link

load ckpt error #25

Closed zimingzhong closed 2 years ago

zimingzhong commented 2 years ago

I want to run

python -u test_lseg_zs.py --backbone clip_resnet101 --module clipseg_DPT_test_v2 --dataset fss \
--widehead --no-scaleinv --arch_option 0 --ignore_index 255 --fold 0 --nshot 0 \
--weights checkpoints/fss_l16.ckpt 

load it to <class 'modules.lseg_module_zs.LSegModuleZS'> and get the error.

size mismatch for net.scratch.layer4_rn.weight: copying a param with shape torch.Size([256, 1024, 3, 3]) from checkpoint, the shape in current model is torch.Size([256, 2048, 3, 3]).

Boyiliee commented 2 years ago

Hi @zimingzhong ,

Thanks for your question, you should use the correct backbone for each model, just fixed the typo, should be

python -u test_lseg_zs.py --backbone clip_vitl16_384 --module clipseg_DPT_test_v2 --dataset fss \
--widehead --no-scaleinv --arch_option 0 --ignore_index 255 --fold 0 --nshot 0 \
--weights checkpoints/fss_l16.ckpt 

Hope this helps!