Update README.md
Browse files
README.md
CHANGED
@@ -15,6 +15,29 @@ The input format for the model is: "premise: GROUNDING_DOCUMENT hypothesis: HYPO
|
|
15 |
|
16 |
The model predicts a binary label ('1' - Factualy Consistent, '0' - Factualy Inconsistent).
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
If you use this model for a research publication, please cite the TrueTeacher paper (using the bibtex entry below) and the dataset papers mentioned above.
|
19 |
|
20 |
```
|
|
|
15 |
|
16 |
The model predicts a binary label ('1' - Factualy Consistent, '0' - Factualy Inconsistent).
|
17 |
|
18 |
+
|
19 |
+
## Usage example:
|
20 |
+
```python
|
21 |
+
from transformers import T5ForConditionalGeneration
|
22 |
+
from transformers import T5Tokenizer
|
23 |
+
|
24 |
+
model_path = 'google/t5_11b_trueteacher_and_anli'
|
25 |
+
tokenizer = T5Tokenizer.from_pretrained(model_path)
|
26 |
+
model = T5ForConditionalGeneration.from_pretrained(model_path)
|
27 |
+
|
28 |
+
premise = 'the sun is shining'
|
29 |
+
for hypothesis, expected in [('the sun is out in the sky', '1'),
|
30 |
+
('the cat is shiny', '0')]:
|
31 |
+
input_ids = tokenizer(f'premise: {premise} hypothesis: {hypothesis}', return_tensors='pt').input_ids
|
32 |
+
outputs = model.generate(input_ids)
|
33 |
+
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
34 |
+
print(f'premise: {premise}')
|
35 |
+
print(f'hypothesis: {hypothesis}')
|
36 |
+
print(f'result: {result} (expected: {expected})\n')
|
37 |
+
```
|
38 |
+
|
39 |
+
## Citation
|
40 |
+
|
41 |
If you use this model for a research publication, please cite the TrueTeacher paper (using the bibtex entry below) and the dataset papers mentioned above.
|
42 |
|
43 |
```
|