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