Instructions to use Sumra81/fake-news-distilbert with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Sumra81/fake-news-distilbert with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Sumra81/fake-news-distilbert")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("Sumra81/fake-news-distilbert") model = AutoModelForSequenceClassification.from_pretrained("Sumra81/fake-news-distilbert", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Fake News Detector (DistilBERT)
A DistilBERT model fine-tuned to tell whether a news article's writing style looks real or fake.
Labels
- 0 = Fake
- 1 = Real
Training data
- ISOT Fake and Real News dataset (15,000 articles used)
- WELFake dataset (10,000 articles used, labels flipped so that 0 = fake, 1 = real)
- Text was cleaned first: lowercased, links removed, and agency tags, dates, month and day names, and city names removed to reduce shortcut clues.
Training setup
- Base model: distilbert-base-uncased
- 2 epochs, batch size 16, learning rate 2e-5, max length 256 tokens
- Trained on a free Kaggle GPU
Results
| Test | Accuracy | F1 |
|---|---|---|
| Held-out WELFake (trained on ISOT + WELFake) | 96.57% | 0.964 |
| WELFake, when trained on ISOT only | 86.00% | 0.842 |
The 86% figure is the better sign of how it handles a source it never trained on.
Limits
- It reads writing style, not facts. A false story written like a news-agency report can be marked real.
- Accuracy drops sharply on sources that look different from the training data.
- Only about the first 200 words of an article are read.
- Not for real fact-checking or moderation decisions.
How to use
from transformers import pipeline
clf = pipeline("text-classification", model="Sumra81/fake-news-distilbert")
print(clf("Paste a cleaned article here"))
- Downloads last month
- 38
Model tree for Sumra81/fake-news-distilbert
Base model
distilbert/distilbert-base-uncased