Downloads · 30 days
14
6% of all-time downloads
Anudeep-Narala/fabsa-roberta-sentiment
fabsa-roberta-sentiment is a text classification model from Anudeep-Narala. Use it when you need a label for a piece of text. The card lists the license as mit.
<div align="center" <img src="https://img.shields.io/badge/Accuracy-93.97%25-brightgreen" alt="Accuracy" <img src="https://img.shields.io/badge/Model-RoBERTa-blue" alt="Model" <img src="https://img.shields.io/badge/Ta…
Downloads · 30 days
14
6% of all-time downloads
All-time downloads
224
Public
Parameters
125M
499 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors499 MB · 99%
From the Hugging Face model README
This is a fine-tuned RoBERTa model for Aspect-Based Sentiment Analysis (ABSA) on food delivery reviews, achieving 93.97% accuracy on the validation set. The model analyzes customer reviews across multiple specific aspects like food quality, delivery service, pricing, and more.
Unlike traditional sentiment analysis that gives one overall sentiment, ABSA identifies sentiment for specific aspects of a product or service. For example:
"The food was amazing but delivery took forever"
This granular analysis helps businesses identify exactly what customers love and what needs improvement.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model and tokenizer
model_name = "Anudeep-Narala/fabsa-roberta-sentiment"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Example: Analyze a review
review = "The food was delicious but the delivery was slow"
aspect = "delivery" # Can be: food, delivery, service, price, interface, overall
# Format input
input_text = f"Review: {review} | Aspect: {aspect}"
inputs = tokenizer(input_text, return_tensors="pt", truncation=True, max_length=256)
# Get prediction
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
predicted_class = torch.argmax(predictions, dim=-1).item()
confidence = predictions[0][predicted_class].item()
# Map prediction to sentiment
sentiment_map = {0: "negative", 1: "neutral", 2: "positive"}
print(f"Aspect: {aspect}")
print(f"Sentiment: {sentiment_map[predicted_class]}")
print(f"Confidence: {confidence:.2%}")
def analyze_review(review_text, aspects=["food", "delivery", "service", "price"]):
"""Analyze a review across multiple aspects"""
results = {}
for aspect in aspects:
input_text = f"Review: {review_text} | Aspect: {aspect}"
inputs = tokenizer(input_text, return_tensors="pt", truncation=True, max_length=256)
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
predicted_class = torch.argmax(predictions, dim=-1).item()
confidence = predictions[0][predicted_class].item()
sentiment_map = {0: "negative", 1: "neutral", 2: "positive"}
results[aspect] = {
"sentiment": sentiment_map[predicted_class],
"confidence": confidence
}
return results
# Example usage
review = "Great food and reasonable prices, but the app keeps crashing"
results = analyze_review(review)
for aspect, result in results.items():
print(f"{aspect.capitalize()}: {result['sentiment']} (confidence: {result['confidence']:.2%})")
| Metric | Value |
|---|---|
| Validation Accuracy | 93.97% |
| Training Loss | 0.1611 |
| Validation Loss | 0.1749 |
| Training Time | 302.74 seconds |
| Training Examples | 13,998 |
| Validation Examples | 1,858 |
The model is trained to analyze sentiment for these specific aspects:
review = "Amazing pizza and great prices! The delivery was fast but the driver was rude."
Analysis Output:
This granular insight shows that while the product and pricing are excellent, there are service issues that need addressing.
pip install transformers torch
For production environments with GPU acceleration:
pip install transformers torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
# Enable GPU if available
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
This model represents the final iteration of extensive experimentation:
If you use this model in your research or application, please cite:
@misc{narala2025fabsa,
author = {Anudeep Reddy Narala},
title = {FABSA RoBERTa: Fine-tuned Model for Aspect-Based Sentiment Analysis on Food Delivery Reviews},
year = {2025},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/Anudeep-Narala/fabsa-roberta-sentiment}},
}
This model is released under the MIT License. Feel free to use it for commercial and non-commercial applications.
Ready to analyze your customer feedback? Try the model now! 🚀