Haystack: Error: Missing keys(s) in state_dict: "embeddings.position_ids"

Created on 10 Aug 2020  路  2Comments  路  Source: deepset-ai/haystack

Describe the bug
I am following the instructions in the tutorial
https://github.com/deepset-ai/haystack/blob/master/tutorials/Tutorial6_Better_Retrieval_via_DPR.ipynb
When I try to execute the following lines :
from haystack.retriever.dense import DensePassageRetriever
retriever = DensePassageRetriever(document_store=document_store, embedding_model="dpr-bert-base-nq",
do_lower_case=True, use_gpu=True)

I get the following error
RuntimeError: Error(s) in loading state_dict for HFBertEncoder:
Missing key(s) in state_dict: "embeddings.position_ids".

File "/.local/lib/python3.6/site-packages/haystack/retriever/dense.py", line 191, in _prepare_model
model_to_load.load_state_dict(ctx_state)
File ".local/lib/python3.6/site-packages/torch/nn/modules/module.py", line 847, in load_state_dict
self.__class__.__name__, "\n\t".join(error_msgs)))

bug

Most helpful comment

Hey @mchari this seems like a version mismatch, since the notebook is able to load models. Check out our colab notebook.

So I guess you are using the notebook locally with a custom python environment.
What version of transformers do you have installed? We currently use transformers==3.0.2

All 2 comments

Hey @mchari this seems like a version mismatch, since the notebook is able to load models. Check out our colab notebook.

So I guess you are using the notebook locally with a custom python environment.
What version of transformers do you have installed? We currently use transformers==3.0.2

@Timoeller , thanks for your reply.
i re-installed transformers and haystack and I am past the error now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mongoose54 picture mongoose54  路  7Comments

laifuchicago picture laifuchicago  路  3Comments

zshnhaque picture zshnhaque  路  3Comments

bipinkc19 picture bipinkc19  路  6Comments

Utomo88 picture Utomo88  路  5Comments