Downloads · 30 days
0
RahimahR/distilbert-amazon-polarity-470-final
distilbert-amazon-polarity-470-final is a text classification model from RahimahR. Use it when you need a label for a piece of text. It is set up for transformers.
DistilBERT Sentiment Classifier – Amazon Polarity
Downloads · 30 days
0
Access
Public
Updated Dec 14, 2025
Repo size
—
Likes
0
Public
Click a slice to open those files.
.json713 KB · 75%
From the Hugging Face model README
DistilBERT Sentiment Classifier – Amazon Polarity
Task: Binary sentiment analysis for Amazon-style product reviews.
This model predicts whether a product review is positive or negative.
Accuracy is appropriate because this is a binary classification task (positive vs negative).
This model can be used for:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_id = "RahimaR/distilbert-amazon-polarity-470-final"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id)
label_names = ["negative", "positive"]
def predict_sentiment(text):
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
with torch.no_grad():
logits = model(**inputs).logits
return label_names[logits.argmax().item()]
print(predict_sentiment("This product works really well!"))
print(predict_sentiment("The item arrived broken and customer service was terrible."))