Downloads · 30 days
21
4% of all-time downloads
harshhmaniya/fine-tuned-bert-imdb-sentiment-analysis
fine-tuned-bert-imdb-sentiment-analysis is a machine learning model from harshhmaniya. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Author: Harsh Maniya Model Type: Text Classification (Sentiment Analysis) Language: English
Downloads · 30 days
21
4% of all-time downloads
All-time downloads
467
Public
Repo size
438 MB
Likes
1
Public
Click a slice to open those files.
.h5438 MB · 100%
From the Hugging Face model README
Author: Harsh Maniya
Model Type: Text Classification (Sentiment Analysis)
Language: English
This repository hosts a BERT-based model fine-tuned on the IMDB movie reviews dataset. The goal is to classify movie reviews as either positive or negative with high accuracy.
bert-base-uncasedIf you want to quickly gauge whether a movie review is glowing or scathing, this model is for you!
[CLS] token output for binary classification.Why BERT? BERT’s bidirectional training helps it capture context from both directions in a sentence, making it especially powerful for understanding nuances in text like movie reviews.
bert-base-uncased), truncating/padding to a fixed length (e.g., 128 tokens).Notebook: The entire fine-tuning process is documented in the notebook included in this repository, so you can see exactly how training was performed.
This performance indicates that the model handles most typical movie reviews well. However, it might still struggle with highly sarcastic or context-dependent reviews.
In Python:
from transformers import AutoTokenizer, TFAutoModelForSequenceClassification
# Replace with your repository
model_name = "harshhmaniya/fine-tuned-bert-imdb-sentiment-analysis"
# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = TFAutoModelForSequenceClassification.from_pretrained(model_name)
# Example text
review_text = "I absolutely loved this movie! The plot was gripping and the acting was top-notch."
# Prepare input
inputs = tokenizer(review_text, return_tensors="tf", truncation=True, padding=True)
# Perform inference
outputs = model(inputs)
logits = outputs.logits
# Convert logits to probabilities (softmax)
import tensorflow as tf
probs = tf.nn.softmax(logits, axis=-1)
pred_class = tf.argmax(probs, axis=-1).numpy()[0]
# Interpret results
label_map = {0: "Negative", 1: "Positive"}
print(f"Review Sentiment: {label_map[pred_class]}")
If you use this model or reference the code in your research or project, please cite it as follows (adjust for your specific citation style):
@misc{Maniya2025IMDBBERT,
title = {Fine-Tuned BERT for IMDB Sentiment Analysis},
author = {Harsh Maniya},
year = {2025},
url = {https://huggingface.co/harshhmaniya/fine-tuned-bert-imdb-sentiment-analysis}
}
We hope this model helps you classify movie reviews quickly and accurately. For more details, check out the training notebook, experiment with the model, and share your feedback!