Downloads · 30 days
10
1% of all-time downloads
soheeyang/dpr-ctx_encoder-single-trivia-base
dpr-ctx_encoder-single-trivia-base is a machine learning model from soheeyang. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
Downloads · 30 days
10
1% of all-time downloads
All-time downloads
767
Public
Repo size
2.6 GB
Likes
0
Public
Click a slice to open those files.
.h5438 MB · 50%
From the Hugging Face model README
Dense Passage Retrieval (DPR)
Vladimir Karpukhin, Barlas Oğuz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, Wen-tau Yih, Dense Passage Retrieval for Open-Domain Question Answering, EMNLP 2020.
This model is the context encoder of DPR trained solely on TriviaQA (single-trivia) using the official implementation of DPR.
Disclaimer: This model is not from the authors of DPR, but my reproduction. The authors did not release the DPR weights trained solely on TriviaQA. I hope this model checkpoint can be helpful for those who want to use DPR trained only on TriviaQA.
The following is the answer recall rate measured using PyTorch 1.4.0 and transformers 4.5.0.
The values in parentheses are those reported in the paper.
| Top-K Passages | TriviaQA Dev | TriviaQA Test |
|---|---|---|
| 1 | 54.27 | 54.41 |
| 5 | 71.11 | 70.99 |
| 20 | 79.53 | 79.31 (79.4) |
| 50 | 82.72 | 82.99 |
| 100 | 85.07 | 84.99 (85.0) |
Using AutoModel does not properly detect whether the checkpoint is for DPRContextEncoder or DPRQuestionEncoder.
Therefore, please specify the exact class to use the model.
from transformers import DPRContextEncoder, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("soheeyang/dpr-ctx_encoder-single-trivia-base")
ctx_encoder = DPRContextEncoder.from_pretrained("soheeyang/dpr-ctx_encoder-single-trivia-base")
data = tokenizer("context comes here", return_tensors="pt")
ctx_embedding = ctx_encoder(**data).pooler_output # embedding vector for context