加载中…
加载中…
A fine-tuned DistilBERT model for classifying movie reviews as positive or negative. This model was trained on the IMDb movie review dataset using Hugging Face Transformers and PyTorch.
NEGATIVE and POSITIVE| Input Text | Predicted Sentiment |
|---|---|
| This movie was absolutely fantastic! | POSITIVE |
| The acting was terrible and the story was boring. | NEGATIVE |
| I enjoyed every minute of this film. | POSITIVE |
The model was fine-tuned for one epoch using 5,000 training examples and evaluated on a selected subset of 1,000 IMDb test examples.
| Metric | Result |
|---|---|
| Accuracy | 86.8% |
| F1 Score | 87.0% |
| Evaluation Loss | 0.3307 |
These results reflect the selected evaluation subset and are not a benchmark for all sentiment-analysis tasks.
Install the required libraries:
pip install torch transformers
Load the model directly from Hugging Face:
from transformers import pipeline
model_id = "SagarFadatare00/distilbert-imdb-sentiment"
classifier = pipeline(
"text-classification",
model=model_id,
)
texts = [
"This movie was absolutely fantastic!",
"The acting was terrible and the story was boring.",
]
for text in texts:
result = classifier(text)[0]
print("Text:", text)
print("Sentiment:", result["label"])
print("Confidence:", round(result["score"] * 100, 2), "%")
2e-58810.012565,0001,000The training examples were selected from the IMDb training split, and the evaluation examples were selected from its test split using a fixed random seed.
This model is intended for educational purposes, experimentation, and sentiment-analysis applications. Evaluate it on your own data before using it in production.
Sagar Fadatare