Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- LICENSE +17 -0
- README.md +87 -3
- config.json +121 -0
- model.safetensors +3 -0
- model_card.md +27 -0
- tokenizer.json +3 -0
- tokenizer_config.json +13 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
LICENSE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
Copyright 2026 SAGEA / Basab Jha
|
| 6 |
+
|
| 7 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 8 |
+
you may not use this file except in compliance with the License.
|
| 9 |
+
You may obtain a copy of the License at
|
| 10 |
+
|
| 11 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 12 |
+
|
| 13 |
+
Unless required by applicable law or agreed to in writing, software
|
| 14 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 15 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 16 |
+
See the License for the specific language governing permissions and
|
| 17 |
+
limitations under the License.
|
README.md
CHANGED
|
@@ -1,3 +1,87 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
--
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Tegmen
|
| 2 |
+
|
| 3 |
+
A high-performance on-premise PII detection and masking solution
|
| 4 |
+
|
| 5 |
+
## Overview
|
| 6 |
+
|
| 7 |
+
Tegmen is a production-ready token classification system designed for identifying and masking personally identifiable information (PII) in text data. Built for high-throughput data sanitization workflows, it offers on-premise deployment capabilities with enterprise-grade performance.
|
| 8 |
+
|
| 9 |
+
## Key Features
|
| 10 |
+
|
| 11 |
+
- **On-Premise Deployment**: Run entirely within your infrastructure
|
| 12 |
+
- **Lightweight Architecture**: Optimized for edge deployment
|
| 13 |
+
- **Fine-Tunable**: Easily adapt to your specific data distributions
|
| 14 |
+
- **Long Context Support**: Process documents up to 128,000 tokens
|
| 15 |
+
- **Configurable Detection**: Tune precision/recall tradeoffs
|
| 16 |
+
|
| 17 |
+
## Supported PII Categories
|
| 18 |
+
|
| 19 |
+
The model detects 8 categories of sensitive information:
|
| 20 |
+
|
| 21 |
+
| Category | Description |
|
| 22 |
+
|----------|-------------|
|
| 23 |
+
| `account_number` | Financial account identifiers |
|
| 24 |
+
| `private_address` | Physical and mailing addresses |
|
| 25 |
+
| `private_email` | Email addresses |
|
| 26 |
+
| `private_person` | Personal names |
|
| 27 |
+
| `private_phone` | Phone numbers |
|
| 28 |
+
| `private_url` | URLs and web addresses |
|
| 29 |
+
| `private_date` | Birth dates and personal dates |
|
| 30 |
+
| `secret` | API keys, passwords, credentials |
|
| 31 |
+
|
| 32 |
+
## Installation
|
| 33 |
+
|
| 34 |
+
```bash
|
| 35 |
+
pip install transformers torch
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
## Quick Start
|
| 39 |
+
|
| 40 |
+
### Using the Pipeline API
|
| 41 |
+
|
| 42 |
+
```python
|
| 43 |
+
from transformers import pipeline
|
| 44 |
+
|
| 45 |
+
detector = pipeline("token-classification", model="comethrusws/tegmen", aggregation_strategy="simple")
|
| 46 |
+
|
| 47 |
+
text = "Contact John Smith at john.smith@email.com"
|
| 48 |
+
results = detector(text)
|
| 49 |
+
|
| 50 |
+
for item in results:
|
| 51 |
+
print(f"Found: {item['word']} ({item['entity_group']})")
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
### Using the Model Directly
|
| 55 |
+
|
| 56 |
+
```python
|
| 57 |
+
import torch
|
| 58 |
+
from transformers import AutoModelForTokenClassification, AutoTokenizer
|
| 59 |
+
|
| 60 |
+
tokenizer = AutoTokenizer.from_pretrained("comethrusws/tegmen")
|
| 61 |
+
model = AutoModelForTokenClassification.from_pretrained("comethrusws/tegmen")
|
| 62 |
+
|
| 63 |
+
text = "My name is Alice and my email is alice@example.com"
|
| 64 |
+
inputs = tokenizer(text, return_tensors="pt")
|
| 65 |
+
|
| 66 |
+
with torch.no_grad():
|
| 67 |
+
outputs = model(**inputs)
|
| 68 |
+
|
| 69 |
+
predictions = outputs.logits.argmax(dim=-1)
|
| 70 |
+
labels = [model.config.id2label[p.item()] for p in predictions[0]]
|
| 71 |
+
print(labels)
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
## Performance Specifications
|
| 75 |
+
|
| 76 |
+
- **Architecture**: Transformer encoder
|
| 77 |
+
- **Parameters**: 1.5B total / 50M active
|
| 78 |
+
- **Context Window**: 128,000 tokens
|
| 79 |
+
- **Output Format**: BIOES span tagging
|
| 80 |
+
|
| 81 |
+
## License
|
| 82 |
+
|
| 83 |
+
Apache License 2.0
|
| 84 |
+
|
| 85 |
+
## Support
|
| 86 |
+
|
| 87 |
+
For enterprise support, contact SAGEA.
|
config.json
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"OpenAIPrivacyFilterForTokenClassification"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": true,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": null,
|
| 8 |
+
"classifier_dropout": 0.0,
|
| 9 |
+
"default_n_ctx": 128000,
|
| 10 |
+
"dtype": "bfloat16",
|
| 11 |
+
"eos_token_id": 199999,
|
| 12 |
+
"head_dim": 64,
|
| 13 |
+
"hidden_act": "silu",
|
| 14 |
+
"hidden_size": 640,
|
| 15 |
+
"id2label": {
|
| 16 |
+
"0": "O",
|
| 17 |
+
"1": "B-account_number",
|
| 18 |
+
"2": "I-account_number",
|
| 19 |
+
"3": "E-account_number",
|
| 20 |
+
"4": "S-account_number",
|
| 21 |
+
"5": "B-private_address",
|
| 22 |
+
"6": "I-private_address",
|
| 23 |
+
"7": "E-private_address",
|
| 24 |
+
"8": "S-private_address",
|
| 25 |
+
"9": "B-private_date",
|
| 26 |
+
"10": "I-private_date",
|
| 27 |
+
"11": "E-private_date",
|
| 28 |
+
"12": "S-private_date",
|
| 29 |
+
"13": "B-private_email",
|
| 30 |
+
"14": "I-private_email",
|
| 31 |
+
"15": "E-private_email",
|
| 32 |
+
"16": "S-private_email",
|
| 33 |
+
"17": "B-private_person",
|
| 34 |
+
"18": "I-private_person",
|
| 35 |
+
"19": "E-private_person",
|
| 36 |
+
"20": "S-private_person",
|
| 37 |
+
"21": "B-private_phone",
|
| 38 |
+
"22": "I-private_phone",
|
| 39 |
+
"23": "E-private_phone",
|
| 40 |
+
"24": "S-private_phone",
|
| 41 |
+
"25": "B-private_url",
|
| 42 |
+
"26": "I-private_url",
|
| 43 |
+
"27": "E-private_url",
|
| 44 |
+
"28": "S-private_url",
|
| 45 |
+
"29": "B-secret",
|
| 46 |
+
"30": "I-secret",
|
| 47 |
+
"31": "E-secret",
|
| 48 |
+
"32": "S-secret"
|
| 49 |
+
},
|
| 50 |
+
"initial_context_length": 4096,
|
| 51 |
+
"initializer_range": 0.02,
|
| 52 |
+
"intermediate_size": 640,
|
| 53 |
+
"label2id": {
|
| 54 |
+
"B-account_number": 1,
|
| 55 |
+
"B-private_address": 5,
|
| 56 |
+
"B-private_date": 9,
|
| 57 |
+
"B-private_email": 13,
|
| 58 |
+
"B-private_person": 17,
|
| 59 |
+
"B-private_phone": 21,
|
| 60 |
+
"B-private_url": 25,
|
| 61 |
+
"B-secret": 29,
|
| 62 |
+
"E-account_number": 3,
|
| 63 |
+
"E-private_address": 7,
|
| 64 |
+
"E-private_date": 11,
|
| 65 |
+
"E-private_email": 15,
|
| 66 |
+
"E-private_person": 19,
|
| 67 |
+
"E-private_phone": 23,
|
| 68 |
+
"E-private_url": 27,
|
| 69 |
+
"E-secret": 31,
|
| 70 |
+
"I-account_number": 2,
|
| 71 |
+
"I-private_address": 6,
|
| 72 |
+
"I-private_date": 10,
|
| 73 |
+
"I-private_email": 14,
|
| 74 |
+
"I-private_person": 18,
|
| 75 |
+
"I-private_phone": 22,
|
| 76 |
+
"I-private_url": 26,
|
| 77 |
+
"I-secret": 30,
|
| 78 |
+
"O": 0,
|
| 79 |
+
"S-account_number": 4,
|
| 80 |
+
"S-private_address": 8,
|
| 81 |
+
"S-private_date": 12,
|
| 82 |
+
"S-private_email": 16,
|
| 83 |
+
"S-private_person": 20,
|
| 84 |
+
"S-private_phone": 24,
|
| 85 |
+
"S-private_url": 28,
|
| 86 |
+
"S-secret": 32
|
| 87 |
+
},
|
| 88 |
+
"max_position_embeddings": 131072,
|
| 89 |
+
"model_type": "pii-detector",
|
| 90 |
+
"num_attention_heads": 14,
|
| 91 |
+
"num_experts_per_tok": 4,
|
| 92 |
+
"num_hidden_layers": 8,
|
| 93 |
+
"num_key_value_heads": 2,
|
| 94 |
+
"num_local_experts": 128,
|
| 95 |
+
"output_router_logits": false,
|
| 96 |
+
"pad_token_id": 199999,
|
| 97 |
+
"rms_norm_eps": 1e-05,
|
| 98 |
+
"rope_parameters": {
|
| 99 |
+
"beta_fast": 32.0,
|
| 100 |
+
"beta_slow": 1.0,
|
| 101 |
+
"factor": 32.0,
|
| 102 |
+
"original_max_position_embeddings": 4096,
|
| 103 |
+
"rope_theta": 150000.0,
|
| 104 |
+
"rope_type": "yarn",
|
| 105 |
+
"truncate": false
|
| 106 |
+
},
|
| 107 |
+
"router_aux_loss_coef": 0.001,
|
| 108 |
+
"sliding_window": 128,
|
| 109 |
+
"tie_word_embeddings": false,
|
| 110 |
+
"transformers.js_config": {
|
| 111 |
+
"use_external_data_format": {
|
| 112 |
+
"model": 1,
|
| 113 |
+
"model.onnx": 3,
|
| 114 |
+
"model_fp16.onnx": 2
|
| 115 |
+
}
|
| 116 |
+
},
|
| 117 |
+
"transformers_version": "5.10.1",
|
| 118 |
+
"use_cache": true,
|
| 119 |
+
"vocab_size": 200064,
|
| 120 |
+
"_name_or_path": "comethrusws/tegmen"
|
| 121 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:06f66b87650b988b04e218285f9fe3df6a4943416b6ffa8171f07bc56cf12a9d
|
| 3 |
+
size 2798989498
|
model_card.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
library_name: transformers
|
| 5 |
+
tags:
|
| 6 |
+
- token-classification
|
| 7 |
+
- pii-detection
|
| 8 |
+
- privacy
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# Tegmen Model Card
|
| 12 |
+
|
| 13 |
+
## Model Details
|
| 14 |
+
|
| 15 |
+
**Model Type:** Bidirectional token classification
|
| 16 |
+
**Parameters:** 1.5B total / 50M active
|
| 17 |
+
**Context Length:** 128,000 tokens
|
| 18 |
+
|
| 19 |
+
## Intended Use
|
| 20 |
+
|
| 21 |
+
- Data sanitization workflows
|
| 22 |
+
- Compliance aid for privacy regulations
|
| 23 |
+
- On-premise PII detection
|
| 24 |
+
|
| 25 |
+
## Limitations
|
| 26 |
+
|
| 27 |
+
This tool should be used as part of a comprehensive privacy-by-design approach.
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0614fe83cadab421296e664e1f48f4261fa8fef6e03e63bb75c20f38e37d07d3
|
| 3 |
+
size 27868174
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"eos_token": "<|endoftext|>",
|
| 4 |
+
"is_local": false,
|
| 5 |
+
"local_files_only": false,
|
| 6 |
+
"model_input_names": [
|
| 7 |
+
"input_ids",
|
| 8 |
+
"attention_mask"
|
| 9 |
+
],
|
| 10 |
+
"model_max_length": 128000,
|
| 11 |
+
"pad_token": "<|endoftext|>",
|
| 12 |
+
"tokenizer_class": "TokenizersBackend"
|
| 13 |
+
}
|