Upload bert-chinese-ner-onnx model for LLM Guard
Browse files- README.md +39 -0
- config.json +93 -0
- model.onnx +3 -0
- special_tokens_map.json +7 -0
- tokenizer.json +0 -0
- tokenizer_config.json +60 -0
- vocab.txt +0 -0
README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
library_name: transformers
|
| 4 |
+
tags:
|
| 5 |
+
- llm-guard
|
| 6 |
+
- security
|
| 7 |
+
- onnx
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# bert-chinese-ner-onnx
|
| 11 |
+
|
| 12 |
+
This is an ONNX model used by LLM Guard for security scanning.
|
| 13 |
+
|
| 14 |
+
Original model source: `ProtectAI/gyr66-bert-base-chinese-finetuned-ner-onnx`
|
| 15 |
+
|
| 16 |
+
## Usage
|
| 17 |
+
|
| 18 |
+
This model is used automatically by the LLM Guard library. Install LLM Guard:
|
| 19 |
+
|
| 20 |
+
```bash
|
| 21 |
+
pip install llm-guard
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
The model will be downloaded automatically when the corresponding scanner is used.
|
| 25 |
+
|
| 26 |
+
## About LLM Guard
|
| 27 |
+
|
| 28 |
+
LLM Guard is a comprehensive security toolkit for Large Language Models, providing:
|
| 29 |
+
- Prompt injection detection
|
| 30 |
+
- PII detection and anonymization
|
| 31 |
+
- Toxicity filtering
|
| 32 |
+
- Bias detection
|
| 33 |
+
- And more security features
|
| 34 |
+
|
| 35 |
+
Repository: https://github.com/akto-api-security/llm-guard
|
| 36 |
+
|
| 37 |
+
## License
|
| 38 |
+
|
| 39 |
+
MIT License - See the original model repository for specific licensing details.
|
config.json
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "gyr66/bert-base-chinese-finetuned-ner",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"BertForTokenClassification"
|
| 5 |
+
],
|
| 6 |
+
"attention_probs_dropout_prob": 0.1,
|
| 7 |
+
"classifier_dropout": null,
|
| 8 |
+
"directionality": "bidi",
|
| 9 |
+
"hidden_act": "gelu",
|
| 10 |
+
"hidden_dropout_prob": 0.1,
|
| 11 |
+
"hidden_size": 768,
|
| 12 |
+
"id2label": {
|
| 13 |
+
"0": "O",
|
| 14 |
+
"1": "B-position",
|
| 15 |
+
"2": "I-position",
|
| 16 |
+
"3": "B-name",
|
| 17 |
+
"4": "I-name",
|
| 18 |
+
"5": "B-movie",
|
| 19 |
+
"6": "I-movie",
|
| 20 |
+
"7": "B-organization",
|
| 21 |
+
"8": "I-organization",
|
| 22 |
+
"9": "B-company",
|
| 23 |
+
"10": "I-company",
|
| 24 |
+
"11": "B-book",
|
| 25 |
+
"12": "I-book",
|
| 26 |
+
"13": "B-address",
|
| 27 |
+
"14": "I-address",
|
| 28 |
+
"15": "B-scene",
|
| 29 |
+
"16": "I-scene",
|
| 30 |
+
"17": "B-mobile",
|
| 31 |
+
"18": "I-mobile",
|
| 32 |
+
"19": "B-email",
|
| 33 |
+
"20": "I-email",
|
| 34 |
+
"21": "B-game",
|
| 35 |
+
"22": "I-game",
|
| 36 |
+
"23": "B-government",
|
| 37 |
+
"24": "I-government",
|
| 38 |
+
"25": "B-QQ",
|
| 39 |
+
"26": "I-QQ",
|
| 40 |
+
"27": "B-vx",
|
| 41 |
+
"28": "I-vx"
|
| 42 |
+
},
|
| 43 |
+
"initializer_range": 0.02,
|
| 44 |
+
"intermediate_size": 3072,
|
| 45 |
+
"label2id": {
|
| 46 |
+
"B-QQ": "25",
|
| 47 |
+
"B-address": "13",
|
| 48 |
+
"B-book": "11",
|
| 49 |
+
"B-company": "9",
|
| 50 |
+
"B-email": "19",
|
| 51 |
+
"B-game": "21",
|
| 52 |
+
"B-government": "23",
|
| 53 |
+
"B-mobile": "17",
|
| 54 |
+
"B-movie": "5",
|
| 55 |
+
"B-name": "3",
|
| 56 |
+
"B-organization": "7",
|
| 57 |
+
"B-position": "1",
|
| 58 |
+
"B-scene": "15",
|
| 59 |
+
"B-vx": "27",
|
| 60 |
+
"I-QQ": "26",
|
| 61 |
+
"I-address": "14",
|
| 62 |
+
"I-book": "12",
|
| 63 |
+
"I-company": "10",
|
| 64 |
+
"I-email": "20",
|
| 65 |
+
"I-game": "22",
|
| 66 |
+
"I-government": "24",
|
| 67 |
+
"I-mobile": "18",
|
| 68 |
+
"I-movie": "6",
|
| 69 |
+
"I-name": "4",
|
| 70 |
+
"I-organization": "8",
|
| 71 |
+
"I-position": "2",
|
| 72 |
+
"I-scene": "16",
|
| 73 |
+
"I-vx": "28",
|
| 74 |
+
"O": "0"
|
| 75 |
+
},
|
| 76 |
+
"layer_norm_eps": 1e-12,
|
| 77 |
+
"max_position_embeddings": 512,
|
| 78 |
+
"model_type": "bert",
|
| 79 |
+
"num_attention_heads": 12,
|
| 80 |
+
"num_hidden_layers": 12,
|
| 81 |
+
"pad_token_id": 0,
|
| 82 |
+
"pooler_fc_size": 768,
|
| 83 |
+
"pooler_num_attention_heads": 12,
|
| 84 |
+
"pooler_num_fc_layers": 3,
|
| 85 |
+
"pooler_size_per_head": 128,
|
| 86 |
+
"pooler_type": "first_token_transform",
|
| 87 |
+
"position_embedding_type": "absolute",
|
| 88 |
+
"torch_dtype": "float32",
|
| 89 |
+
"transformers_version": "4.35.2",
|
| 90 |
+
"type_vocab_size": 2,
|
| 91 |
+
"use_cache": true,
|
| 92 |
+
"vocab_size": 21128
|
| 93 |
+
}
|
model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2fe6ee9f30730178307f2cec6b2a491e226294975f209812e4781308be2a60e9
|
| 3 |
+
size 407063645
|
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,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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": true,
|
| 45 |
+
"cls_token": "[CLS]",
|
| 46 |
+
"do_lower_case": false,
|
| 47 |
+
"ignore_mismatched_sizes": true,
|
| 48 |
+
"mask_token": "[MASK]",
|
| 49 |
+
"max_length": 512,
|
| 50 |
+
"model_max_length": 512,
|
| 51 |
+
"pad_token": "[PAD]",
|
| 52 |
+
"sep_token": "[SEP]",
|
| 53 |
+
"stride": 0,
|
| 54 |
+
"strip_accents": null,
|
| 55 |
+
"tokenize_chinese_chars": true,
|
| 56 |
+
"tokenizer_class": "BertTokenizer",
|
| 57 |
+
"truncation_side": "right",
|
| 58 |
+
"truncation_strategy": "longest_first",
|
| 59 |
+
"unk_token": "[UNK]"
|
| 60 |
+
}
|
vocab.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|