huawei-noah / Pretrained-IPT

Apache License 2.0
424 stars 63 forks source link

加载预训练模型出现问题 #23

Closed zjysysu closed 1 year ago

zjysysu commented 2 years ago

您好!我下载了IPT_pretrain.pt,但在加载这一预训练模型时出现了参数不匹配的问题:

File "main.py", line 37, in main() File "main.py", line 30, in main _model.model.load_state_dict(state_dict,strict = False) File "/home/miniconda3/envs/py38/lib/python3.8/site-packages/torch/nn/modules/module.py", line 829, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for ipt: size mismatch for body.query_embed.weight: copying a param with shape torch.Size([6, 147456]) from checkpoint, the shape in current model is torch.Size([1, 147456]).

HantingChen commented 2 years ago

你好,添加参数--num_queries 6 即可

zjysysu commented 2 years ago

已解决,感谢!