Downloads · 30 days
6
35% of all-time downloads
Hums003/distilbert-imdb-sentiment
distilbert-imdb-sentiment is a machine learning model from Hums003. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
This model is a fine-tuned version of distilbert-base-uncased for binary sentiment classification on the IMDB movie reviews dataset.
Downloads · 30 days
6
35% of all-time downloads
All-time downloads
17
Public
Parameters
67M
3 GB on disk
Likes
0
Public
Click a slice to open those files.
.pt2.7 GB · 89%
From the Hugging Face model README
This model is a fine-tuned version of distilbert-base-uncased for binary sentiment classification on the IMDB movie reviews dataset.
distilbert-base-uncasedfrom transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model and tokenizer
model_name = "Hums003/distilbert-imdb-sentiment"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Prepare text
text = "This movie was absolutely fantastic! I loved every minute of it."
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
# Get predictions
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
# Interpret results
sentiment = "positive" if predictions[0][1] > 0.5 else "negative"
confidence = predictions[0][1].item() if predictions[0][1] > 0.5 else predictions[0][0].item()
print(f"Sentiment: {sentiment} (confidence: {confidence:.2%})")