Downloads · 30 days
20
1% of all-time downloads
AdamCodd/distilroberta-NLI
distilroberta-NLI is a text classification model from AdamCodd. Use it when you need a label for a piece of text. It is set up for transformers.
This model utilizes the Distilroberta base architecture, which has been fine-tuned for NLI tasks on the MultiNLI and SNLI datasets. It achieves the following results on the evaluation set: Loss: 0.4384
Downloads · 30 days
20
1% of all-time downloads
All-time downloads
1.5K
Public
Parameters
82.1M
657 MB on disk
Likes
1
Public
Click a slice to open those files.
.onnx329 MB · 50%
From the Hugging Face model README
This model utilizes the Distilroberta base architecture, which has been fine-tuned for NLI tasks on the MultiNLI and SNLI datasets. It achieves the following results on the evaluation set:
The SNLI corpus (version 1.0) is a collection of 570k human-written English sentence pairs manually labeled for balanced classification with the labels entailment, contradiction, and neutral, supporting the task of natural language inference (NLI), also known as recognizing textual entailment (RTE).
The Multi-Genre Natural Language Inference (MultiNLI) corpus is a crowd-sourced collection of 433k sentence pairs annotated with textual entailment information. The corpus is modeled on the SNLI corpus, but differs in that covers a range of genres of spoken and written text, and supports a distinctive cross-genre generalization evaluation.
Inference API has been disabled as it is not suitable for this kind of task.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model and tokenizer
model_checkpoint = 'AdamCodd/distilroberta-NLI'
model = AutoModelForSequenceClassification.from_pretrained(model_checkpoint)
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
# Set device
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
# Sample premise and hypothesis
premise = "The cat is sleeping under the sun."
hypothesis = "It's raining, and the cat is getting wet."
# Tokenize and predict
input = tokenizer(premise, hypothesis, truncation=True, padding=True, return_tensors="pt").to(device)
with torch.no_grad():
output = model(**input)
probabilities = torch.softmax(output.logits, dim=-1)[0].tolist()
# Output prediction
label_names = ["Entailment", "Neutral", "Contradiction"]
prediction = {name: round(prob * 100, 1) for name, prob in zip(label_names, probabilities)}
print(prediction)
# {'Entailment': 1.3, 'Neutral': 8.2, 'Contradiction': 90.5}
More information needed
The following hyperparameters were used during training:
Metrics: Accuracy, F1, Precision, Recall
'eval_loss': 0.438475,
'eval_accuracy': 0.829536,
'eval_f1': 0.828703,
'eval_precision': 0.828907,
'eval_recall': 0.828617
If you want to support me, you can here.