Instructions to use princy-21/sentilens-distilbert with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use princy-21/sentilens-distilbert with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="princy-21/sentilens-distilbert")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("princy-21/sentilens-distilbert") model = AutoModelForSequenceClassification.from_pretrained("princy-21/sentilens-distilbert", device_map="auto") - Notebooks
- Google Colab
- Kaggle
SentiLens β Fine-Tuned DistilBERT
Overview
SentiLens is a binary sentiment classification model fine-tuned on the IMDB movie review dataset. It predicts whether a movie review expresses positive or negative sentiment.
This project explores transformer fine-tuning, model evaluation, and the comparison of a specialised classifier with large language model prompting.
Model details
- Base model:
distilbert/distilbert-base-uncased - Task: Binary sentiment classification
- Dataset:
stanfordnlp/imdb - Training epochs: 2
- Maximum sequence length: 256 tokens
- Training batch size: 8
- Learning rate: 2e-5
- Labels:
0 = NEGATIVE,1 = POSITIVE
Evaluation
Evaluation on the 25,000-example IMDB test set produced:
| Metric | Result |
|---|---|
| Accuracy | 90.69% |
| F1 score | 0.9080 |
| Test loss | 0.2544 |
Confusion matrix (rows: actual; columns: predicted):
| Predicted negative | Predicted positive | |
|---|---|---|
| Actual negative | 11,187 | 1,313 |
| Actual positive | 1,015 | 11,485 |
These results apply to the IMDB test set and should not be interpreted as performance guarantees on other types of text.
Intended use
- Educational sentiment analysis
- Movie review classification
- Demonstrations of transformer fine-tuning
Limitations
- The model is specialised for English-language movie reviews.
- Performance may differ on social media, sarcasm, mixed sentiment, other languages, or domains outside movie reviews.
- A sentiment label does not explain every nuance of a review.
- This model is not intended for high-stakes decisions.
Training and evaluation
The model was fine-tuned using Hugging Face Transformers and PyTorch in Google Colab. Evaluation metrics were calculated on the dataset's held-out test split.
Usage
from transformers import pipeline
classifier = pipeline(
"text-classification",
model="princy-21/sentilens-distilbert"
)
print(classifier("The acting was excellent and the story was moving!"))
Acknowledgements
- Base model: DistilBERT, originally developed by the DistilBERT authors.
- Dataset: IMDB movie reviews distributed through Hugging Face Datasets.
Review the original model and dataset licenses and attribution requirements before redistributing this model.
Author
Amal Princy J β student AI/ML project.
- Downloads last month
- 28