Instructions to use YueranCao2001/distilbert-imdb-sentiment-v3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use YueranCao2001/distilbert-imdb-sentiment-v3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="YueranCao2001/distilbert-imdb-sentiment-v3")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("YueranCao2001/distilbert-imdb-sentiment-v3") model = AutoModelForSequenceClassification.from_pretrained("YueranCao2001/distilbert-imdb-sentiment-v3", device_map="auto") - Notebooks
- Google Colab
- Kaggle
DistilBERT IMDb Sentiment Classifier (V3)
Model Description
This model is a fine-tuned version of distilbert/distilbert-base-uncased for binary sentiment classification of English movie reviews.
It was developed as an independent Hugging Face learning project, covering dataset preparation, tokenization, fine-tuning, checkpoint selection, evaluation, and model publishing.
The model predicts two sentiment labels:
NEGATIVE(0)POSITIVE(1)
Training Dataset
Dataset: IMDb Movie Reviews
The training and validation samples were drawn from the official IMDb training split.
| Split | Samples |
|---|---|
| Training | 5,000 |
| Validation | 1,000 |
| Independent test subset | 200 |
The training and validation datasets were balanced across positive and negative classes.
The test subset was sampled from the official IMDb test split, with 100 examples per class.
Training Configuration
| Parameter | Value |
|---|---|
| Base model | DistilBERT Base Uncased |
| Epochs | 3 |
| Training batch size | 16 |
| Evaluation batch size | 16 |
| Learning rate | 2e-5 |
| Weight decay | 0.01 |
| Maximum sequence length | 128 |
| Learning rate scheduler | Linear |
| Warmup steps | 94 |
| Random seed | 42 |
| Model selection metric | Validation Macro F1 |
| Best checkpoint | Step 939 |
| Training device | CPU |
The model was trained using Hugging Face Transformers and PyTorch.
Evaluation Results
Validation Results
| Metric | Value |
|---|---|
| Accuracy | 0.8500 |
| Macro F1 | 0.84998 |
| Loss | 0.42117 |
IMDb Test Subset (200 Samples)
| Metric | Value |
|---|---|
| Accuracy | 0.86 |
| Macro F1 | 0.86 |
| Negative Recall | 0.84 |
| Positive Recall | 0.88 |
Confusion matrix:
[[84, 16],
[12, 88]]
These results are based on a small, balanced subset of the official IMDb test split. They should not be interpreted as performance on the complete IMDb benchmark.
The same test subset was also used for comparison with earlier experimental versions, so these results are exploratory rather than a fully untouched final benchmark.
Usage
from transformers import pipeline
classifier = pipeline(
"text-classification",
model="YOUR_USERNAME/distilbert-imdb-sentiment-v3"
)
result = classifier(
"This movie was absolutely fantastic!"
)
print(result)
Replace YOUR_USERNAME with the actual Hugging Face account name after publishing.
Limitations
- Designed for English movie-review sentiment classification.
- Supports only positive and negative labels.
- Does not explicitly recognize neutral sentiment.
- Input text is truncated to 128 tokens.
- Performance may degrade on other domains.
- Evaluation was conducted on a limited test subset.
- Intended primarily for learning and demonstration.
License
Apache-2.0, following the base model's license.
Project Scope
This is an independent Hugging Face learning project and does not depend on an external GitHub repository.
- Downloads last month
- 29
Model tree for YueranCao2001/distilbert-imdb-sentiment-v3
Base model
distilbert/distilbert-base-uncased