Upload folder using huggingface_hub
Browse files- README.md +86 -0
- config.json +52 -0
- labels.json +29 -0
- merges.txt +0 -0
- model.onnx +3 -0
- special_tokens_map.json +51 -0
- tokenizer.json +0 -0
- tokenizer_config.json +58 -0
- vocab.json +0 -0
README.md
CHANGED
|
@@ -1,3 +1,89 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
base_model: tanaos/tanaos-text-anonymizer-v1
|
| 4 |
+
tags:
|
| 5 |
+
- ner
|
| 6 |
+
- pii
|
| 7 |
+
- onnx
|
| 8 |
+
- token-classification
|
| 9 |
+
- named-entity-recognition
|
| 10 |
+
language:
|
| 11 |
+
- en
|
| 12 |
+
library_name: onnx
|
| 13 |
---
|
| 14 |
+
|
| 15 |
+
# RuleSentry Core PII
|
| 16 |
+
|
| 17 |
+
ONNX export of [tanaos/tanaos-text-anonymizer-v1](https://huggingface.co/tanaos/tanaos-text-anonymizer-v1) for local PII detection in RuleSentry Desktop.
|
| 18 |
+
|
| 19 |
+
## Attribution
|
| 20 |
+
|
| 21 |
+
This model is an ONNX conversion of **tanaos-text-anonymizer-v1** by [tanaos](https://huggingface.co/tanaos).
|
| 22 |
+
We converted it to ONNX format for efficient CPU/GPU inference without Python dependencies.
|
| 23 |
+
|
| 24 |
+
Original model: https://huggingface.co/tanaos/tanaos-text-anonymizer-v1
|
| 25 |
+
|
| 26 |
+
## Supported Entity Types
|
| 27 |
+
|
| 28 |
+
| Entity | Example |
|
| 29 |
+
|--------|---------|
|
| 30 |
+
| PERSON | "John Douglas" |
|
| 31 |
+
| LOCATION | "New York" |
|
| 32 |
+
| DATE | "January 15, 2024" |
|
| 33 |
+
| ADDRESS | "123 Main St, Suite 400" |
|
| 34 |
+
| PHONE_NUMBER | "(555) 123-4567" |
|
| 35 |
+
|
| 36 |
+
## Model Files
|
| 37 |
+
|
| 38 |
+
- `model.onnx` - ONNX model (~496 MB)
|
| 39 |
+
- `tokenizer.json` - Tokenizer configuration
|
| 40 |
+
- `config.json` - Model configuration
|
| 41 |
+
- `labels.json` - NER label mappings
|
| 42 |
+
- `vocab.json` - Vocabulary
|
| 43 |
+
- `merges.txt` - BPE merges
|
| 44 |
+
|
| 45 |
+
## Usage
|
| 46 |
+
|
| 47 |
+
This model is designed for use with [RuleSentry Desktop](https://rulesentry.com) for local, privacy-preserving document anonymization.
|
| 48 |
+
|
| 49 |
+
### With ONNX Runtime (Rust)
|
| 50 |
+
|
| 51 |
+
```rust
|
| 52 |
+
use ort::{Session, SessionBuilder};
|
| 53 |
+
|
| 54 |
+
let session = SessionBuilder::new()?
|
| 55 |
+
.with_model_from_file("model.onnx")?;
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
### With ONNX Runtime (Python)
|
| 59 |
+
|
| 60 |
+
```python
|
| 61 |
+
import onnxruntime as ort
|
| 62 |
+
|
| 63 |
+
session = ort.InferenceSession("model.onnx")
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
## License
|
| 67 |
+
|
| 68 |
+
MIT License - Same as the original model.
|
| 69 |
+
|
| 70 |
+
Copyright (c) 2024 tanaos (original model)
|
| 71 |
+
Copyright (c) 2024 RuleSentry (ONNX conversion)
|
| 72 |
+
|
| 73 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 74 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 75 |
+
in the Software without restriction, including without limitation the rights
|
| 76 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 77 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 78 |
+
furnished to do so, subject to the following conditions:
|
| 79 |
+
|
| 80 |
+
The above copyright notice and this permission notice shall be included in all
|
| 81 |
+
copies or substantial portions of the Software.
|
| 82 |
+
|
| 83 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 84 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 85 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 86 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 87 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 88 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 89 |
+
SOFTWARE.
|
config.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"RobertaForTokenClassification"
|
| 4 |
+
],
|
| 5 |
+
"attention_probs_dropout_prob": 0.1,
|
| 6 |
+
"bos_token_id": 0,
|
| 7 |
+
"classifier_dropout": null,
|
| 8 |
+
"dtype": "float32",
|
| 9 |
+
"eos_token_id": 2,
|
| 10 |
+
"hidden_act": "gelu",
|
| 11 |
+
"hidden_dropout_prob": 0.1,
|
| 12 |
+
"hidden_size": 768,
|
| 13 |
+
"id2label": {
|
| 14 |
+
"0": "O",
|
| 15 |
+
"1": "B-PERSON",
|
| 16 |
+
"2": "I-PERSON",
|
| 17 |
+
"3": "B-LOCATION",
|
| 18 |
+
"4": "I-LOCATION",
|
| 19 |
+
"5": "B-DATE",
|
| 20 |
+
"6": "I-DATE",
|
| 21 |
+
"7": "B-ADDRESS",
|
| 22 |
+
"8": "I-ADDRESS",
|
| 23 |
+
"9": "B-PHONE_NUMBER",
|
| 24 |
+
"10": "I-PHONE_NUMBER"
|
| 25 |
+
},
|
| 26 |
+
"initializer_range": 0.02,
|
| 27 |
+
"intermediate_size": 3072,
|
| 28 |
+
"label2id": {
|
| 29 |
+
"B-ADDRESS": 7,
|
| 30 |
+
"B-DATE": 5,
|
| 31 |
+
"B-LOCATION": 3,
|
| 32 |
+
"B-PERSON": 1,
|
| 33 |
+
"B-PHONE_NUMBER": 9,
|
| 34 |
+
"I-ADDRESS": 8,
|
| 35 |
+
"I-DATE": 6,
|
| 36 |
+
"I-LOCATION": 4,
|
| 37 |
+
"I-PERSON": 2,
|
| 38 |
+
"I-PHONE_NUMBER": 10,
|
| 39 |
+
"O": 0
|
| 40 |
+
},
|
| 41 |
+
"layer_norm_eps": 1e-05,
|
| 42 |
+
"max_position_embeddings": 514,
|
| 43 |
+
"model_type": "roberta",
|
| 44 |
+
"num_attention_heads": 12,
|
| 45 |
+
"num_hidden_layers": 12,
|
| 46 |
+
"pad_token_id": 1,
|
| 47 |
+
"position_embedding_type": "absolute",
|
| 48 |
+
"transformers_version": "4.57.3",
|
| 49 |
+
"type_vocab_size": 1,
|
| 50 |
+
"use_cache": true,
|
| 51 |
+
"vocab_size": 50265
|
| 52 |
+
}
|
labels.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"id2label": {
|
| 3 |
+
"0": "O",
|
| 4 |
+
"1": "B-PERSON",
|
| 5 |
+
"2": "I-PERSON",
|
| 6 |
+
"3": "B-LOCATION",
|
| 7 |
+
"4": "I-LOCATION",
|
| 8 |
+
"5": "B-DATE",
|
| 9 |
+
"6": "I-DATE",
|
| 10 |
+
"7": "B-ADDRESS",
|
| 11 |
+
"8": "I-ADDRESS",
|
| 12 |
+
"9": "B-PHONE_NUMBER",
|
| 13 |
+
"10": "I-PHONE_NUMBER"
|
| 14 |
+
},
|
| 15 |
+
"label2id": {
|
| 16 |
+
"B-ADDRESS": 7,
|
| 17 |
+
"B-DATE": 5,
|
| 18 |
+
"B-LOCATION": 3,
|
| 19 |
+
"B-PERSON": 1,
|
| 20 |
+
"B-PHONE_NUMBER": 9,
|
| 21 |
+
"I-ADDRESS": 8,
|
| 22 |
+
"I-DATE": 6,
|
| 23 |
+
"I-LOCATION": 4,
|
| 24 |
+
"I-PERSON": 2,
|
| 25 |
+
"I-PHONE_NUMBER": 10,
|
| 26 |
+
"O": 0
|
| 27 |
+
},
|
| 28 |
+
"num_labels": 11
|
| 29 |
+
}
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:899cc2182bd85af25cb7d38b11500c5558e7648ffff63904996dfb21d50d0f06
|
| 3 |
+
size 496476397
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": true,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"cls_token": {
|
| 10 |
+
"content": "<s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": true,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"eos_token": {
|
| 17 |
+
"content": "</s>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": true,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"mask_token": {
|
| 24 |
+
"content": "<mask>",
|
| 25 |
+
"lstrip": true,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
},
|
| 30 |
+
"pad_token": {
|
| 31 |
+
"content": "<pad>",
|
| 32 |
+
"lstrip": false,
|
| 33 |
+
"normalized": true,
|
| 34 |
+
"rstrip": false,
|
| 35 |
+
"single_word": false
|
| 36 |
+
},
|
| 37 |
+
"sep_token": {
|
| 38 |
+
"content": "</s>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": true,
|
| 41 |
+
"rstrip": false,
|
| 42 |
+
"single_word": false
|
| 43 |
+
},
|
| 44 |
+
"unk_token": {
|
| 45 |
+
"content": "<unk>",
|
| 46 |
+
"lstrip": false,
|
| 47 |
+
"normalized": true,
|
| 48 |
+
"rstrip": false,
|
| 49 |
+
"single_word": false
|
| 50 |
+
}
|
| 51 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"added_tokens_decoder": {
|
| 4 |
+
"0": {
|
| 5 |
+
"content": "<s>",
|
| 6 |
+
"lstrip": false,
|
| 7 |
+
"normalized": true,
|
| 8 |
+
"rstrip": false,
|
| 9 |
+
"single_word": false,
|
| 10 |
+
"special": true
|
| 11 |
+
},
|
| 12 |
+
"1": {
|
| 13 |
+
"content": "<pad>",
|
| 14 |
+
"lstrip": false,
|
| 15 |
+
"normalized": true,
|
| 16 |
+
"rstrip": false,
|
| 17 |
+
"single_word": false,
|
| 18 |
+
"special": true
|
| 19 |
+
},
|
| 20 |
+
"2": {
|
| 21 |
+
"content": "</s>",
|
| 22 |
+
"lstrip": false,
|
| 23 |
+
"normalized": true,
|
| 24 |
+
"rstrip": false,
|
| 25 |
+
"single_word": false,
|
| 26 |
+
"special": true
|
| 27 |
+
},
|
| 28 |
+
"3": {
|
| 29 |
+
"content": "<unk>",
|
| 30 |
+
"lstrip": false,
|
| 31 |
+
"normalized": true,
|
| 32 |
+
"rstrip": false,
|
| 33 |
+
"single_word": false,
|
| 34 |
+
"special": true
|
| 35 |
+
},
|
| 36 |
+
"50264": {
|
| 37 |
+
"content": "<mask>",
|
| 38 |
+
"lstrip": true,
|
| 39 |
+
"normalized": false,
|
| 40 |
+
"rstrip": false,
|
| 41 |
+
"single_word": false,
|
| 42 |
+
"special": true
|
| 43 |
+
}
|
| 44 |
+
},
|
| 45 |
+
"bos_token": "<s>",
|
| 46 |
+
"clean_up_tokenization_spaces": false,
|
| 47 |
+
"cls_token": "<s>",
|
| 48 |
+
"eos_token": "</s>",
|
| 49 |
+
"errors": "replace",
|
| 50 |
+
"extra_special_tokens": {},
|
| 51 |
+
"mask_token": "<mask>",
|
| 52 |
+
"model_max_length": 512,
|
| 53 |
+
"pad_token": "<pad>",
|
| 54 |
+
"sep_token": "</s>",
|
| 55 |
+
"tokenizer_class": "RobertaTokenizer",
|
| 56 |
+
"trim_offsets": true,
|
| 57 |
+
"unk_token": "<unk>"
|
| 58 |
+
}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|