israelcamp
commited on
Commit
•
6e776ba
1
Parent(s):
288674b
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,34 @@
|
|
1 |
---
|
|
|
|
|
|
|
|
|
2 |
license: mit
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
inference: false
|
3 |
+
language: pt
|
4 |
+
datasets:
|
5 |
+
- assin2
|
6 |
license: mit
|
7 |
---
|
8 |
+
|
9 |
+
|
10 |
+
# DeBERTinha XSmall for Semantic Textual Similarity
|
11 |
+
|
12 |
+
## Full regression example
|
13 |
+
|
14 |
+
```python
|
15 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer, AutoConfig
|
16 |
+
import numpy as np
|
17 |
+
import torch
|
18 |
+
|
19 |
+
model_name = "sagui-nlp/debertinha-ptbr-xsmall-assin2-sts"
|
20 |
+
s1 = "A gente faz o aporte financeiro, é como se a empresa fosse parceira do Monte Cristo."
|
21 |
+
s2 = "Fernando Moraes afirma que não tem vínculo com o Monte Cristo além da parceira."
|
22 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
23 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
24 |
+
config = AutoConfig.from_pretrained(model_name)
|
25 |
+
model_input = tokenizer(*([s1], [s2]), padding=True, return_tensors="pt")
|
26 |
+
with torch.no_grad():
|
27 |
+
output = model(**model_input)
|
28 |
+
score = output[0][0].detach().numpy().item()
|
29 |
+
print(f"Similarity Score: {np.round(float(score), 4)}")
|
30 |
+
```
|
31 |
+
|
32 |
+
## Citation
|
33 |
+
|
34 |
+
Comming soon
|