基于规则的轻量级 PII 检测模型,结构完全兼容 transformers。
加载时需要 trust_remote_code=True。
from transformers import AutoTokenizer, AutoModelForTokenClassification
tokenizer = AutoTokenizer.from_pretrained("albert-bi-work/pii-rule-model", trust_remote_code=True)
model = AutoModelForTokenClassification.from_pretrained("albert-bi-work/pii-rule-model", trust_remote_code=True)
print(model.detect(["张三的手机号是13812345678,邮箱 zhangsan@example.com"]))
支持的实体: PERSON, EMAIL, PHONE, ID_CARD, CREDIT_CARD, ADDRESS, IPV4
model.safetensors 1 MBtraining_args.bin 5.3 kB