nyu-mll/glue
Viewer • Updated • 1.49M • 419k • 508
This model is a fine-tuned version of distilbert-base-uncased on the SST-2 (Stanford Sentiment Treebank) dataset for sentiment analysis.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model and tokenizer
model_name = "Naji20/sst2-sentiment-model"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Predict sentiment
text = "This movie is amazing!"
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
outputs = model(**inputs)
prediction = torch.argmax(outputs.logits, dim=1).item()
sentiment = "Positive" if prediction == 1 else "Negative"
print(f"Sentiment: {sentiment}")
| Text | Prediction |
|---|---|
| "This movie is absolutely amazing!" | Positive ✅ |
| "I hated every minute of it." | Negative ❌ |
| "Best film I've ever seen!" | Positive ✅ |
| "Terrible waste of time." | Negative ❌ |
@inproceedings{socher2013recursive,
title={Recursive deep models for semantic compositionality over a sentiment treebank},
author={Socher, Richard and Perelygin, Alex and Wu, Jean and Chuang, Jason and Manning, Christopher D and Ng, Andrew and Potts, Christopher},
booktitle={Proceedings of the 2013 conference on empirical methods in natural language processing},
pages={1631--1642},
year={2013}
}
Naji (Аммар Нажи Али Саад) - Kazan Federal University
Base model
distilbert/distilbert-base-uncased