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

Unexpected key(s) in state_dict while using pre-trained model #6

Closed
lifelongeek opened this issue Nov 20, 2020 · 1 comment
Closed

Comments

@lifelongeek
Copy link

lifelongeek commented Nov 20, 2020

I download pre-trained multi-view summarization model from the link you posted (https://drive.google.com/file/d/1Rhzxk1B7oaKi85Gsxr_8WcqTRx23HO-y/view?usp=sharing).

And I am trying to run Eval_Sum.py with the pre-trained model but encounter unexpected key(s) in state_dict. Below is the error message.

  File "Eval_Sum.py", line 25, in <module>
    bart = BARTModel.from_pretrained(
  File "/home1/irteam/users/geonminkim/library/fairseq/fairseq/models/bart/model.py", line 128, in from_pretrained
    x = hub_utils.from_pretrained(
  File "/home1/irteam/users/geonminkim/library/fairseq/fairseq/hub_utils.py", line 71, in from_pretrained
    models, args, task = checkpoint_utils.load_model_ensemble_and_task(
  File "/home1/irteam/users/geonminkim/library/fairseq/fairseq/checkpoint_utils.py", line 307, in load_model_ensemble_and_task
    model.load_state_dict(state["model"], strict=strict, model_cfg=cfg.model)
  File "/home1/irteam/users/geonminkim/library/fairseq/fairseq/models/fairseq_model.py", line 115, in load_state_dict
    return super().load_state_dict(new_state_dict, strict)
  File "/home1/irteam/geonminkim/anaconda3/envs/gm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1044, in load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for BARTModel:
	Unexpected key(s) in state_dict: "section_positions.weight", "section_layernorm_embedding.weight", "section_layernorm_embedding.bias", "section.weight_ih_l0", "section.weight_hh_l0", "section.bias_ih_l0", "section.bias_hh_l0", "w_proj_layer_norm.weight", "w_proj_layer_norm.bias", "w_proj.weight", "w_proj.bias", "w_context_vector.weight". 

Could you suggest any solution?

@jiaaoc
Copy link
Member

jiaaoc commented Nov 20, 2020

Did you install fairseq from the given folder (fairseq_multi_view)?

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

2 participants