czczup / ViT-Adapter

[ICLR 2023 Spotlight] Vision Transformer Adapter for Dense Predictions
https://arxiv.org/abs/2205.08534
Apache License 2.0
1.27k stars 140 forks source link

Error(s) in loading state_dict #57

Closed zhu-gl-ux closed 2 years ago

zhu-gl-ux commented 2 years ago

Hello, when I use beitadapter to test, there is an error in weight loading. How can I solve it? error is fellow: RuntimeError: Error(s) in loading state_dict for BeiTAdapter_L: Missing key(s) in state_dict: "backbone.blocks.0.attn.relative_position_index", "backbone.blocks.1.attn.relative_position_index", "backbone.blocks.2.attn.relative_position_index", "backbone.blocks.3.attn.relative_position_index", "backbone.blocks.4.attn.relative_position_index", "backbone.blocks.5.attn.relative_position_index", "backbone.blocks.6.attn.relative_position_index", "backbone.blocks.7.attn.relative_position_index", "backbone.blocks.8.attn.relative_position_index", "backbone.blocks.9.attn.relative_position_index", "backbone.blocks.10.attn.relative_position_index", "backbone.blocks.11.attn.relative_position_index", "backbone.blocks.12.attn.relative_position_index", "backbone.blocks.13.attn.relative_position_index", "backbone.blocks.14.attn.relative_position_index", "backbone.blocks.15.attn.relative_position_index", "backbone.blocks.16.attn.relative_position_index", "backbone.blocks.17.attn.relative_position_index", "backbone.blocks.18.attn.relative_position_index", "backbone.blocks.19.attn.relative_position_index", "backbone.blocks.20.attn.relative_position_index", "backbone.blocks.21.attn.relative_position_index", "backbone.blocks.22.attn.relative_position_index", "backbone.blocks.23.attn.relative_position_index".

czczup commented 2 years ago

Hey, what's your command to test this model? I noticed that you seem to have some custom code. If you modified some code, please notice that in the model.load_state_dict() function, strict should be set to False. The missing of these keys is to save disk space and has no influence on model testing.

zhu-gl-ux commented 2 years ago

Thanks for your reply, it works!At the same time, thank much for your model weights.