🚀 PII検出モデル - Phi3 Mini ファインチューニング版
このリポジトリには、個人情報(PII)を検出するためにファインチューニングされたPhi3 Miniモデルが含まれています。このモデルは、テキスト内の様々なPIIエンティティを認識するように特別に訓練されており、データの編集、プライバシー保護、およびデータ保護規制への準拠などのタスクに強力なツールとなります。
✨ 主な機能
モデル概要
モデルアーキテクチャ
検出されるPIIエンティティ
このモデルは、以下のPIIエンティティを検出することができます。
-
個人情報:
firstname
middlename
lastname
sex
dob
(生年月日)
age
gender
height
eyecolor
-
連絡先情報:
email
phonenumber
url
username
useragent
-
住所情報:
street
city
state
county
zipcode
country
secondaryaddress
buildingnumber
ordinaldirection
-
地理情報:
-
組織情報:
companyname
jobtitle
jobarea
jobtype
-
財務情報:
accountname
accountnumber
creditcardnumber
creditcardcvv
creditcardissuer
iban
bic
currency
currencyname
currencysymbol
currencycode
amount
-
一意の識別子:
pin
ssn
imei
(携帯電話のIMEI)
mac
(MACアドレス)
vehiclevin
(車両のVIN)
vehiclevrm
(車両のVRM)
-
暗号通貨情報:
bitcoinaddress
litecoinaddress
ethereumaddress
-
その他の情報:
ip
(IPアドレス)
ipv4
ipv6
maskednumber
password
time
ordinaldirection
prefix
📚 ドキュメント
プロンプト形式
テキスト内に存在する場合、以下のPIIエンティティを識別して抽出してください: companyname, pin, currencyname, email, phoneimei, litecoinaddress, currency, eyecolor, street, mac, state, time, vehiclevin, jobarea, date, bic, currencysymbol, currencycode, age, nearbygpscoordinate, amount, ssn, ethereumaddress, zipcode, buildingnumber, dob, firstname, middlename, ordinaldirection, jobtitle, bitcoinaddress, jobtype, phonenumber, height, password, ip, useragent, accountname, city, gender, secondaryaddress, iban, sex, prefix, ipv4, maskednumber, url, username, lastname, creditcardcvv, county, vehiclevrm, ipv6, creditcardissuer, accountnumber, creditcardnumber。出力をJSON形式で返してください。
Greetings, Mason! Let's celebrate another year of wellness on 14/01/1977. Don't miss the event at 176,Apt. 388.
📦 インストール
このモデルを使用するには、transformers
ライブラリをインストールする必要があります。
pip install transformers
💻 使用例
基本的な使用法
from transformers import AutoTokenizer, AutoModelForTokenClassification
tokenizer = AutoTokenizer.from_pretrained("ab-ai/PII-Model-Phi3-Mini")
model = AutoModelForTokenClassification.from_pretrained("ab-ai/PII-Model-Phi3-Mini")
input_text = "Hi Abner, just a reminder that your next primary care appointment is on 23/03/1926. Please confirm by replying to this email Nathen15@hotmail.com."
model_prompt = f"""### Instruction:
テキスト内に存在する場合、以下のPIIエンティティを識別して抽出してください: companyname, pin, currencyname, email, phoneimei, litecoinaddress, currency, eyecolor, street, mac, state, time, vehiclevin, jobarea, date, bic, currencysymbol, currencycode, age, nearbygpscoordinate, amount, ssn, ethereumaddress, zipcode, buildingnumber, dob, firstname, middlename, ordinaldirection, jobtitle, bitcoinaddress, jobtype, phonenumber, height, password, ip, useragent, accountname, city, gender, secondaryaddress, iban, sex, prefix, ipv4, maskednumber, url, username, lastname, creditcardcvv, county, vehiclevrm, ipv6, creditcardissuer, accountnumber, creditcardnumber。出力をJSON形式で返してください。
### Input:
{input_text}
### Output: """
inputs = tokenizer(model_prompt, return_tensors="pt").to(device)
outputs = model.generate(**inputs, do_sample=True, max_new_tokens=120)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
📄 ライセンス
このプロジェクトはMITライセンスの下で公開されています。