Update README.md
Browse files
README.md
CHANGED
|
@@ -12,13 +12,15 @@ type ids are all 0-s.
|
|
| 12 |
An example usage:
|
| 13 |
|
| 14 |
```python
|
| 15 |
-
from transformers import AutoTokenizer,
|
| 16 |
|
| 17 |
tokenizer = AutoTokenizer.from_pretrained("NAACL2022/spider-trivia-ctx-encoder")
|
| 18 |
-
model =
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
| 22 |
del input_dict["token_type_ids"]
|
| 23 |
|
| 24 |
outputs = model(**input_dict)
|
|
|
|
| 12 |
An example usage:
|
| 13 |
|
| 14 |
```python
|
| 15 |
+
from transformers import AutoTokenizer, DPRContextEncoder
|
| 16 |
|
| 17 |
tokenizer = AutoTokenizer.from_pretrained("NAACL2022/spider-trivia-ctx-encoder")
|
| 18 |
+
model = DPRContextEncoder.from_pretrained("NAACL2022/spider-trivia-ctx-encoder")
|
| 19 |
|
| 20 |
+
title = "Sauron"
|
| 21 |
+
context = "Sauron is the title character and main antagonist of J. R. R. Tolkien's \"The Lord of the Rings\"."
|
| 22 |
+
|
| 23 |
+
input_dict = tokenizer(title, context, return_tensors="pt")
|
| 24 |
del input_dict["token_type_ids"]
|
| 25 |
|
| 26 |
outputs = model(**input_dict)
|