Back to Models
LH

LH-Tech-AI/Shield-82M

LH-Tech-AI ‱ general

đŸ›Ąïž Shield 82M

Welcome to Shield 82M, a model designed to filter PII out of texts in any language.

Classes

This model has the following PII classes:

['O', 'ACCOUNTNAME', 'ACCOUNTNUMBER', 'AGE', 'AMOUNT', 'BIC', 'BITCOINADDRESS', 'BUILDINGNUMBER', 'CITY', 'COMPANYNAME', 'COUNTY', 'CREDITCARDCVV', 'CREDITCARDISSUER', 'CREDITCARDNUMBER', 'CURRENCY', 'CURRENCYCODE', 'CURRENCYNAME', 'CURRENCYSYMBOL', 'DATE', 'DOB', 'EMAIL', 'ETHEREUMADDRESS', 'EYECOLOR', 'FIRSTNAME', 'GENDER', 'HEIGHT', 'IBAN', 'IP', 'IPV4', 'IPV6', 'JOBAREA', 'JOBTITLE', 'JOBTYPE', 'LASTNAME', 'LITECOINADDRESS', 'MAC', 'MASKEDNUMBER', 'MIDDLENAME', 'NEARBYGPSCOORDINATE', 'ORDINALDIRECTION', 'PASSWORD', 'PHONEIMEI', 'PHONENUMBER', 'PIN', 'PREFIX', 'SECONDARYADDRESS', 'SEX', 'SSN', 'STATE', 'STREET', 'TIME', 'URL', 'USERAGENT', 'USERNAME', 'VEHICLEVIN', 'VEHICLEVRM', 'ZIPCODE']

Base model

This model is based on distilroberta-base.

Examples

The model has an accuracy score of ~96% (0.961206).
Here are a few examples:

Test with name, email and phone

Original: My name is John Doe. Email: john@example.com. Phone: +49 123 45678.
Protected: My name is [PERSON]. Email: [EMAIL]. Phone: [PHONE].

Basic test

Original: I live in Cambridge
Protected: I live in [ADDRESS]

French test (multilingual)

Original: Mon e-mail est jean.dupont@example.fr et mon téléphone est +33 6 12 34 56 78.
Protected: Mon e-mail est [EMAIL] et mon téléphone est [PHONE].

Quickstart

To use this model, just download use.py from this repo and launch it:

mkdir Shield-82M
cd Shield-82M
wget https://huggingface.co/LH-Tech-AI/Shield-82M/resolve/main/use.py
python3 use.py

This outputs something like:

Loading Shield-82M from LH-Tech-AI/Shield-82M...

Loading weights: 100%
 103/103 [00:00<00:00, 773.65it/s, Materializing param=roberta.encoder.layer.5.output.dense.weight]

Original: My name is John Doe. Email: john@example.com. Phone: +49 123 45678.
Protected: My name is [PERSON]. Email: [EMAIL]. Phone: [PHONE].

To use it with your own text, you'll have to adjust this line of code in use.py:

sample = "My name is John Doe. Email: john@example.com. Phone: +49 123 45678."

Training data

This model was trained on the first 20,000 samples of ai4privacy/pii-masking-200k for 3 epochs.

Training details

The following table shows the training process:

EpochTraining LossValidation LossPrecisionRecallF1Accuracy
11.0482660.2501840.9040650.9328440.9182290.949456
20.2576640.1936140.9395480.9496510.9445720.959521
30.1994250.1817540.9398330.9522150.9459830.961206

You can find the full training code in train.ipynb. Runs on 2x Kaggle T4 in ~7mins.

Visit Website
—

0 reviews

5
0
4
0
3
0
2
0
1
0
Likes4
Downloads—
📝

No reviews yet

Be the first to review LH-Tech-AI/Shield-82M!

Model Info

ProviderLH-Tech-AI
Categorygeneral
Reviews0
Avg. Rating— / 5.0

Community

Likes4
Downloads—

Rating Guidelines

★★★★★Exceptional
★★★★Great
★★★Good
★★Fair
★Poor