Text Classification
Transformers
PyTorch
English
roberta
fill-mask
fake-news
distilroberta
nlp
deep-learning
huggingface
fine-tuning
misinformation
text-embeddings-inference
Instructions to use YerayEsp/FakeBERTa with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use YerayEsp/FakeBERTa with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="YerayEsp/FakeBERTa")# Load model directly from transformers import AutoTokenizer, AutoModelForMaskedLM tokenizer = AutoTokenizer.from_pretrained("YerayEsp/FakeBERTa") model = AutoModelForMaskedLM.from_pretrained("YerayEsp/FakeBERTa") - Notebooks
- Google Colab
- Kaggle
# Load model directly
from transformers import AutoTokenizer, AutoModelForMaskedLM
tokenizer = AutoTokenizer.from_pretrained("YerayEsp/FakeBERTa")
model = AutoModelForMaskedLM.from_pretrained("YerayEsp/FakeBERTa")Quick Links
FakeBerta: A Fine-Tuned DistilRoBERTa Model for Fake News Detection
You can check the model's fine-tuning code on my GitHub.
Model Overview
FakeBerta is a fine-tuned version of DistilRoBERTa for detecting fake news. The model is trained to classify news articles as real (0) or fake (1) using natural language processing (NLP) techniques. Base Model: DistilRoBERTa Task: Fake news classification
Example of code using AutoModelForSequenceCalssification:
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
model_name = "YerayEsp/FakeBerta"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
inputs = tokenizer("Breaking: Scientists discover water on Mars!", return_tensors="pt")
outputs = model(**inputs)
logits = outputs.logits
predicted_class = torch.argmax(logits).item()
print(f"Predicted class: {predicted_class}") # 0 = Real, 1 = Fake
Library: Transformers (Hugging Face)
- Downloads last month
- 3
Model tree for YerayEsp/FakeBERTa
Base model
distilbert/distilroberta-base
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="YerayEsp/FakeBERTa")