Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Spider
|
2 |
+
|
3 |
+
This is the unsupervised pretrained model 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, DPRContextEncoder
|
16 |
+
|
17 |
+
tokenizer = AutoTokenizer.from_pretrained("tau/spider")
|
18 |
+
model = DPRContextEncoder.from_pretrained("tau/spider")
|
19 |
+
|
20 |
+
input_dict = tokenizer("title", "text", return_tensors="pt")
|
21 |
+
del input_dict["token_type_ids"]
|
22 |
+
|
23 |
+
outputs = model(**input_dict)
|
24 |
+
```
|