oriram commited on
Commit
2771951
1 Parent(s): 90b25b1

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +25 -0
README.md ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Spider-TriviaQA: Context Encoder
2
+
3
+ This is the context encoder of the model fine-tuned on TriviaQA (and initialized from Spider) discussed in our paper [Learning to Retrieve Passages without Supervision](https://arxiv.org/abs/2112.07708).
4
+
5
+ ## Usage
6
+
7
+ We used weight sharing for the query encoder and passage encoder, so the same model should be applied for both.
8
+
9
+ **Note**! We format the passages similar to DPR, i.e. the title and the text are separated by a `[SEP]` token, but token
10
+ type ids are all 0-s.
11
+
12
+ An example usage:
13
+
14
+ ```python
15
+ from transformers import AutoTokenizer, DPRQuestionEncoder
16
+
17
+ tokenizer = AutoTokenizer.from_pretrained("NAACL2022/spider-trivia-ctx-encoder")
18
+ model = DPRQuestionEncoder.from_pretrained("NAACL2022/spider-trivia-ctx-encoder")
19
+
20
+ question = "Who is the villain in lord of the rings"
21
+ input_dict = tokenizer(question, return_tensors="pt")
22
+ del input_dict["token_type_ids"]
23
+
24
+ outputs = model(**input_dict)
25
+ ```