israelcamp
commited on
Commit
•
d6a2b22
1
Parent(s):
35560c3
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,45 @@
|
|
1 |
---
|
|
|
|
|
|
|
|
|
2 |
license: mit
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
inference: false
|
3 |
+
language: pt
|
4 |
+
datasets:
|
5 |
+
- assin2
|
6 |
license: mit
|
7 |
---
|
8 |
+
|
9 |
+
# DeBERTinha XSmall for Recognizing Textual Entailment
|
10 |
+
|
11 |
+
### **Labels**:
|
12 |
+
* 0 : There is no entailment between premise and hypothesis.
|
13 |
+
* 1 : There is entailment between premise and hypothesis.
|
14 |
+
|
15 |
+
|
16 |
+
## Full classification example
|
17 |
+
|
18 |
+
```python
|
19 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer, AutoConfig
|
20 |
+
import numpy as np
|
21 |
+
import torch
|
22 |
+
from scipy.special import softmax
|
23 |
+
|
24 |
+
model_name = "sagui-nlp/debertinha-ptbr-xsmall-assin2-rte"
|
25 |
+
s1 = "Os homens estão cuidadosamente colocando as malas no porta-malas de um carro."
|
26 |
+
s2 = "Os homens estão colocando bagagens dentro do porta-malas de um carro."
|
27 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
28 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
29 |
+
config = AutoConfig.from_pretrained(model_name)
|
30 |
+
model_input = tokenizer(*([s1], [s2]), padding=True, return_tensors="pt")
|
31 |
+
with torch.no_grad():
|
32 |
+
output = model(**model_input)
|
33 |
+
scores = output[0][0].detach().numpy()
|
34 |
+
scores = softmax(scores)
|
35 |
+
ranking = np.argsort(scores)
|
36 |
+
ranking = ranking[::-1]
|
37 |
+
for i in range(scores.shape[0]):
|
38 |
+
l = config.id2label[ranking[i]]
|
39 |
+
s = scores[ranking[i]]
|
40 |
+
print(f"{i+1}) Label: {l} Score: {np.round(float(s), 4)}")
|
41 |
+
```
|
42 |
+
|
43 |
+
## Citation
|
44 |
+
|
45 |
+
Comming soon
|