Spaces:
Build error
Build error
File size: 3,967 Bytes
ad3c17a 0d2513c 3f8c028 ad3c17a 3f8c028 ad3c17a 0fd6a6b bfb039a 0fd6a6b fe0277b 0fd6a6b bfb039a 0fd6a6b d7807ad 0fd6a6b bfb039a 0fd6a6b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
---
title: ViBERTa
emoji: π¬
colorFrom: red
colorTo: gray
sdk: streamlit
app_file: app.py
pinned: false
sdk_version: 1.44.1
---
# ViBERTa: Unwrapping Customer Sentiments with Sentiment Analysis! π
## π Overview
ViBERTa (VIBE + DeBERTa) is a sentiment analysis model fine-tuned on the McDonald's review dataset. Leveraging the power of Microsoft's DeBERTa, this model provides precise sentiment classification for customer reviews.
## π Model Specifications
### Key Details
- **Model Name:** ViBERTa
- **Base Model:** `microsoft/deberta-v3-base`
- **Primary Task:** Sentiment Classification
- **Sentiment Classes:**
- 0: Negative
- 1: Neutral
- 2: Positive
### π¬ Technical Highlights
- Advanced transformer-based architecture
- Fine-tuned on domain-specific McDonald's review data
- High accuracy in sentiment prediction
## π Dataset Insights
### McDonald's Review Dataset
- Source: Kaggle
- Comprehensive collection of customer reviews
- Manually labeled sentiment categories
- Diverse range of customer experiences
## π Training Methodology
### Configuration Parameters
| Parameter | Value |
|-----------|-------|
| Batch Size | 16 |
| Total Epochs | 3 |
| Learning Rate | 2e-5 |
| Optimizer | AdamW |
| Learning Rate Scheduler | Cosine decay with warmup |
| Warmup Ratio | 10% |
| Weight Decay | 0.01 |
| Mixed Precision | Enabled (fp16) |
| Gradient Accumulation Steps | 2 |
### Training Approach
- Tokenization using DeBERTa tokenizer
- Cross-entropy loss function
- Adaptive learning rate scheduling
- Gradient accumulation for stable training
## π Quick Start Guide
### Installation
Install the required dependencies:
```bash
# Create a virtual environment (recommended)
python -m venv viberta_env
source viberta_env/bin/activate # On Windows, use `viberta_env\Scripts\activate`
# Install dependencies
pip install torch transformers datasets
```
### Model Inference
```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model and tokenizer
model_name = "iSathyam03/McD_Reviews_Sentiment_Analysis"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
def predict_sentiment(text):
"""Predict sentiment for given text."""
inputs = tokenizer(
text,
return_tensors="pt",
truncation=True,
padding=True
)
with torch.no_grad():
outputs = model(**inputs)
logits = outputs.logits
prediction = torch.argmax(logits, dim=1).item()
sentiment_labels = {
0: "Negative",
1: "Neutral",
2: "Positive"
}
return sentiment_labels[prediction]
# Example usage
review = "The fries were amazing but the burger was stale."
sentiment = predict_sentiment(review)
print(f"Sentiment: {sentiment}")
```
## π Performance Metrics
### Evaluation Results
- **Accuracy:** 0.856
- **F1-Score:** 0.853
### Confusion Matrix
[Include a visual or textual representation of the confusion matrix]
## π Deployment Options
1. **Hugging Face Inference API**
- Easy integration
- Scalable cloud deployment
2. **Web Application Frameworks**
- Streamlit for interactive demos
- Gradio for quick UI prototypes
- Flask/FastAPI for robust REST APIs
## π Limitations & Considerations
- Performance may vary with out-of-domain text
- Potential bias inherited from training data
- Recommended to validate on your specific use case
## π References & Citations
### Primary Citation
```bibtex
@article{he2020deberta,
title={DeBERTa: Decoding-enhanced BERT with Disentangled Attention},
author={He, Pengcheng and Liu, Xiaodong and Gao, Jianfeng and Chen, Weizhu},
journal={arXiv preprint arXiv:2006.03654},
year={2020}
}
```
**π‘ Pro Tip:** Always validate model performance on your specific dataset!
β **Found ViBERTa helpful? Don't forget to star the repository!** π |