Token Classification
Transformers
Safetensors
openai_privacy_filter
pii
ner
privacy
redaction
multilingual
openmed
openai-privacy-filter
Instructions to use OpenMed/privacy-filter-multilingual-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenMed/privacy-filter-multilingual-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="OpenMed/privacy-filter-multilingual-v2")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("OpenMed/privacy-filter-multilingual-v2") model = AutoModelForTokenClassification.from_pretrained("OpenMed/privacy-filter-multilingual-v2") - Notebooks
- Google Colab
- Kaggle
Update multilingual v2 model card
Browse files
README.md
CHANGED
|
@@ -6,6 +6,10 @@ datasets:
|
|
| 6 |
- ai4privacy/pii-masking-200k
|
| 7 |
- ai4privacy/pii-masking-400k
|
| 8 |
- ai4privacy/open-pii-masking-500k-ai4privacy
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
pipeline_tag: token-classification
|
| 10 |
tags:
|
| 11 |
- token-classification
|
|
@@ -41,13 +45,14 @@ Fine-tuned [`openai/privacy-filter`](https://huggingface.co/openai/privacy-filte
|
|
| 41 |
for **fine-grained PII extraction** across **54 categories** in **16 languages**.
|
| 42 |
This v2 checkpoint is the more performant successor to
|
| 43 |
`OpenMed/privacy-filter-multilingual`, with stronger multilingual PII masking
|
| 44 |
-
behavior while keeping the same 16-language, fine-grained OpenMed label space
|
|
|
|
| 45 |
|
| 46 |
- **Base model**: [`openai/privacy-filter`](https://huggingface.co/openai/privacy-filter) โ 1.4B-parameter MoE (50M active per token), BIOES token-classification head
|
| 47 |
- **Task**: Token classification for PII detection (BIOES scheme)
|
| 48 |
- **Languages (16)**: Arabic, Bengali, Chinese, Dutch, English, French, German, Hindi, Italian, Japanese, Korean, Portuguese, Spanish, Telugu, Turkish, Vietnamese
|
| 49 |
-
- **Training data**:
|
| 50 |
-
- **Recipe**: `opf train` (OpenAI's official fine-tuning CLI) โ full fine-tune, AdamW, balanced language
|
| 51 |
- **Labels**: 54 PII categories โ 217 BIOES classes (1 `O` + 54 ร B/I/E/S)
|
| 52 |
|
| 53 |
The base model ships with 8 coarse PII categories and English-only training. This
|
|
@@ -55,10 +60,12 @@ model trades that for a **6.75ร more granular vocabulary** spanning identity,
|
|
| 55 |
contact, address, financial, vehicle, digital, and crypto labels โ all evaluated
|
| 56 |
across 16 languages.
|
| 57 |
|
| 58 |
-
> **
|
| 59 |
-
>
|
| 60 |
-
>
|
| 61 |
-
>
|
|
|
|
|
|
|
| 62 |
|
| 63 |
## Quick start
|
| 64 |
|
|
@@ -66,8 +73,7 @@ across 16 languages.
|
|
| 66 |
|
| 67 |
OpenMed gives you `extract_pii()` / `deidentify()` with built-in BIOES Viterbi
|
| 68 |
decoding, span refinement, and a Faker-backed obfuscation engine. Same call
|
| 69 |
-
on every host
|
| 70 |
-
this PyTorch checkpoint.
|
| 71 |
|
| 72 |
```bash
|
| 73 |
pip install -U "openmed[hf]"
|
|
@@ -82,30 +88,30 @@ text = (
|
|
| 82 |
)
|
| 83 |
|
| 84 |
# Extract grouped entity spans
|
| 85 |
-
result = extract_pii(text, model_name="OpenMed/privacy-filter-multilingual")
|
| 86 |
for ent in result.entities:
|
| 87 |
print(f"{ent.label:30s} {ent.text!r} conf={ent.confidence:.2f}")
|
| 88 |
|
| 89 |
# De-identify with any of the supported methods
|
| 90 |
-
masked = deidentify(text, method="mask", model_name="OpenMed/privacy-filter-multilingual")
|
| 91 |
-
removed = deidentify(text, method="remove", model_name="OpenMed/privacy-filter-multilingual")
|
| 92 |
-
hashed = deidentify(text, method="hash", model_name="OpenMed/privacy-filter-multilingual")
|
| 93 |
|
| 94 |
# Faker-backed locale-aware obfuscation, deterministic with consistent=True+seed
|
| 95 |
fake = deidentify(
|
| 96 |
text,
|
| 97 |
method="replace",
|
| 98 |
-
model_name="OpenMed/privacy-filter-multilingual",
|
| 99 |
consistent=True,
|
| 100 |
seed=42,
|
| 101 |
)
|
| 102 |
print(fake.deidentified_text)
|
| 103 |
```
|
| 104 |
|
| 105 |
-
`OpenMed/privacy-filter-multilingual-
|
| 106 |
-
`
|
| 107 |
-
|
| 108 |
-
|
| 109 |
|
| 110 |
The OpenMed wrapper passes `trust_remote_code=True` for you, runs the model's
|
| 111 |
own BIOES Viterbi decoder, and skips OpenMed's regex smart-merging (the model
|
|
@@ -180,12 +186,12 @@ If you use this model, please cite **this model**, the organization behind it
|
|
| 180 |
(**OpenMed**), and the upstream base model + datasets:
|
| 181 |
|
| 182 |
```bibtex
|
| 183 |
-
@misc{
|
| 184 |
author = {OpenMed},
|
| 185 |
-
title = {{OpenMed/privacy-filter-multilingual}: multilingual fine-grained PII extraction across 16 languages and 54 categories},
|
| 186 |
year = {2026},
|
| 187 |
publisher = {Hugging Face},
|
| 188 |
-
howpublished = {\url{https://huggingface.co/OpenMed/privacy-filter-multilingual}}
|
| 189 |
}
|
| 190 |
|
| 191 |
@misc{openmed_2026,
|
|
|
|
| 6 |
- ai4privacy/pii-masking-200k
|
| 7 |
- ai4privacy/pii-masking-400k
|
| 8 |
- ai4privacy/open-pii-masking-500k-ai4privacy
|
| 9 |
+
- ai4privacy/pii-masking-openpii-1m
|
| 10 |
+
- nvidia/Nemotron-PII
|
| 11 |
+
- gretelai/gretel-pii-masking-en-v1
|
| 12 |
+
- piimb/privy
|
| 13 |
pipeline_tag: token-classification
|
| 14 |
tags:
|
| 15 |
- token-classification
|
|
|
|
| 45 |
for **fine-grained PII extraction** across **54 categories** in **16 languages**.
|
| 46 |
This v2 checkpoint is the more performant successor to
|
| 47 |
`OpenMed/privacy-filter-multilingual`, with stronger multilingual PII masking
|
| 48 |
+
behavior while keeping the same 16-language, fine-grained OpenMed label space
|
| 49 |
+
and runtime interface.
|
| 50 |
|
| 51 |
- **Base model**: [`openai/privacy-filter`](https://huggingface.co/openai/privacy-filter) โ 1.4B-parameter MoE (50M active per token), BIOES token-classification head
|
| 52 |
- **Task**: Token classification for PII detection (BIOES scheme)
|
| 53 |
- **Languages (16)**: Arabic, Bengali, Chinese, Dutch, English, French, German, Hindi, Italian, Japanese, Korean, Portuguese, Spanish, Telugu, Turkish, Vietnamese
|
| 54 |
+
- **Training data**: The original language-balanced multilingual OpenMed/AI4Privacy mix, followed by a v2 source-balanced privacy-masking adaptation mix from AI4Privacy OpenPII, Nemotron, Gretel, and Privy-style PII data
|
| 55 |
+
- **Recipe**: `opf train` (OpenAI's official fine-tuning CLI) โ full fine-tune, AdamW, balanced language and source sampling, bf16
|
| 56 |
- **Labels**: 54 PII categories โ 217 BIOES classes (1 `O` + 54 ร B/I/E/S)
|
| 57 |
|
| 58 |
The base model ships with 8 coarse PII categories and English-only training. This
|
|
|
|
| 60 |
contact, address, financial, vehicle, digital, and crypto labels โ all evaluated
|
| 61 |
across 16 languages.
|
| 62 |
|
| 63 |
+
> **Runtime note.** This v2 upload is the PyTorch checkpoint for CPU/CUDA
|
| 64 |
+
> inference anywhere `transformers` runs. The existing MLX repositories
|
| 65 |
+
> [`OpenMed/privacy-filter-multilingual-mlx`](https://huggingface.co/OpenMed/privacy-filter-multilingual-mlx)
|
| 66 |
+
> and [`OpenMed/privacy-filter-multilingual-mlx-8bit`](https://huggingface.co/OpenMed/privacy-filter-multilingual-mlx-8bit)
|
| 67 |
+
> are first-generation multilingual siblings; use this repo when you
|
| 68 |
+
> specifically want v2 behavior until v2 MLX conversions are published.
|
| 69 |
|
| 70 |
## Quick start
|
| 71 |
|
|
|
|
| 73 |
|
| 74 |
OpenMed gives you `extract_pii()` / `deidentify()` with built-in BIOES Viterbi
|
| 75 |
decoding, span refinement, and a Faker-backed obfuscation engine. Same call
|
| 76 |
+
on every host that supports this PyTorch checkpoint.
|
|
|
|
| 77 |
|
| 78 |
```bash
|
| 79 |
pip install -U "openmed[hf]"
|
|
|
|
| 88 |
)
|
| 89 |
|
| 90 |
# Extract grouped entity spans
|
| 91 |
+
result = extract_pii(text, model_name="OpenMed/privacy-filter-multilingual-v2")
|
| 92 |
for ent in result.entities:
|
| 93 |
print(f"{ent.label:30s} {ent.text!r} conf={ent.confidence:.2f}")
|
| 94 |
|
| 95 |
# De-identify with any of the supported methods
|
| 96 |
+
masked = deidentify(text, method="mask", model_name="OpenMed/privacy-filter-multilingual-v2")
|
| 97 |
+
removed = deidentify(text, method="remove", model_name="OpenMed/privacy-filter-multilingual-v2")
|
| 98 |
+
hashed = deidentify(text, method="hash", model_name="OpenMed/privacy-filter-multilingual-v2")
|
| 99 |
|
| 100 |
# Faker-backed locale-aware obfuscation, deterministic with consistent=True+seed
|
| 101 |
fake = deidentify(
|
| 102 |
text,
|
| 103 |
method="replace",
|
| 104 |
+
model_name="OpenMed/privacy-filter-multilingual-v2",
|
| 105 |
consistent=True,
|
| 106 |
seed=42,
|
| 107 |
)
|
| 108 |
print(fake.deidentified_text)
|
| 109 |
```
|
| 110 |
|
| 111 |
+
Use `OpenMed/privacy-filter-multilingual-v2` in `extract_pii()` /
|
| 112 |
+
`deidentify()` when you want this v2 checkpoint. The first-generation
|
| 113 |
+
`OpenMed/privacy-filter-multilingual-mlx*` model names remain available for
|
| 114 |
+
Apple Silicon workflows, but they are separate artifacts.
|
| 115 |
|
| 116 |
The OpenMed wrapper passes `trust_remote_code=True` for you, runs the model's
|
| 117 |
own BIOES Viterbi decoder, and skips OpenMed's regex smart-merging (the model
|
|
|
|
| 186 |
(**OpenMed**), and the upstream base model + datasets:
|
| 187 |
|
| 188 |
```bibtex
|
| 189 |
+
@misc{openmed_privacy_filter_multilingual_v2_2026,
|
| 190 |
author = {OpenMed},
|
| 191 |
+
title = {{OpenMed/privacy-filter-multilingual-v2}: multilingual fine-grained PII extraction across 16 languages and 54 categories},
|
| 192 |
year = {2026},
|
| 193 |
publisher = {Hugging Face},
|
| 194 |
+
howpublished = {\url{https://huggingface.co/OpenMed/privacy-filter-multilingual-v2}}
|
| 195 |
}
|
| 196 |
|
| 197 |
@misc{openmed_2026,
|