Downloads · 30 days
20
1% of all-time downloads
nam7197/vi-nli-xlm-roberta-base
vi-nli-xlm-roberta-base is a text classification model from nam7197. Use it when you need a label for a piece of text. It is set up for transformers.
Downloads · 30 days
20
1% of all-time downloads
All-time downloads
1.4K
Public
Repo size
2.2 GB
Likes
0
Public
Click a slice to open those files.
.bin1.1 GB · 100%
From the Hugging Face model README
>>> import torch
>>> from transformers import AutoTokenizer,AutoModelForSequenceClassification
>>> tokenizer = AutoTokenizer.from_pretrained('xlm-roberta-base')
>>> model=AutoModelForSequenceClassification.from_pretrained('nam7197/vi-nli-xml-roberta-base')
>>> premise="Vâng, tôi thậm chí không nghĩ về điều đó, nhưng tôi đã rất thất vọng, và, tôi lại nói chuyện với anh ta lần nữa."
>>> hypothesis="Tôi đã không nói chuyện với anh ta nữa."
>>> label=2 #contradiction
>>> inputs=tokenizer(premise,hypothesis,return_tensors='pt')
>>> model.eval()
>>> with torch.no_grad():
>>> outputs=model(**inputs)
>>> probs= torch.nn.functional.softmax(outputs.logits,dim=-1)
>>> pred_label=torch.argmax(probs,dim=-1)
| precision | recall | f1-score | support | |
|---|---|---|---|---|
| entailment | 0.79256 | 0.77784 | 0.78513 | 1670 |
| neutral | 0.77192 | 0.70120 | 0.73486 | 1670 |
| contradiction | 0.76429 | 0.84850 | 0.80420 | 1670 |
| accuracy | 0.77585 | 5010 | ||
| macro avg | 0.77626 | 0.77585 | 0.77473 | 5010 |
| weighted avg | 0.77626 | 0.77585 | 0.77473 | 5010 |