Instructions to use angel-gitt/privacy-filter-gbai with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use angel-gitt/privacy-filter-gbai with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="angel-gitt/privacy-filter-gbai")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("angel-gitt/privacy-filter-gbai") model = AutoModelForTokenClassification.from_pretrained("angel-gitt/privacy-filter-gbai", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Privacy Filter ES M1
Spanish-focused PII token classifier derived from
OpenMed/privacy-filter-multilingual-v2.
The 1.4B-parameter backbone and tokenizer are unchanged. Only the final
Linear(640 -> 217) BIOES classification head (139,097 parameters) was trained.
Training
- Method: frozen-backbone, head-only supervised fine-tuning in FP32.
- Train: 7,168 Spanish snippets (3,009 from MEDDOCAN train and 4,159 owned synthetic examples).
- Validation: 2,762 Spanish snippets (1,762 from MEDDOCAN dev and 1,000 owned synthetic examples).
- One epoch, batch size 16, learning rate 1e-4, seed 1701.
- Exact train/validation text overlap: zero after deduplication and quarantine.
- MEDDOCAN test, MAPA/EUR-Lex and the English OOD set were evaluation-only.
The small trained head is also included as m1_head.safetensors; the standard
model shards contain that head already merged into the base checkpoint.
Evaluation
All results use whitespace-preserving tokenization and constrained BIOES/Viterbi decoding. F1 values below are exact-span untyped / character-level detection.
| Evaluation set | Documents | M0 | M1 |
|---|---|---|---|
| MEDDOCAN official test (Spanish clinical) | 250 | 0.447 / 0.755 | 0.508 / 0.796 |
| Independent English OOD | 1,201 | 0.501 / 0.790 | 0.531 / 0.777 |
| MAPA/EUR-Lex Spanish legal diagnostic | 2 | 0.265 / 0.320 | 0.492 / 0.631 |
The MAPA result is only a small diagnostic because the published Spanish subset contains two long documents. It was not used for training M1.
Usage
Install OpenMed's Hugging Face dependencies, then use its privacy-filter runtime so predictions are decoded with the model's BIOES/Viterbi constraints:
from openmed import extract_pii
result = extract_pii(
"Contacte con Ana López en ana.lopez@example.es",
model_name="angel-gitt/privacy-filter-gbai",
)
for entity in result.entities:
print(entity.label, entity.text, entity.confidence)
Limitations
This is a research prototype, not a guarantee of complete anonymization or legal compliance. It can miss PII, produce false positives, and infer incorrect span boundaries or categories. The English character-level F1 decreased slightly after Spanish adaptation. High-stakes use requires deterministic checks, a domain-specific held-out evaluation set and human review.
License and attribution
Released under Apache 2.0, following the upstream model. Cite and attribute OpenMed, OpenAI Privacy Filter, MEDDOCAN and the relevant upstream datasets as described in their respective model and dataset cards.
- Downloads last month
- 15
Model tree for angel-gitt/privacy-filter-gbai
Base model
openai/privacy-filter