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

Removed single_model_path; added infer_tokenizer to dpr load() #1060

Merged
merged 1 commit into from
Jun 14, 2021

Conversation

julian-risch
Copy link
Member

@julian-risch julian-risch commented May 14, 2021

Removed single_model_path because we don't use it anymore.
Added parameter infer_tokenizer_classes to load function of DensePassageRetriever so that DPR models with a non-BERT tokenizer can be loaded as required in #1046
The loading can be done as follows after initializing from model hub and saving to disk:

retriever = DensePassageRetriever(
    document_store=InMemoryDocumentStore(),
    query_embedding_model="etalab-ia/dpr-question_encoder-fr_qa-camembert",
    passage_embedding_model="etalab-ia/dpr-ctx_encoder-fr_qa-camembert",
    max_seq_len_query=64,
    max_seq_len_passage=256,
    infer_tokenizer_classes=True
)

save_dir = "../saved_models/dpr"
retriever.save(save_dir=save_dir)

loaded_retriever = DensePassageRetriever.load(load_dir=save_dir, document_store=None, infer_tokenizer_classes=True)

This PR corresponds to FARM PR #765

@julian-risch julian-risch changed the title WIP: Removed single_model_path; added infer_tokenizer to dpr load() Removed single_model_path; added infer_tokenizer to dpr load() Jun 2, 2021
@julian-risch julian-risch marked this pull request as ready for review June 2, 2021 19:27
Copy link
Member

@tholor tholor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@Timoeller Timoeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes are good and solid.

Lets wait with merging until we have the new FARM version in Haystack so we can make use of the infer_tokenizer_class parameter when saving + loading.

@julian-risch
Copy link
Member Author

We have the new FARM version in Haystack, so I am merging now.

@julian-risch julian-risch merged commit f6e70f0 into master Jun 14, 2021
@julian-risch julian-risch deleted the dpr_without_bert_tokenizer branch June 14, 2021 12:14
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

Successfully merging this pull request may close these issues.

None yet

3 participants