amandakonet
commited on
Commit
•
3d7af40
1
Parent(s):
c739f46
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,25 @@
|
|
1 |
-
---
|
2 |
-
license: mit
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
datasets: climateBert
|
6 |
+
---
|
7 |
+
|
8 |
+
This model fine-tuned ClimateBert on the textual entailment task. Given (claim, evidence) pairs, the model predicts support (entailment), refute (contradict), or not enough info (neutral).
|
9 |
+
|
10 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
11 |
+
import torch
|
12 |
+
|
13 |
+
model = AutoModelForSequenceClassification.from_pretrained('lighteternal/nli-xlm-r-greek')
|
14 |
+
tokenizer = AutoTokenizer.from_pretrained('lighteternal/nli-xlm-r-greek')
|
15 |
+
|
16 |
+
features = tokenizer(['Δύο άνθρωποι συναντιούνται στο δρόμο', 'Ο δρόμος έχει κόσμο'],
|
17 |
+
['Ένα μαύρο αυτοκίνητο ξεκινάει στη μέση του πλήθους.', 'Ένας άντρας οδηγάει σε ένα μοναχικό δρόμο.'],
|
18 |
+
padding=True, truncation=True, return_tensors="pt")
|
19 |
+
|
20 |
+
model.eval()
|
21 |
+
with torch.no_grad():
|
22 |
+
scores = model(**features).logits
|
23 |
+
label_mapping = ['contradiction', 'entailment', 'neutral']
|
24 |
+
labels = [label_mapping[score_max] for score_max in scores.argmax(dim=1)]
|
25 |
+
print(labels)`
|