Movie Review Sentiment (DistilBERT)
DistilBERT fine-tuned on Rotten Tomatoes movie reviews to classify text as POSITIVE or NEGATIVE.
Model details
- Base model: distilbert/distilbert-base-uncased
- Task: binary sentiment classification
- Language: English
Training data
cornell-movie-review-data/rotten_tomatoes: 10,662 reviews (8,530 train / 1,066 validation / 1,066 test), balanced classes.
Training
- Epochs: 3
- Learning rate: 2e-5
- Batch size: 16
- Max sequence length: 128
- Hardware: Google Colab T4 GPU
Results
| Epoch | Training loss | Validation loss | Validation accuracy |
|---|---|---|---|
| 1 | 0.423 | 0.387 | 83.1% |
| 2 | 0.255 | 0.376 | 85.5% |
| 3 | 0.160 | 0.495 | 85.4% |
Test accuracy: 83.6%
How to use
from transformers import pipeline
clf = pipeline("text-classification", model="aqsaahsan/sentiment-distilbert")
print(clf("This movie was fantastic!"))
Limitations
- The model only has two classes, so neutral text is forced into positive or negative.
- It was trained on short movie reviews, so it may be less accurate on other topics.
- It may carry biases inherited from DistilBERT's pretraining data.