Model Name: dilip025/RoBERTa-mini
Task: Sentiment Classification
Labels: Very Negative, Negative, Neutral, Positive, Very Positive
A compact RoBERTa like model trained from scratch for sentiment classification.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
tokenizer = AutoTokenizer.from_pretrained("dilip025/RoBERTa-mini")
model = AutoModelForSequenceClassification.from_pretrained("dilip025/RoBERTa-mini", trust_remote_code=True)
id2label = {
0: "Very Negative",
1: "Negative",
2: "Neutral",
3: "Positive",
4: "Very Positive"
}
def predict_sentiment(text):
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=128)
with torch.no_grad():
outputs = model(**inputs)
probs = torch.softmax(outputs["logits"], dim=1)
pred_class = torch.argmax(probs, dim=1).item()
return {
"text": text,
"class_id": pred_class,
"label": id2label[pred_class],
"probabilities": probs.tolist()[0]
}
# Example
result = predict_sentiment("I absolutely hate this product.")
print(result)
This model is licensed under the MIT License. You are free to use, modify, and distribute it with attribution.
Developed and Trained by Dilip Pokhrel
step_final_1003.pt 2.2 GiBstep_final_1007.pt 2.2 GiBstep_final_2236.pt 2.2 GiBstep_final_2325.pt 2.2 GiBstep_final_2446.pt 2.2 GiBstep_final_223.pt 2.2 GiBstep_final_44.pt 2.2 GiBstep_final_45.pt 2.2 GiBstep_final_58.pt 2.2 GiBstep_final_71.pt 2.2 GiBstep_final_90.pt 2.2 GiBstep_final_91.pt 2.2 GiBstep_1200.pt 2.2 GiBstep_1800.pt 2.2 GiBstep_2400.pt 2.2 GiBstep_100.pt 2.2 GiBstep_201.pt 2.2 GiBstep_600.pt 2.2 GiBstep_15.pt 2.2 GiBstep_30.pt 2.2 GiBstep_45.pt 2.2 GiBstep_60.pt 2.2 GiBstep_90.pt 2.2 GiBstep_finale_30.pt 2.2 GiBtokenized_train_datasetii.pt 830 MiBtokenized_train_dataset.pt 802 MiBtokenized_train_dataseti.pt 798 MiBtokenized_train_datasets.pt 793 MiBpytorch_model.bin 132 MiBmodel.safetensors 132 MiB