Downloads · 30 days
843
50% of all-time downloads
ssl-jp/pii-ja-ner-onnx
pii-ja-ner-onnx is a token classification model from ssl-jp. Use it when you need labels on individual words, such as names. It is set up for onnxruntime. The card lists the license as apache-2.0.
Downloads · 30 days
843
50% of all-time downloads
All-time downloads
1.7K
Public
Repo size
551 MB
Likes
2
Public
Click a slice to open those files.
.data440 MB · 80%
From the Hugging Face model README
日本語PII(個人識別情報)検出モデルのONNXエクスポート版です。
tohoku-nlp/bert-base-japanese| タイプ | 説明 |
|---|---|
| PERSON_NAME | 氏名 |
| ORGANIZATION_NAME | 組織名 |
| PHONE_NUMBER | 電話番号 |
| メールアドレス | |
| ADDRESS | 住所 |
| MY_NUMBER | マイナンバー |
| PASSPORT_NUMBER | パスポート番号 |
| DRIVER_LICENSE | 運転免許証番号 |
| INSURANCE_NUMBER | 保険証番号 |
| EMPLOYEE_ID | 社員番号 |
| STUDENT_ID | 学籍番号 |
| BANK_ACCOUNT | 銀行口座番号 |
| CREDIT_CARD | クレジットカード番号 |
| DATE_OF_BIRTH | 生年月日 |
| AGE | 年齢 |
| IP_ADDRESS | IPアドレス |
| URL | URL |
| USERNAME | ユーザー名 |
import numpy as np
import onnxruntime as ort
from transformers import AutoTokenizer
# セッション作成
session = ort.InferenceSession("model.onnx")
tokenizer = AutoTokenizer.from_pretrained(".")
# 推論
text = "田中太郎の電話番号は090-1234-5678です。"
inputs = tokenizer(text, return_tensors="np", padding="max_length", max_length=512)
logits = session.run(None, {
"input_ids": inputs["input_ids"],
"attention_mask": inputs["attention_mask"],
})[0]
predictions = np.argmax(logits, axis=-1)
BIOタグ方式(37ラベル): O, B-PERSON_NAME, I-PERSON_NAME, ...
| 入力 | 形状 | 型 |
|---|---|---|
| input_ids | [batch_size, sequence_length] | int64 |
| attention_mask | [batch_size, sequence_length] | int64 |
| 出力 | 形状 | 型 |
|---|---|---|
| logits | [batch_size, sequence_length, 37] | float32 |