Downloads · 30 days
3
0% of all-time downloads
ericshantos/veritas-bert-ptbr
veritas-bert-ptbr is a text classification model from ericshantos. Use it when you need a label for a piece of text. The card lists the license as mit.
This repository contains a machine learning model for detecting fake news in Portuguese, using the datasets Fake.br-Corpus, FakeTrue.br and FakeRecogna.
Downloads · 30 days
3
0% of all-time downloads
All-time downloads
665
Public
Parameters
109M
2.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors436 MB · 100%
From the Hugging Face model README
This repository contains a machine learning model for detecting fake news in Portuguese, using the datasets Fake.br-Corpus, FakeTrue.br and FakeRecogna.
The solution evolves from classic LSTM approaches to the use of Transformer-based models, such as BERT, allowing for a better capture of the news' semantic context.
To develop a system capable of automatically classifying news as true or false, assisting in the fight against misinformation in the Portuguese language.
The current version of the project utilizes a consolidated base from three major sources, tripling the original data volume to ensure greater generalization power:
| Source | Description |
|---|---|
| Fake.br-Corpus | Reference dataset with real and fake news. |
| FakeTrue.br | Complementary Portuguese news database. |
| FakeRecogna | Expanded dataset for greater thematic diversity. |
The model uses BERTimbau (BERT base for Portuguese) as its backbone, with a custom classification head:
neuralmind/bert-base-portuguese-cased.Processing now features specific extractors for each base (BaseExtractor):
.txt (Fake.br), .csv (FakeTrue), and .xlsx (FakeRecogna) files.max_length=256.pin_memory and prefetch_factor for GPU optimization.The LSTM model achieved approximately 97% accuracy on the test set.
BERT-based models show significant potential for improvement by capturing linguistic context more effectively.
The model can be loaded directly via Transformers:
import torch
from transformers import AutoModelForSequenceClassification, AutoTokenizer
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
tokenizer = AutoTokenizer.from_pretrained(repo_id)
model = AutoModelForSequenceClassification.from_pretrained(repo_id)
model.to(device)
model.eval()
I dedicate this project to my high school teachers, who contributed to the development of my critical thinking.
Special mention to Professor Winola Cunha, who reinforced the importance of morphosyntax — and was absolutely right.
Created by Eric dos Santos 🚀