Token Classification
Transformers
ONNX
Safetensors
Transformers.js
modernbert
pii
pii-detection
ner
privacy
anonymization
redaction
de-identification
chinese
japanese
korean
cjk
mmbert
个人信息
脱敏
Eval Results (legacy)
Instructions to use CheezOne/pii-detector-cjk-small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use CheezOne/pii-detector-cjk-small with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="CheezOne/pii-detector-cjk-small")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("CheezOne/pii-detector-cjk-small") model = AutoModelForTokenClassification.from_pretrained("CheezOne/pii-detector-cjk-small", device_map="auto") - Transformers.js
How to use CheezOne/pii-detector-cjk-small with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('token-classification', 'CheezOne/pii-detector-cjk-small'); - Notebooks
- Google Colab
- Kaggle
Download scripts/make_multilingual_test.py from CheezOne/pii-detector-cjk-small: direct link, hf CLI and curl.
- Browser
- Download file 1.14 kB
-
https://huggingface.co/CheezOne/pii-detector-cjk-small/resolve/main/scripts/make_multilingual_test.py
- Command line
-
hf download hf://CheezOne/pii-detector-cjk-small/scripts/make_multilingual_test.py
-
curl -L -o make_multilingual_test.py https://huggingface.co/CheezOne/pii-detector-cjk-small/resolve/main/scripts/make_multilingual_test.py
1.14 kB
| """Sample N examples per language (all 30 languages) from openpii validation -> multilingual test set. | |
| Gold = the 20 core labels (same convert() as training data). Validation is never used for training. | |
| Usage: python make_multilingual_test.py <openpii_dir> <out.jsonl> --per-lang 150 --seed 7 | |
| """ | |
| import argparse, json, os, random, sys | |
| sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) | |
| from prep_openpii import convert | |
| ap = argparse.ArgumentParser(); ap.add_argument("openpii_dir"); ap.add_argument("out") | |
| ap.add_argument("--per-lang", type=int, default=150); ap.add_argument("--seed", type=int, default=7) | |
| a = ap.parse_args() | |
| by = {} | |
| with open(os.path.join(a.openpii_dir, "data", "validation.jsonl")) as f: | |
| for line in f: | |
| d = json.loads(line); r = convert(d) | |
| if r and r["spans"]: by.setdefault(d["language"], []).append(r) | |
| rng = random.Random(a.seed); out = [] | |
| for l in sorted(by): | |
| rows = by[l]; rng.shuffle(rows); out += rows[: a.per_lang] | |
| rng.shuffle(out) | |
| with open(a.out, "w") as f: | |
| for r in out: f.write(json.dumps(r, ensure_ascii=False) + "\n") | |
| print(len(by), "languages,", len(out), "examples") | |