clarin-pl/kpwr-ner
Viewer • Updated • 18.3k • 1.09k • 10
Fine-tuned pczarnik/herbert-base-ner
for detecting personal data (PII) in Polish text.
Detects: PERSON, ADDRESS (including full address with city, e.g. ul. Lipowej 7 w Krakowie).
Intended use: Polish web forms — browser-side inference via
@xenova/transformers + ONNX Runtime Web (WASM),
no backend required.
4 813 training samples (train/dev/test split):
Fine-tuned for 8 epochs with early stopping (patience=3), best checkpoint selected by eval F1 (seqeval, micro-averaged over B-PER/I-PER/B-LOC/I-LOC).
kpwr_final_test.json, 615 samples, character-level IoU >= 0.5)
| Label | F1 | Prec | Recall | TP | FP | FN |
|---|---|---|---|---|---|---|
| PERSON | 0.922 | 0.885 | 0.962 | 425 | 55 | 17 |
| ADDRESS | 0.944 | 0.903 | 0.990 | 102 | 11 | 1 |
ADDRESS recall 0.990 — the model captures full addresses including city names.
The model outputs 5 BIO classes:
| Model label | Meaning for this use case |
|---|---|
B-PER / I-PER |
PERSON |
B-LOC / I-LOC |
ADDRESS |
O |
not PII |
| File | Format | Notes |
|---|---|---|
model.onnx |
FP32 | highest quality |
model_quantized.onnx |
INT8 | recommended for browser |
onnx/model_quantized.onnx |
INT8 | alias for Transformers.js dtype:"q8" |
config.json |
JSON | label mapping, model config |
tokenizer.json |
JSON | HerBERT tokenizer |
from transformers import pipeline
ner = pipeline(
"token-classification",
model="ArkadiuszPawlak/pczarnik-herbert-ner-polish-pii",
aggregation_strategy="simple",
)
result = ner("Jan Kowalski mieszka przy ul. Marszałkowskiej 1, 00-001 Warszawa.")
# [{"entity_group": "PER", "word": "Jan Kowalski", ...},
# {"entity_group": "LOC", "word": "ul. Marszałkowskiej 1, 00-001 Warszawa", ...}]
import { pipeline } from "@xenova/transformers";
const ner = await pipeline(
"token-classification",
"ArkadiuszPawlak/pczarnik-herbert-ner-polish-pii",
{ aggregation_strategy: "simple" }
);
const LABEL_MAP = { PER: "PERSON", LOC: "ADDRESS" };
const raw = await ner("Jan Kowalski mieszka przy ul. Marszałkowskiej 1 w Krakowie.");
const entities = raw
.filter(e => e.entity_group in LABEL_MAP)
.map(e => ({ label: LABEL_MAP[e.entity_group], text: e.word, score: e.score }));
console.log(entities);
// [{ label: "PERSON", text: "Jan Kowalski", score: 0.99 },
// { label: "ADDRESS", text: "ul. Marszałkowskiej 1 w Krakowie", score: 0.97 }]
Base model
pczarnik/herbert-base-ner