NewsGuard AI - Fake News Detection Model

This model is a fine-tuned BERT-base-uncased model for detecting fake news. It is trained using the FakeNewsNet dataset.

Model Details

  • Base Model: BERT-base-uncased
  • Task: Text Classification (Fake vs. Real News)
  • Dataset: FakeNewsNet (GossipCop & PolitiFact)
  • Training Framework: Hugging Face Transformers
  • Metrics: Accuracy, Precision, Recall

How to Use

from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch

model_path = "your-huggingface-username/newsguard-ai-fake-news"
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForSequenceClassification.from_pretrained(model_path)

text = "Some news article text here..."
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=512)

with torch.no_grad():
    outputs = model(**inputs)
    probs = torch.nn.functional.softmax(outputs.logits, dim=-1)

prediction = "Fake" if torch.argmax(probs) == 0 else "Real"
print(f"Prediction: {prediction}, Confidence: {probs.tolist()[0]}")
Downloads last month
4
Safetensors
Model size
109M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support