Text Classification
Transformers
Safetensors
PyTorch
bert
sentiment-analysis
Eval Results (legacy)
text-embeddings-inference
Instructions to use ashwini10521/finetuned_bert with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ashwini10521/finetuned_bert with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="ashwini10521/finetuned_bert")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("ashwini10521/finetuned_bert") model = AutoModelForSequenceClassification.from_pretrained("ashwini10521/finetuned_bert") - Notebooks
- Google Colab
- Kaggle
File size: 2,873 Bytes
b329ac1 8abce6d b329ac1 8abce6d b329ac1 8abce6d b329ac1 8abce6d b329ac1 8abce6d b329ac1 8abce6d b329ac1 8abce6d b329ac1 8abce6d b329ac1 8abce6d b329ac1 8abce6d b329ac1 8abce6d b329ac1 8abce6d b329ac1 8abce6d b329ac1 8abce6d b329ac1 8abce6d b329ac1 8abce6d b329ac1 8abce6d b329ac1 8abce6d b329ac1 8abce6d | 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 | ---
library_name: transformers
license: apache-2.0
base_model: bert-base-uncased
tags:
- sentiment-analysis
- text-classification
- bert
- transformers
- pytorch
metrics:
- accuracy
- f1
- precision
- recall
model-index:
- name: finetuned-bert-sentiment
results:
- task:
type: text-classification
name: Sentiment Analysis
dataset:
name: IMDb Movie Reviews
type: imdb
metrics:
- type: accuracy
value: 0.9225
- type: f1
value: 0.9238
- type: precision
value: 0.9086
- type: recall
value: 0.9395
---
# π¬ Finetuned BERT for Sentiment Analysis
This model is a fine-tuned version of **BERT (bert-base-uncased)** for binary sentiment classification (positive vs negative).
It is trained on the **IMDb movie reviews dataset**, a widely used benchmark for sentiment analysis tasks.
---
## π Model Performance
| Metric | Score |
|------------|--------|
| Accuracy | 92.25% |
| F1 Score | 92.38% |
| Precision | 90.86% |
| Recall | 93.95% |
### Confusion Matrix Insights
- Strong balance between positive and negative predictions
- Slight tendency toward higher recall (fewer false negatives)
- Overall robust generalization on full test dataset (25,000 samples)
---
## π Model Description
This project demonstrates fine-tuning of a pre-trained Transformer model for NLP classification tasks using the Hugging Face ecosystem.
Key features:
- Pretrained **BERT encoder**
- Fine-tuned for **binary sentiment classification**
- Implemented using **Hugging Face Transformers Trainer API**
- Evaluated using standard classification metrics
---
## π Dataset
- **Name:** IMDb Movie Reviews Dataset
- **Size:**
- Train: 25,000 samples
- Test: 25,000 samples
- **Classes:**
- `0` β Negative
- `1` β Positive
The dataset is balanced across both classes.
---
## ποΈ Training Procedure
### Hyperparameters
- Learning rate: `2e-5`
- Batch size: `8`
- Epochs: `2`
- Optimizer: AdamW
- Scheduler: Linear decay
- Mixed precision: Enabled (FP16)
### Training Details
- Framework: Hugging Face `Trainer`
- Hardware: Google Colab GPU
- Loss function: Cross-entropy
---
## π§ Intended Use
This model can be used for:
- Sentiment analysis on movie reviews
- Product review classification
- Social media sentiment detection
- NLP learning and experimentation
---
## β οΈ Limitations
- Trained only on English text
- Domain-specific (movie reviews) β may not generalize perfectly to other domains
- Binary classification only (no neutral sentiment)
- May inherit biases present in training data
---
## π οΈ How to Use
```python
from transformers import pipeline
classifier = pipeline("sentiment-analysis", model="ashwini10521/finetuned_bert")
result = classifier("This movie was absolutely amazing!")
print(result) |