Ningze123/cis5190-news-source-headlines
Viewer โข Updated โข 3.81k โข 14
How to use Ningze123/cis5190-news-source-deberta-v3 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="Ningze123/cis5190-news-source-deberta-v3") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("Ningze123/cis5190-news-source-deberta-v3")
model = AutoModelForSequenceClassification.from_pretrained("Ningze123/cis5190-news-source-deberta-v3", device_map="auto")Fine-tuned from microsoft/deberta-v3-base on the CIS 5190 final-project
dataset of ~3,800 headlines from FoxNews and NBC News.
| Metric | Value |
|---|---|
| Accuracy | 0.8653 |
| F1 | 0.8774 |
| ROC-AUC | 0.9448 |
0 โ NBC1 โ FoxNewsfrom transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
repo = "Ningze123/cis5190-news-source-deberta-v3"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForSequenceClassification.from_pretrained(repo).eval()
text = "Trump rallies supporters in key swing state"
inputs = tok(text, return_tensors="pt", truncation=True, max_length=64)
with torch.no_grad():
probs = torch.softmax(model(**inputs).logits, dim=-1)[0]
label = "FoxNews" if probs.argmax() == 1 else "NBC"
print(label, float(probs.max()))
{5e-6, 1e-5, 2e-5, 3e-5, 5e-5, 1e-4}StableDropout replaced with nn.Dropout,
classifier and pooler re-initialised with std=0.02.See the project report for the full ablation study, including comparisons against DistilBERT, DistilRoBERTa, RoBERTa-Base, ELECTRA, and traditional ML baselines (TF-IDF + LR / SVM / NB / RF / XGBoost).
Base model
microsoft/deberta-v3-base