Token Classification
Transformers
ONNX
Safetensors
xlm-roberta
ner
on-device
privacy
flowx
openner
cross
de-identification
Instructions to use flowxai/piiguard with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use flowxai/piiguard with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="flowxai/piiguard")# Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("flowxai/piiguard") model = AutoModelForTokenClassification.from_pretrained("flowxai/piiguard", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add OpenNER model, card, NOTICE (Apache-2.0, FlowX.AI)
Browse files- .gitattributes +2 -0
- NOTICE +8 -0
- README.md +53 -0
- config.json +64 -0
- metrics.json +11 -0
- model.safetensors +3 -0
- onnx/model.int8.onnx +3 -0
- onnx/model.onnx +3 -0
- onnx/model.onnx.data +3 -0
- tokenizer.json +3 -0
- tokenizer_config.json +15 -0
- training_args.bin +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
onnx/model.onnx.data filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
NOTICE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FlowX OpenNER
|
| 2 |
+
Copyright 2026 FlowX.AI
|
| 3 |
+
|
| 4 |
+
This product includes software and models developed at FlowX.AI (https://flowx.ai).
|
| 5 |
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use these
|
| 6 |
+
files except in compliance with the License. You may obtain a copy of the License at
|
| 7 |
+
|
| 8 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: token-classification
|
| 5 |
+
base_model: FacebookAI/xlm-roberta-base
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
+
- ro
|
| 9 |
+
- bg
|
| 10 |
+
- hu
|
| 11 |
+
- sl
|
| 12 |
+
- hr
|
| 13 |
+
- de
|
| 14 |
+
- it
|
| 15 |
+
- fr
|
| 16 |
+
tags:
|
| 17 |
+
- ner
|
| 18 |
+
- on-device
|
| 19 |
+
- privacy
|
| 20 |
+
- flowx
|
| 21 |
+
- openner
|
| 22 |
+
- cross
|
| 23 |
+
- de-identification
|
| 24 |
+
- token-classification
|
| 25 |
+
metrics:
|
| 26 |
+
- f1
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
# PiiGuard
|
| 30 |
+
|
| 31 |
+
**PiiGuard** is a small, on-device cross NER model from the FlowX **OpenNER** family. Developed by **FlowX.AI**. Runs 100% on-premise / air-gapped, so no data leaves your boundary.
|
| 32 |
+
|
| 33 |
+
## What it does
|
| 34 |
+
- **Task:** token-classification
|
| 35 |
+
- **Base model:** `FacebookAI/xlm-roberta-base`
|
| 36 |
+
- **Entity types (7):** CARD, DATE, EMAIL, IBAN, NATIONAL_ID, PERSON, PHONE
|
| 37 |
+
- **Held-out F1:** 1.0000
|
| 38 |
+
- **Runtime:** CPU, Apple Silicon, one GPU, or browser/edge via ONNX (INT8). ~100-160 ms/doc on CPU.
|
| 39 |
+
|
| 40 |
+
## Why a small model
|
| 41 |
+
Fine-tuned encoders match or beat frontier LLMs on structured, convention-bound extraction, at a fraction of the latency and cost, with **zero data egress**. Identifiers are validated by checksum (IBAN mod-97, card Luhn, ISIN/LEI, container ISO-6346, VIN, national IDs), a correctness guarantee general LLMs lack. See the FlowX OpenNER benchmark for measured results.
|
| 42 |
+
|
| 43 |
+
## Usage
|
| 44 |
+
```python
|
| 45 |
+
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
| 46 |
+
tok = AutoTokenizer.from_pretrained("flowxai/piiguard")
|
| 47 |
+
model = AutoModelForTokenClassification.from_pretrained("flowxai/piiguard")
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
## License & attribution
|
| 51 |
+
Licensed under the **Apache License 2.0**. Copyright 2026 **FlowX.AI** (https://flowx.ai). See the `NOTICE` file. Trained on synthetic, checksum-validated data.
|
| 52 |
+
|
| 53 |
+
_Part of the FlowX OpenNER model family. Synthetic-data F1 reflects an in-distribution synthetic distribution; validate on real documents before production use._
|
config.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_cross_attention": false,
|
| 3 |
+
"architectures": [
|
| 4 |
+
"XLMRobertaForTokenClassification"
|
| 5 |
+
],
|
| 6 |
+
"attention_probs_dropout_prob": 0.1,
|
| 7 |
+
"bos_token_id": 0,
|
| 8 |
+
"classifier_dropout": null,
|
| 9 |
+
"dtype": "float32",
|
| 10 |
+
"eos_token_id": 2,
|
| 11 |
+
"hidden_act": "gelu",
|
| 12 |
+
"hidden_dropout_prob": 0.1,
|
| 13 |
+
"hidden_size": 768,
|
| 14 |
+
"id2label": {
|
| 15 |
+
"0": "O",
|
| 16 |
+
"1": "B-PERSON",
|
| 17 |
+
"2": "I-PERSON",
|
| 18 |
+
"3": "B-EMAIL",
|
| 19 |
+
"4": "I-EMAIL",
|
| 20 |
+
"5": "B-PHONE",
|
| 21 |
+
"6": "I-PHONE",
|
| 22 |
+
"7": "B-NATIONAL_ID",
|
| 23 |
+
"8": "I-NATIONAL_ID",
|
| 24 |
+
"9": "B-IBAN",
|
| 25 |
+
"10": "I-IBAN",
|
| 26 |
+
"11": "B-CARD",
|
| 27 |
+
"12": "I-CARD",
|
| 28 |
+
"13": "B-DATE",
|
| 29 |
+
"14": "I-DATE"
|
| 30 |
+
},
|
| 31 |
+
"initializer_range": 0.02,
|
| 32 |
+
"intermediate_size": 3072,
|
| 33 |
+
"is_decoder": false,
|
| 34 |
+
"label2id": {
|
| 35 |
+
"B-CARD": 11,
|
| 36 |
+
"B-DATE": 13,
|
| 37 |
+
"B-EMAIL": 3,
|
| 38 |
+
"B-IBAN": 9,
|
| 39 |
+
"B-NATIONAL_ID": 7,
|
| 40 |
+
"B-PERSON": 1,
|
| 41 |
+
"B-PHONE": 5,
|
| 42 |
+
"I-CARD": 12,
|
| 43 |
+
"I-DATE": 14,
|
| 44 |
+
"I-EMAIL": 4,
|
| 45 |
+
"I-IBAN": 10,
|
| 46 |
+
"I-NATIONAL_ID": 8,
|
| 47 |
+
"I-PERSON": 2,
|
| 48 |
+
"I-PHONE": 6,
|
| 49 |
+
"O": 0
|
| 50 |
+
},
|
| 51 |
+
"layer_norm_eps": 1e-05,
|
| 52 |
+
"max_position_embeddings": 514,
|
| 53 |
+
"model_type": "xlm-roberta",
|
| 54 |
+
"num_attention_heads": 12,
|
| 55 |
+
"num_hidden_layers": 12,
|
| 56 |
+
"output_past": true,
|
| 57 |
+
"pad_token_id": 1,
|
| 58 |
+
"position_embedding_type": "absolute",
|
| 59 |
+
"tie_word_embeddings": true,
|
| 60 |
+
"transformers_version": "5.14.1",
|
| 61 |
+
"type_vocab_size": 1,
|
| 62 |
+
"use_cache": false,
|
| 63 |
+
"vocab_size": 250002
|
| 64 |
+
}
|
metrics.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"test_loss": 1.168364815384848e-05,
|
| 3 |
+
"test_precision": 1.0,
|
| 4 |
+
"test_recall": 1.0,
|
| 5 |
+
"test_f1": 1.0,
|
| 6 |
+
"test_accuracy": 1.0,
|
| 7 |
+
"test_runtime": 4.9532,
|
| 8 |
+
"test_samples_per_second": 1211.339,
|
| 9 |
+
"test_steps_per_second": 37.955,
|
| 10 |
+
"epoch": 3.0
|
| 11 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d3087fa8d98b33ea98e122b72c88c7af177c95b7e530f929ab5061937df6601a
|
| 3 |
+
size 1109882412
|
onnx/model.int8.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d59a4ece4ac6ea69cb97188eb7b1e88d5c87fd97c6d7cb1aa1d57daef830ab5a
|
| 3 |
+
size 279417993
|
onnx/model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e48afaa72745c3fb655bd62caa77437a620c0006d3d1c023438d39320ad25832
|
| 3 |
+
size 1763260
|
onnx/model.onnx.data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:04ae34bf2d479ee4809c23f44fd26d11ddb908f1f040ec011534fa6dd1f87fa9
|
| 3 |
+
size 1109972992
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:21898d7902cb2e75d6437ce24bd352ccb84af4774b5bb40539c688dcb2338f85
|
| 3 |
+
size 17098183
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": true,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<s>",
|
| 5 |
+
"cls_token": "<s>",
|
| 6 |
+
"eos_token": "</s>",
|
| 7 |
+
"is_local": false,
|
| 8 |
+
"local_files_only": false,
|
| 9 |
+
"mask_token": "<mask>",
|
| 10 |
+
"model_max_length": 512,
|
| 11 |
+
"pad_token": "<pad>",
|
| 12 |
+
"sep_token": "</s>",
|
| 13 |
+
"tokenizer_class": "XLMRobertaTokenizer",
|
| 14 |
+
"unk_token": "<unk>"
|
| 15 |
+
}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7c93b11a2f6b6f356f5396153df716d1c52d8aac19c01d606817d36bc3e5c2b0
|
| 3 |
+
size 5201
|