huawei-noah/Pretrained-IPT

加载预训练模型出现问题

zjysysu opened this issue · 2 comments

您好!我下载了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]).

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

已解决,感谢!