SoelMgd commited on
Commit
fc4c5cc
·
verified ·
1 Parent(s): 7e12c1a

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ base_model: distilbert-base-uncased
4
+ tags:
5
+ - token-classification
6
+ - pii
7
+ - privacy
8
+ - personal-information
9
+ - bert
10
+ - distilbert
11
+ language:
12
+ - en
13
+ pipeline_tag: token-classification
14
+ library_name: transformers
15
+ datasets:
16
+ - ai4privacy/pii-masking-200k
17
+ metrics:
18
+ - f1
19
+ - precision
20
+ - recall
21
+ widget:
22
+ - text: "Hi, my name is John Smith and my email is [email protected]"
23
+ example_title: "Example with PII"
24
+ ---
25
+
26
+ # BERT PII Detection Model
27
+
28
+ Fine-tuned DistilBERT model for Personal Identifiable Information (PII) detection and classification.
29
+
30
+ ## Model Details
31
+
32
+ - **Base Model**: `distilbert-base-uncased`
33
+ - **Task**: Token Classification (Named Entity Recognition)
34
+ - **Languages**: English
35
+ - **License**: MIT
36
+ - **Fine-tuned on**: AI4Privacy PII-200k dataset
37
+
38
+ ## Supported PII Entity Types
39
+
40
+ This model can detect 56 different types of PII entities including:
41
+
42
+ **Personal Information:**
43
+ - FIRSTNAME, LASTNAME, MIDDLENAME
44
+ - EMAIL, PHONENUMBER, USERNAME
45
+ - DATE, TIME, DOB, AGE
46
+
47
+ **Address Information:**
48
+ - STREET, CITY, STATE, COUNTY
49
+ - ZIPCODE, BUILDINGNUMBER
50
+ - SECONDARYADDRESS
51
+
52
+ **Financial Information:**
53
+ - CREDITCARDNUMBER, CREDITCARDISSUER, CREDITCARDCVV
54
+ - ACCOUNTNAME, ACCOUNTNUMBER, IBAN, BIC
55
+ - AMOUNT, CURRENCY, CURRENCYCODE, CURRENCYSYMBOL
56
+
57
+ **Identification:**
58
+ - SSN, PIN, PASSWORD
59
+ - IP, IPV4, IPV6, MAC
60
+ - ETHEREUMADDRESS, BITCOINADDRESS, LITECOINADDRESS
61
+
62
+ **Professional Information:**
63
+ - JOBTITLE, JOBTYPE, JOBAREA, COMPANYNAME
64
+
65
+ **And many more...**
66
+
67
+ ## Usage
68
+
69
+ ```python
70
+ from transformers import AutoTokenizer, AutoModelForTokenClassification
71
+ from transformers import pipeline
72
+
73
+ # Load model and tokenizer
74
+ model_name = "SoelMgd/bert-pii-detection"
75
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
76
+ model = AutoModelForTokenClassification.from_pretrained(model_name)
77
+
78
+ # Create NER pipeline
79
+ ner_pipeline = pipeline(
80
+ "ner",
81
+ model=model,
82
+ tokenizer=tokenizer,
83
+ aggregation_strategy="simple"
84
+ )
85
+
86
+ # Example usage
87
+ text = "Hi, my name is John Smith and my email is [email protected]"
88
+ entities = ner_pipeline(text)
89
+ print(entities)
90
+ ```
91
+
92
+ ## Training Data
93
+
94
+ - **Dataset**: AI4Privacy PII-200k
95
+ - **Size**: ~209k examples
96
+ - **Languages**: English, French, German, Italian (this model: English only)
97
+ - **Entity Types**: 56 different PII categories
98
+
99
+ ## Performance
100
+
101
+ The model achieves high performance on PII detection tasks with good precision and recall across different entity types.
102
+
103
+ ## Intended Use
104
+
105
+ This model is designed for:
106
+ - PII detection and masking in text
107
+ - Privacy compliance applications
108
+ - Data anonymization pipelines
109
+ - Content moderation systems
110
+
111
+ ## Limitations
112
+
113
+ - Trained primarily on English text
114
+ - May not generalize to domain-specific jargon
115
+ - Performance may vary on very short or very long texts
116
+ - Should be validated on your specific use case
117
+
118
+ ## Ethical Considerations
119
+
120
+ This model is intended to help protect privacy by identifying PII. Users should:
121
+ - Test thoroughly on their specific data
122
+ - Implement appropriate safeguards
123
+ - Consider the legal requirements in their jurisdiction
124
+ - Be aware that no automated system is 100% accurate
125
+
126
+ ## Citation
127
+
128
+ If you use this model, please cite:
129
+
130
+ ```bibtex
131
+ @misc{bert-pii-detection,
132
+ title={BERT PII Detection Model},
133
+ author={SoelMgd},
134
+ year={2025},
135
+ publisher={Hugging Face},
136
+ url={https://huggingface.co/SoelMgd/bert-pii-detection}
137
+ }
138
+ ```
config.json ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activation": "gelu",
3
+ "architectures": [
4
+ "DistilBertForTokenClassification"
5
+ ],
6
+ "attention_dropout": 0.1,
7
+ "dim": 768,
8
+ "dropout": 0.1,
9
+ "hidden_dim": 3072,
10
+ "id2label": {
11
+ "0": "ACCOUNTNAME",
12
+ "1": "ACCOUNTNUMBER",
13
+ "2": "AGE",
14
+ "3": "AMOUNT",
15
+ "4": "BIC",
16
+ "5": "BITCOINADDRESS",
17
+ "6": "BUILDINGNUMBER",
18
+ "7": "CITY",
19
+ "8": "COMPANYNAME",
20
+ "9": "COUNTY",
21
+ "10": "CREDITCARDCVV",
22
+ "11": "CREDITCARDISSUER",
23
+ "12": "CREDITCARDNUMBER",
24
+ "13": "CURRENCY",
25
+ "14": "CURRENCYCODE",
26
+ "15": "CURRENCYNAME",
27
+ "16": "CURRENCYSYMBOL",
28
+ "17": "DATE",
29
+ "18": "DOB",
30
+ "19": "EMAIL",
31
+ "20": "ETHEREUMADDRESS",
32
+ "21": "EYECOLOR",
33
+ "22": "FIRSTNAME",
34
+ "23": "GENDER",
35
+ "24": "HEIGHT",
36
+ "25": "IBAN",
37
+ "26": "IP",
38
+ "27": "IPV4",
39
+ "28": "IPV6",
40
+ "29": "JOBAREA",
41
+ "30": "JOBTITLE",
42
+ "31": "JOBTYPE",
43
+ "32": "LASTNAME",
44
+ "33": "LITECOINADDRESS",
45
+ "34": "MAC",
46
+ "35": "MASKEDNUMBER",
47
+ "36": "MIDDLENAME",
48
+ "37": "NEARBYGPSCOORDINATE",
49
+ "38": "O",
50
+ "39": "ORDINALDIRECTION",
51
+ "40": "PASSWORD",
52
+ "41": "PHONEIMEI",
53
+ "42": "PHONENUMBER",
54
+ "43": "PIN",
55
+ "44": "PREFIX",
56
+ "45": "SECONDARYADDRESS",
57
+ "46": "SEX",
58
+ "47": "SSN",
59
+ "48": "STATE",
60
+ "49": "STREET",
61
+ "50": "TIME",
62
+ "51": "URL",
63
+ "52": "USERAGENT",
64
+ "53": "USERNAME",
65
+ "54": "VEHICLEVIN",
66
+ "55": "VEHICLEVRM",
67
+ "56": "ZIPCODE"
68
+ },
69
+ "initializer_range": 0.02,
70
+ "label2id": {
71
+ "ACCOUNTNAME": 0,
72
+ "ACCOUNTNUMBER": 1,
73
+ "AGE": 2,
74
+ "AMOUNT": 3,
75
+ "BIC": 4,
76
+ "BITCOINADDRESS": 5,
77
+ "BUILDINGNUMBER": 6,
78
+ "CITY": 7,
79
+ "COMPANYNAME": 8,
80
+ "COUNTY": 9,
81
+ "CREDITCARDCVV": 10,
82
+ "CREDITCARDISSUER": 11,
83
+ "CREDITCARDNUMBER": 12,
84
+ "CURRENCY": 13,
85
+ "CURRENCYCODE": 14,
86
+ "CURRENCYNAME": 15,
87
+ "CURRENCYSYMBOL": 16,
88
+ "DATE": 17,
89
+ "DOB": 18,
90
+ "EMAIL": 19,
91
+ "ETHEREUMADDRESS": 20,
92
+ "EYECOLOR": 21,
93
+ "FIRSTNAME": 22,
94
+ "GENDER": 23,
95
+ "HEIGHT": 24,
96
+ "IBAN": 25,
97
+ "IP": 26,
98
+ "IPV4": 27,
99
+ "IPV6": 28,
100
+ "JOBAREA": 29,
101
+ "JOBTITLE": 30,
102
+ "JOBTYPE": 31,
103
+ "LASTNAME": 32,
104
+ "LITECOINADDRESS": 33,
105
+ "MAC": 34,
106
+ "MASKEDNUMBER": 35,
107
+ "MIDDLENAME": 36,
108
+ "NEARBYGPSCOORDINATE": 37,
109
+ "O": 38,
110
+ "ORDINALDIRECTION": 39,
111
+ "PASSWORD": 40,
112
+ "PHONEIMEI": 41,
113
+ "PHONENUMBER": 42,
114
+ "PIN": 43,
115
+ "PREFIX": 44,
116
+ "SECONDARYADDRESS": 45,
117
+ "SEX": 46,
118
+ "SSN": 47,
119
+ "STATE": 48,
120
+ "STREET": 49,
121
+ "TIME": 50,
122
+ "URL": 51,
123
+ "USERAGENT": 52,
124
+ "USERNAME": 53,
125
+ "VEHICLEVIN": 54,
126
+ "VEHICLEVRM": 55,
127
+ "ZIPCODE": 56
128
+ },
129
+ "max_position_embeddings": 512,
130
+ "model_type": "distilbert",
131
+ "n_heads": 12,
132
+ "n_layers": 6,
133
+ "pad_token_id": 0,
134
+ "qa_dropout": 0.1,
135
+ "seq_classif_dropout": 0.2,
136
+ "sinusoidal_pos_embds": false,
137
+ "tie_weights_": true,
138
+ "torch_dtype": "float32",
139
+ "transformers_version": "4.52.4",
140
+ "vocab_size": 30522
141
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:49023596d0378adbb3ea9e52bf4085c7d0c3dcc594397ab72b65594d8086cbd1
3
+ size 265639204
special_tokens_map.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "cls_token": "[CLS]",
3
+ "mask_token": "[MASK]",
4
+ "pad_token": "[PAD]",
5
+ "sep_token": "[SEP]",
6
+ "unk_token": "[UNK]"
7
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "[PAD]",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "100": {
12
+ "content": "[UNK]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "101": {
20
+ "content": "[CLS]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "102": {
28
+ "content": "[SEP]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "103": {
36
+ "content": "[MASK]",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ }
43
+ },
44
+ "clean_up_tokenization_spaces": false,
45
+ "cls_token": "[CLS]",
46
+ "do_lower_case": true,
47
+ "extra_special_tokens": {},
48
+ "mask_token": "[MASK]",
49
+ "model_max_length": 512,
50
+ "pad_token": "[PAD]",
51
+ "sep_token": "[SEP]",
52
+ "strip_accents": null,
53
+ "tokenize_chinese_chars": true,
54
+ "tokenizer_class": "DistilBertTokenizer",
55
+ "unk_token": "[UNK]"
56
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c7d1ec4cf7dcd7328946a00f36d8589b1df61b1b2703a5bcff0f4dec4158c02c
3
+ size 5240
vocab.txt ADDED
The diff for this file is too large to render. See raw diff