Views
No views yet
microsoft/deberta-v3-large for multi-class classification of news headlines.
The model classifies headlines into one of 3 categories:1from transformers import pipeline
2
3classifier = pipeline(
4 "text-classification",
5 model="logicalqubit/deberta-v3-large-world-news-sentiment-classifier",
6 tokenizer="logicalqubit/deberta-v3-large-world-news-sentiment-classifier",
7 top_k=None,
8 device=-1
9)
10
11texts = [
12 "18 people sent to the hospital after mobile lounge crashes at Washington D.C.-area airport",
13]
14
15results = classifier(texts)
16
17for text, scores in zip(texts, results):
18 print(f"\n>>> {text}")
19 for s in scores:
20 print(f" {s['label']:>8} : {s['score']:.4f}")Device set to use cpu
>>> 18 people sent to the hospital after mobile lounge crashes at Washington D.C.-area airport
negative : 0.9998
neutral : 0.0001
positive : 0.0001