Views
No views yet
NEGATIVE / POSITIVE).
Reports ~91% accuracy on the SST-2 dev set at roughly half the size and twice the speed of
BERT-base — the standard default for quick English sentiment work.[!NOTE] This is a mirror. The weights and tokenizer files here are an unmodified copy ofdistilbert/distilbert-base-uncased-finetuned-sst-2-english, re-hosted on this profile for reproducibility and convenience. All credit for the original work belongs to its authors. The upstream license (apache-2.0) is preserved and applies to this copy. If you need the canonical version, please use the upstream repository.
1from transformers import pipeline
2
3clf = pipeline("sentiment-analysis", model="priyaganesh2050/distilbert-sst2-sentiment")
4print(clf("A gorgeous, witty film that earns every one of its two hours."))
5# [{'label': 'POSITIVE', 'score': 0.9998}]1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4tok = AutoTokenizer.from_pretrained("priyaganesh2050/distilbert-sst2-sentiment")
5model = AutoModelForSequenceClassification.from_pretrained("priyaganesh2050/distilbert-sst2-sentiment")
6
7texts = ["Loved every minute.", "Painfully slow and predictable."]
8batch = tok(texts, padding=True, truncation=True, return_tensors="pt")
9with torch.no_grad():
10 probs = model(**batch).logits.softmax(-1)
11
12for t, p in zip(texts, probs):
13 print(f"{t:35s} -> {model.config.id2label[int(p.argmax())]} ({p.max():.3f})")priyaganesh2050/rotten-tomatoes-sentiment
for zero-shot evaluation, since both use the same movie-review, binary-sentiment setup.