YakuzaNeko/kr-dlp-ner-roberta-large
0475
Korean DLP NER v3
klue/roberta-large 기반 한국어 개인정보 탐지 모델.
성능
상세 결과: eval_report.txt
탐지 항목
인명, 기관명, 주소, 날짜, 주민등록번호, 외국인등록번호, 사업자등록번호, 전화번호, 계좌번호, 이메일, 카드번호, 차량번호, 운전면허번호, 여권번호.
14개 유형 · BIO 태그 29개.
학습
- 데이터: KLUE NER 26,008문장 + 합성 30,000문장
- 학습/검증/테스트: 8:1:1
- Epochs: 8 · Batch: 32 · Learning rate: 3e-5
- Max length: 128 · BF16 · Seed: 42
사용법
from transformers import AutoTokenizer, AutoModelForTokenClassification
import torch
model_id = "YakuzaNeko/kr-dlp-ner-roberta-large"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForTokenClassification.from_pretrained(model_id).eval()
text = "홍길동님의 운전면허번호는 11-95-255933-61이고 여권번호는 M123A4567입니다."
enc = tok(text, return_offsets_mapping=True, return_tensors="pt")
offsets = enc.pop("offset_mapping")[0].tolist()
with torch.no_grad():
preds = model(**enc).logits.argmax(-1)[0].tolist()
for (s, e), p in zip(offsets, preds):
if s == e:
continue
lbl = model.config.id2label[p]
if lbl != "O":
print(f"{text[s:e]:10s} → {lbl}")