onnx-community/bert-small-pii-detection-ONNX
02.9k
bert-small-pii-detection (ONNX)
This is an ONNX version of gravitee-io/bert-small-pii-detection. It was automatically converted and uploaded using this Hugging Face Space.
Usage with Transformers.js
See the pipeline documentation for token-classification: https://huggingface.co/docs/transformers.js/api/pipelines#module_pipelines.TokenClassificationPipeline
gravitee-io/bert-small-pii-detection ๐
A more accurate PII detector fine-tuned from `prajjwal1/bert-small` on the datasets described in metatada.
About the dataset:
We combined various datasets in order to cover wide range of document formats like:
- JSON,
- HTML,
- XML,
- SQL
- Documents
Label Set
AGE, COORDINATE, CREDIT_CARD, DATE_TIME, EMAIL_ADDRESS, FINANCIAL, IBAN_CODE, IMEI,
IP_ADDRESS, LOCATION, MAC_ADDRESS, NRP, ORGANIZATION, PASSWORD, PERSON, PHONE_NUMBER,
TITLE, URL, US_BANK_NUMBER, US_DRIVER_LICENSE, US_ITIN, US_LICENSE_PLATE, US_PASSPORT, US_SSNHow to Use
Quick start (pipeline)
from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
repo = "gravitee-io/bert-small-pii-detection"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForTokenClassification.from_pretrained(repo)
pipe = pipeline("token-classification", model=model, tokenizer=tok, aggregation_strategy="simple")
text = ""
pipe(text)Evaluation
Metric: precision / recall / F1 per entity, micro/macro averages
Intended Uses & Limitations
Use this model for:
- Low resource environmens
- Redacting PII in customer support logs, dev/test environments, API traces and articles
- Real-time hints in form fields or data entry systems
Limitations:
- English-focused; other languages will degrade
- Domain drift is real: audit on your own data
Citation
If you use the model, please consider citing the papers:
@misc{bhargava2021generalization,
title={Generalization in NLI: Ways (Not) To Go Beyond Simple Heuristics},
author={Prajjwal Bhargava and Aleksandr Drozd and Anna Rogers},
year={2021},
eprint={2110.01518},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
@article{DBLP:journals/corr/abs-1908-08962,
author = {Iulia Turc and
Ming{-}Wei Chang and
Kenton Lee and
Kristina Toutanova},
title = {Well-Read Students Learn Better: The Impact of Student Initialization
on Knowledge Distillation},
journal = {CoRR},
volume = {abs/1908.08962},
year = {2019},
url = {http://arxiv.org/abs/1908.08962},
eprinttype = {arXiv},
eprint = {1908.08962},
timestamp = {Thu, 29 Aug 2019 16:32:34 +0200},
biburl = {https://dblp.org/rec/journals/corr/abs-1908-08962.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
@online{WinNT,
author = {Benjamin Kilimnik},
title = {{Privy} Synthetic PII Protocol Trace Dataset},
year = 2022,
url = {https://huggingface.co/datasets/beki/privy},
}
@online{gretel2023,
author = {Gretel.ai},
title = {{Synthetic PII Finance Multilingual Dataset}},
year = 2023,
url = {https://huggingface.co/datasets/gretelai/synthetic_pii_finance_multilingual},
}
@inproceedings{tjong-kim-sang-de-meulder-2003-introduction,
title = "Introduction to the CoNLL-2003 Shared Task: Language-Independent Named Entity Recognition",
author = "Tjong Kim Sang, Erik F. and De Meulder, Fien",
booktitle = "Proceedings of the Seventh Conference on Natural Language Learning at HLT-NAACL 2003",
year = "2003",
url = "https://aclanthology.org/W03-0419",
}
}