chennab28/movie-review-sentiment
Viewer โข Updated โข 210 โข 38
How to use chennab28/movie-review-sentiment-classifier with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="chennab28/movie-review-sentiment-classifier") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("chennab28/movie-review-sentiment-classifier")
model = AutoModelForSequenceClassification.from_pretrained("chennab28/movie-review-sentiment-classifier", device_map="auto")A tiny BERT model (google/bert_uncased_L-4_H-256_A-4, ~10M params)
fine-tuned for 3-way movie review sentiment classification:
positive / negative / neutral
Trained on the companion dataset
chennab28/movie-review-sentiment
in a couple of minutes on CPU.
from transformers import pipeline
pipe = pipeline("text-classification", model="chennab28/movie-review-sentiment-classifier")
print(pipe("A breathtaking masterpiece with stunning cinematography."))
# [{'label': 'positive', 'score': 0.99}]
| Task | Acc (test) |
|---|---|
| Sentiment (3 classes) | 97.6% |
This is deliberately a minimal end-to-end example of the Hugging Face workflow โ Dataset โ Model โ Space. Despite having only ~10M parameters, the model reaches 97.6% accuracy on the held-out test split.
| Config | Value |
|---|---|
| base model | google/bert_uncased_L-4_H-256_A-4 |
| epochs | 30 |
| batch size | 16 |
| lr | 5e-5 |
| max seq len | 128 |
| data | 168 train / 42 test rows |
Reproduce with train/train.py --epochs 30 in this repo.
๐ Gradio demo Space
Base model
google/bert_uncased_L-4_H-256_A-4