--- license: mit datasets: - yassiracharki/Amazon_Reviews_for_Sentiment_Analysis_fine_grained_5_classes language: - en metrics: - accuracy tags: - text-classification - sentiment-classification - BERT - Roberta - mini-roberta --- # RoBERTa-mini: Sentiment Classifier **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. ## Example Usage ```python 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) ``` ## Model Card - **Architecture**: RoBERTa (custom small version) - **Training Dataset**: [Amazon Reviews Dataset](https://huggingface.co/datasets/yassiracharki/Amazon_Reviews_for_Sentiment_Analysis_fine_grained_5_classes/viewer) - **Use Case**: Sentiment classification for customer feedback, reviews, etc. - **Input Format**: Plain text (string) - **Output**: Dictionary with class ID, label, and class probabilities ## License This model is licensed under the MIT License. You are free to use, modify, and distribute it with attribution. ## Author Developed and Trained by [Dilip Pokhrel](https://huggingface.co/dilip025)