RoBERTa Sentiment Analysis Model v2
This repository hosts a fine-tuned RoBERTa model for sentiment analysis. The model classifies text into three categories: Negative (0), Neutral (1), and Positive (2). It has been fine-tuned on the syedkhalid076/Sentiment-Analysis-Over-sampled dataset and achieves high accuracy. The Model is Trained specifically for Feedback Sentiment Analysis for UX Research, but it does perform well on other Sentiment Analysis tasks.
Model Details
- Base Model: RoBERTa-base
- Number of Labels: 3 (0:Negative, 1:Neutral, 2:Positive)
- Model Size: 125M parameters
- Language: English (
en
) - Metrics: Accuracy: 90.20%
- Tensor Type: FP32
- Dataset: syedkhalid076/Sentiment-Analysis-Over-sampled
- Library: Transformers
- File Format: Safetensors
Features
- Text Classification: Identify the sentiment of input text as Negative, Neutral, or Positive.
- High Accuracy: Achieves 90.20% accuracy on the evaluation dataset.
- Hosted on Hugging Face: Ready-to-use inference endpoints for quick deployment.
- Efficient Inference: Lightweight and efficient, supporting FP32 tensors.
Installation
To use this model, ensure you have the transformers
library installed:
pip install transformers
Usage
Here’s how you can load the model and tokenizer and perform inference:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained("syedkhalid076/RoBERTa-Sentimental-Analysis-Model")
model = AutoModelForSequenceClassification.from_pretrained("syedkhalid076/RoBERTa-Sentimental-Analysis-Model")
# Define input text
text = "I absolutely love this product! It's fantastic."
# Tokenize input
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
# Perform inference
outputs = model(**inputs)
logits = outputs.logits
predicted_class = torch.argmax(logits, dim=-1).item()
# Print results
sentiment_labels = {0: "Negative", 1: "Neutral", 2: "Positive"}
print(f"Predicted sentiment: {sentiment_labels[predicted_class]}")
Dataset
This model is fine-tuned on the syedkhalid076/Sentiment-Analysis-Over-sampled dataset. The dataset has been carefully preprocessed and oversampled to ensure balanced label representation and improve model performance.
Performance
The model was evaluated on a test set and achieved the following metrics:
- Accuracy: 90.20% (0.9019906657776932)
The evaluation strategy includes validation after each epoch and logging metrics for tracking training progress.
Inference Endpoints
You can use the Hugging Face Inference API to deploy and test this model in production environments.
Author
Syed Khalid Hussain
UX Designer & Developer
Specializing in crafting user-centric digital experiences.
- Downloads last month
- 43
Model tree for syedkhalid076/RoBERTa-Sentimental-Analysis-v2
Base model
FacebookAI/roberta-base