Downloads · 30 days
0
Dheerajsahi/hf-text-classification
hf-text-classification is a machine learning model from Dheerajsahi. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This project fine-tunes a DistilBERT model for sentiment analysis on the IMDB movie review dataset.
Downloads · 30 days
0
Access
Public
Updated Dec 22, 2025
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py12.2 KB · 78%
From the Hugging Face model README
This project fine-tunes a DistilBERT model for sentiment analysis on the IMDB movie review dataset.
Dataset: Used the IMDB dataset from Hugging Face Datasets, which contains 50,000 movie reviews labeled as positive or negative.
Model: Fine-tuned distilbert-base-uncased, a lightweight BERT model, for binary text classification.
Training:
Results: The model achieves classification accuracy on the test set. Metrics include accuracy and F1 score.
Deployment: The fine-tuned model is saved locally and can be pushed to the Hugging Face Hub.
fine_tune_classifier.py: Main training scriptpush_to_hub.py: Script to push the model to Hugging Face HubREADME.md: This filepip install transformers datasets torch scikit-learn
python fine_tune_classifier.py
pip install huggingface_hub
huggingface-cli login
Update the repo_id in push_to_hub.py with your username
Run:
python push_to_hub.py
from transformers import pipeline
classifier = pipeline("text-classification", model="./fine_tuned_model")
result = classifier("This movie was absolutely fantastic!")
print(result)