Views
No views yet
jaxay-imdb-distilbert, is a fine-tuned version of distilbert-base-uncased by Jaxay for binary sentiment classification. It is trained on the IMDb dataset to classify movie reviews as either positive or negative.Trainer API for 3 epochs.1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2
3# Load the model and tokenizer
4tokenizer = AutoTokenizer.from_pretrained("Jaxay/jaxay-imdb-distilbert")
5model = AutoModelForSequenceClassification.from_pretrained("Jaxay/jaxay-imdb-distilbert")
6
7# Define the input text
8text = "The movie was fantastic! A true masterpiece."
9
10# Tokenize the input and make a prediction
11inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
12outputs = model(**inputs)
13
14# Get the predicted label
15predicted_class = outputs.logits.argmax().item()
16label = "Positive" if predicted_class == 1 else "Negative"
17print(f"Sentiment: {label}")