Example code:

# Sample text to predict
text = "I love this movie, it was fantastic!"

# Tokenize the input text
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)

# Get model predictions
with torch.no_grad():
    outputs = model(**inputs)

# Get the logits (model's raw output)
logits = outputs.logits

# Convert logits to probabilities (if needed) and get the predicted class (0 or 1)
predictions = torch.argmax(logits, dim=-1).item()

# Map the prediction to sentiment labels
labels = {0: "NEGATIVE", 1: "POSITIVE"}  # Assuming binary classification
predicted_label = labels[predictions]

print(f"Predicted Sentiment: {predicted_label}")

Downloads last month
1,570
Safetensors
Model size
67M params
Tensor type
F32
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Model tree for appleboiy/DistilBERT-Sentiment

Finetuned
(7142)
this model

Dataset used to train appleboiy/DistilBERT-Sentiment