Downloads · 30 days
3
14% of all-time downloads
Shr1ne/xlnet-fake-news-detector
xlnet-fake-news-detector is a machine learning model from Shr1ne. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This model is fine-tuned XLNet for detecting fake news
Downloads · 30 days
3
14% of all-time downloads
All-time downloads
22
Public
Parameters
117M
470 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors469 MB · 100%
From the Hugging Face model README
This model is fine-tuned XLNet for detecting fake news
from transformers import XLNetTokenizer, XLNetForSequenceClassification
# Load model and tokenizer
tokenizer = XLNetTokenizer.from_pretrained("Shr1ne/xlnet-fake-news-detector")
model = XLNetForSequenceClassification.from_pretrained("Shr1ne/xlnet-fake-news-detector")
# Prepare your text
text = "Your news text here"
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True)
# Get prediction
outputs = model(**inputs)
prediction = outputs.logits.argmax(-1).item()
label = "FAKE" if prediction == 1 else "REAL"