-
Notifications
You must be signed in to change notification settings - Fork 14
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 when loading the model for evaluation #3
Comments
I fixed the problem by adding the parameter (--doc_model). However, I am facing another problem: Namespace(afn='gelu', attn_pdrop=0.1, beam=0, bpe_path='model/vocab_40000.bpe', checkpoint='/home/data/jlopez/transabs/outputs/medical/full_pretrained/checkpoints/checkpoint_18737.pt', clf_pdrop=0.1, data_file='/home/data/jlopez/transabs/datasets/medical/jsonl/full/test_encoded.jsonl', decoding_strategy=0, desc=None, doc_model=True, embd_pdrop=0.1, encoder_path='model/encoder_bpe_40000.json', gen_dir='gen', gen_len=110, k=10, max_len=110, min_len=None, n_batch=1, n_ctx=512, n_embd=768, n_head=12, n_layer=12, resid_pdrop=0.1, save_file='./res.txt', seed=42, stop_words=None, subset=None, tgt_dir='tgt') File "/home/users/jlopez/codes/transabs/evaluate.py", line 166, in File "/home/users/jlopez/codes/transabs/evaluate.py", line 123, in main File "/home/users/jlopez/codes/transabs/evaluate.py", line 47, in evaluate_model File "/home/users/jlopez/codes/transabs/generate.py", line 18, in generate_outputs File "/home/users/jlopez/.conda/envs/transabs_env/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in call File "/home/users/jlopez/.conda/envs/transabs_env/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 143, in forward File "/home/users/jlopez/.conda/envs/transabs_env/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 153, in parallel_apply File "/home/users/jlopez/.conda/envs/transabs_env/lib/python3.7/site-packages/torch/nn/parallel/parallel_apply.py", line 83, in parallel_apply File "/home/users/jlopez/.conda/envs/transabs_env/lib/python3.7/site-packages/torch/nn/parallel/parallel_apply.py", line 59, in _worker File "/home/users/jlopez/.conda/envs/transabs_env/lib/python3.7/site-packages/torch/nn/modules/module.py", line 489, in call File "/home/users/jlopez/codes/transabs/model_pytorch.py", line 386, in generate File "/home/users/jlopez/codes/transabs/model_pytorch.py", line 236, in append_batch I'm running the project using Python 3.7.7 and pytorch 1.0.1 Thank you |
Hello,
Thank you for this work, I find it very interesting.
I have an issue running the code of evaluation on the test set after training the model. I get this error when the program tries to load the weights of the checkpoint model
Traceback (most recent call last): File "/home/users/jlopez/codes/transabs/evaluate.py", line 184, in <module> main(args) File "/home/users/jlopez/codes/transabs/evaluate.py", line 131, in main dh_model.load_state_dict(state_dict) File "/home/users/jlopez/.conda/envs/transabs_env/lib/python3.7/site-packages/torch/nn/modules/module.py", line 769, in load_state_dict self.__class__.__name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for LMModel: Unexpected key(s) in state_dict: "transformer.article_embed.weight", "transformer.summary_embed.weight".
I hope you can help me fix the problem soon. Thank you!
The text was updated successfully, but these errors were encountered: