Instructions to use TangoBeeAkto/toxic-roberta-onnx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TangoBeeAkto/toxic-roberta-onnx with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="TangoBeeAkto/toxic-roberta-onnx")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("TangoBeeAkto/toxic-roberta-onnx") model = AutoModelForSequenceClassification.from_pretrained("TangoBeeAkto/toxic-roberta-onnx", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload toxic-roberta-onnx model for LLM Guard
Browse files- README.md +39 -0
- config.json +65 -0
- merges.txt +0 -0
- model.onnx +3 -0
- model_quantized.onnx +3 -0
- special_tokens_map.json +51 -0
- tokenizer.json +0 -0
- tokenizer_config.json +57 -0
- vocab.json +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 |
+
# toxic-roberta-onnx
|
| 11 |
+
|
| 12 |
+
This is an ONNX model used by LLM Guard for security scanning.
|
| 13 |
+
|
| 14 |
+
Original model source: `ProtectAI/unbiased-toxic-roberta-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,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "unitary/unbiased-toxic-roberta",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"RobertaForSequenceClassification"
|
| 5 |
+
],
|
| 6 |
+
"attention_probs_dropout_prob": 0.1,
|
| 7 |
+
"bos_token_id": 0,
|
| 8 |
+
"classifier_dropout": null,
|
| 9 |
+
"eos_token_id": 2,
|
| 10 |
+
"function_to_apply": "sigmoid",
|
| 11 |
+
"gradient_checkpointing": false,
|
| 12 |
+
"hidden_act": "gelu",
|
| 13 |
+
"hidden_dropout_prob": 0.1,
|
| 14 |
+
"hidden_size": 768,
|
| 15 |
+
"id2label": {
|
| 16 |
+
"0": "toxicity",
|
| 17 |
+
"1": "severe_toxicity",
|
| 18 |
+
"2": "obscene",
|
| 19 |
+
"3": "identity_attack",
|
| 20 |
+
"4": "insult",
|
| 21 |
+
"5": "threat",
|
| 22 |
+
"6": "sexual_explicit",
|
| 23 |
+
"7": "male",
|
| 24 |
+
"8": "female",
|
| 25 |
+
"9": "homosexual_gay_or_lesbian",
|
| 26 |
+
"10": "christian",
|
| 27 |
+
"11": "jewish",
|
| 28 |
+
"12": "muslim",
|
| 29 |
+
"13": "black",
|
| 30 |
+
"14": "white",
|
| 31 |
+
"15": "psychiatric_or_mental_illness"
|
| 32 |
+
},
|
| 33 |
+
"initializer_range": 0.02,
|
| 34 |
+
"intermediate_size": 3072,
|
| 35 |
+
"label2id": {
|
| 36 |
+
"black": 13,
|
| 37 |
+
"christian": 10,
|
| 38 |
+
"female": 8,
|
| 39 |
+
"homosexual_gay_or_lesbian": 9,
|
| 40 |
+
"identity_attack": 3,
|
| 41 |
+
"insult": 4,
|
| 42 |
+
"jewish": 11,
|
| 43 |
+
"male": 7,
|
| 44 |
+
"muslim": 12,
|
| 45 |
+
"obscene": 2,
|
| 46 |
+
"psychiatric_or_mental_illness": 15,
|
| 47 |
+
"severe_toxicity": 1,
|
| 48 |
+
"sexual_explicit": 6,
|
| 49 |
+
"threat": 5,
|
| 50 |
+
"toxicity": 0,
|
| 51 |
+
"white": 14
|
| 52 |
+
},
|
| 53 |
+
"layer_norm_eps": 1e-05,
|
| 54 |
+
"max_position_embeddings": 514,
|
| 55 |
+
"model_type": "roberta",
|
| 56 |
+
"num_attention_heads": 12,
|
| 57 |
+
"num_hidden_layers": 12,
|
| 58 |
+
"pad_token_id": 1,
|
| 59 |
+
"position_embedding_type": "absolute",
|
| 60 |
+
"problem_type": "multi_label_classification",
|
| 61 |
+
"transformers_version": "4.35.0",
|
| 62 |
+
"type_vocab_size": 1,
|
| 63 |
+
"use_cache": true,
|
| 64 |
+
"vocab_size": 50265
|
| 65 |
+
}
|
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:a33a3b5b9c74c6c00129fcc6d0a2ed78856eb63eb83684a943e6ae890003dbf2
|
| 3 |
+
size 498913665
|
model_quantized.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2747e65b2db4071959a2c4c645dd54bf9ff910b4fef66929f5fd450c4976a280
|
| 3 |
+
size 125538880
|
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": true,
|
| 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,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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": true,
|
| 40 |
+
"rstrip": false,
|
| 41 |
+
"single_word": false,
|
| 42 |
+
"special": true
|
| 43 |
+
}
|
| 44 |
+
},
|
| 45 |
+
"bos_token": "<s>",
|
| 46 |
+
"clean_up_tokenization_spaces": true,
|
| 47 |
+
"cls_token": "<s>",
|
| 48 |
+
"eos_token": "</s>",
|
| 49 |
+
"errors": "replace",
|
| 50 |
+
"mask_token": "<mask>",
|
| 51 |
+
"model_max_length": 512,
|
| 52 |
+
"pad_token": "<pad>",
|
| 53 |
+
"sep_token": "</s>",
|
| 54 |
+
"tokenizer_class": "RobertaTokenizer",
|
| 55 |
+
"trim_offsets": true,
|
| 56 |
+
"unk_token": "<unk>"
|
| 57 |
+
}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|