Downloads · 30 days
38
4% of all-time downloads
FelipeCasali-USP/lgpd_pii_identifier
lgpd_pii_identifier is a token classification model from FelipeCasali-USP. Use it when you need labels on individual words, such as names. It is set up for transformers. The card lists the license as apache-2.0.
lgpdpiiidentifier is a pre-trained NLP model to identify sensitive data in the scope of LGPD (Lei Geral de Proteção de Dados)
Downloads · 30 days
38
4% of all-time downloads
All-time downloads
850
Public
Repo size
1.6 GB
Likes
3
Public
Click a slice to open those files.
.bin268 MB · 100%
From the Hugging Face model README
lgpd_pii_identifier is a pre-trained NLP model to identify sensitive data in the scope of LGPD (Lei Geral de Proteção de Dados)
The goal is to have a tool to identify document numbers like CNPJ, CPF, people's names and other kind of sensitive data, allowing companies to find and anonymize data according to their businness needs, and governance rules.
In order to use the model, you need to get the HuggingFace auth token. You can get it here.
from transformers import DistilBertModel, DistilBertTokenizer
import numpy as np
pred_mapper = {
0: "cnpj",
1: "cpf",
2: "nome",
3: "estado"
}
tokenizer = DistilBertTokenizer.from_pretrained("FelipeCasali-USP/lgpd_pii_identifier")
lgpd_pii_identifier = DistilBertModel.from_pretrained("FelipeCasali-USP/lgpd_pii_identifier")
tokens = tokenizer(["String to be analized"], return_tensors="pt",
padding=True, truncation=True, max_length=512)
lgpd_pii_identifier_outputs = lgpd_pii_identifier(**tokens)
preds = [pred_mapper[np.argmax(pred)] for pred in lgpd_pii_identifier_outputs.logits.cpu().detach().numpy()]