Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Error(s) in loading state_dict for IRNet #50

Open
anshudaur opened this issue Sep 25, 2020 · 0 comments
Open

RuntimeError: Error(s) in loading state_dict for IRNet #50

anshudaur opened this issue Sep 25, 2020 · 0 comments

Comments

@anshudaur
Copy link

HI All, I am getting below error while loading IRNET trained model, i am using the final end_model.model to evaluate

/python3.8/site-packages/torch/nn/modules/module.py", line 846, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for IRNet:
size mismatch for lf_decoder_lstm.weight_ih: copying a param with shape torch.Size([1200, 556]) from checkpoint, the shape in current model is torch.Size([1200, 492]).
size mismatch for sketch_decoder_lstm.weight_ih: copying a param with shape torch.Size([1200, 556]) from checkpoint, the shape in current model is torch.Size([1200, 492]).
size mismatch for type_embed.weight: copying a param with shape torch.Size([10, 128]) from checkpoint, the shape in current model is torch.Size([10, 64]).
size mismatch for att_project.weight: copying a param with shape torch.Size([300, 428]) from checkpoint, the shape in current model is torch.Size([300, 364]).
Namespace(data_path='./spider', input_path='predict_lf.json', output_path='./results/irnet')

I have tried following :

  1. model.load_state_dict(pretrained_modeled,strict=False)

  2. from collections import OrderedDict
    new_state_dict = OrderedDict()
    #for k in pretrained_model.keys():
    for k,v in pretrained_model.items():
    #if k not in model.state_dict().keys():
    # del pretrained_modeled[k]
    print("actual key ::",k)
    new_state_dict[k]=v

    model.load_state_dict(new_state_dict)

Any suggestions would be helpful. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant