Downloads · 30 days
17
3% of all-time downloads
NAACL2022/spider-nq-question-encoder
spider-nq-question-encoder is a feature extraction model from NAACL2022. Use it when you need embeddings to search or compare text. It is set up for transformers.
This is the question encoder of the model fine-tuned on Natural Questions (and initialized from Spider) discussed in our paper Learning to Retrieve Passages without Supervision.
Downloads · 30 days
17
3% of all-time downloads
All-time downloads
646
Public
Repo size
876 MB
Likes
4
Public
Click a slice to open those files.
.bin438 MB · 100%
From the Hugging Face model README
This is the question encoder of the model fine-tuned on Natural Questions (and initialized from Spider) discussed in our paper Learning to Retrieve Passages without Supervision.
We used weight sharing for the query encoder and passage encoder, so the same model should be applied for both.
Note! We format the passages similar to DPR, i.e. the title and the text are separated by a [SEP] token, but token
type ids are all 0-s.
An example usage:
from transformers import AutoTokenizer, DPRQuestionEncoder
tokenizer = AutoTokenizer.from_pretrained("NAACL2022/spider-nq-question-encoder")
model = DPRQuestionEncoder.from_pretrained("NAACL2022/spider-nq-question-encoder")
question = "Who is the villain in lord of the rings"
input_dict = tokenizer(question, return_tensors="pt")
del input_dict["token_type_ids"]
outputs = model(**input_dict)