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


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
Safetensors
Model size
125M params
Tensor type
F32
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Model tree for syedkhalid076/RoBERTa-Sentimental-Analysis-v2

Finetuned
(1374)
this model

Dataset used to train syedkhalid076/RoBERTa-Sentimental-Analysis-v2

Space using syedkhalid076/RoBERTa-Sentimental-Analysis-v2 1