Updated README.md (Professional Model Card)
Browse files
README.md
CHANGED
|
@@ -1,40 +1,43 @@
|
|
| 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 |
-
Misclassified examples are available in `misclassified_examples.csv`.
|
| 32 |
-
|
| 33 |
-
## How to Use
|
| 34 |
```python
|
| 35 |
-
from transformers import
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
|
|
|
| 39 |
|
| 40 |
-
print(
|
|
|
|
| 1 |
+
# DistilBERT IMDB Sentiment Classifier
|
| 2 |
+
|
| 3 |
+
## Overview
|
| 4 |
+
This repository contains a fine-tuned DistilBERT model for binary sentiment classification on the IMDB movie reviews dataset. The model predicts whether a given review expresses positive or negative sentiment. It is intended as a lightweight, reproducible NLP model suitable for demonstrations, small-scale applications, and experimentation.
|
| 5 |
+
|
| 6 |
+
## Base Model
|
| 7 |
+
- Model: distilbert-base-uncased
|
| 8 |
+
- Framework: Hugging Face Transformers
|
| 9 |
+
- Task: Text Classification (Binary Sentiment)
|
| 10 |
+
|
| 11 |
+
## Training Details
|
| 12 |
+
- Dataset: IMDB movie review dataset (train/test split)
|
| 13 |
+
- Objective: Binary sentiment classification
|
| 14 |
+
- Optimization:
|
| 15 |
+
- Adam optimizer
|
| 16 |
+
- Learning rate scheduling
|
| 17 |
+
- Early stopping
|
| 18 |
+
- Regularization:
|
| 19 |
+
- Dropout applied as per DistilBERT architecture
|
| 20 |
+
- Gradient clipping
|
| 21 |
+
|
| 22 |
+
## Evaluation Metrics
|
| 23 |
+
The model was evaluated using standard binary classification metrics:
|
| 24 |
+
- Accuracy
|
| 25 |
+
- Precision
|
| 26 |
+
- Recall
|
| 27 |
+
- F1-score
|
| 28 |
+
|
| 29 |
+
## Inference Example
|
| 30 |
+
|
|
|
|
|
|
|
|
|
|
| 31 |
```python
|
| 32 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 33 |
+
import torch
|
| 34 |
+
|
| 35 |
+
model_name = "SuganyaP/quick-distilbert-imdb"
|
| 36 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 37 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 38 |
|
| 39 |
+
inputs = tokenizer("This movie was excellent!", return_tensors="pt")
|
| 40 |
+
outputs = model(**inputs)
|
| 41 |
+
prediction = torch.argmax(outputs.logits).item()
|
| 42 |
|
| 43 |
+
print("Positive" if prediction == 1 else "Negative")
|