Token Classification
Transformers
Safetensors
English
beam
mixture-of-experts
safety
content-moderation
Instructions to use reflection/Iris-Content-Guard with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use reflection/Iris-Content-Guard with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("token-classification", model="reflection/Iris-Content-Guard")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained("reflection/Iris-Content-Guard") model = AutoModelForTokenClassification.from_pretrained("reflection/Iris-Content-Guard", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 2,346 Bytes
dea61b9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | {
"backend": "tokenizers",
"bos_token": null,
"eos_token": "<|return|>",
"extra_special_tokens": [],
"is_local": true,
"local_files_only": false,
"model_max_length": 131072,
"pad_token": "<|endoftext|>",
"reflection_grammar_version": "harmony_xml",
"response_template": {
"defaults": {
"role": "assistant"
},
"start_anchor_pattern": "<\\|start\\|>assistant",
"fields": {
"thinking": {
"open": "<|channel|>analysis<|message|>",
"close": [
"<|end|><|start|>assistant",
"<|constrain|><|start|>assistant",
"<|start|>assistant"
],
"content": "text"
},
"content": {
"open": "<|channel|>final<|message|>",
"close": [
"<|return|>",
"<|end|>",
"<|call|>"
],
"content": "text"
},
"tool_calls": {
"open_pattern": " to=(?P<name>[^\\s<]+)<\\|channel\\|>analysis <\\|constrain\\|>xml<\\|message\\|>",
"close": [
"<|end|><|start|>assistant",
"<|call|>"
],
"repeats": true,
"content": "xml-inline",
"content_args": {
"tag_pattern": "<rfl:parameter name=\"(?P<key>[^\"]+)\">\\n(?P<value>.*?)\\n(?:</rfl:parameter>|(?=<rfl:parameter name=\"))",
"value_parser": {
"name": "text",
"args": {
"strip": false
}
}
},
"transform": {
"type": "function",
"function": {
"name": "{name}",
"arguments": "{content}"
}
}
}
}
},
"tokenizer_class": "TokenizersBackend",
"unk_token": null,
"chat_template": "{%- for message in messages -%}\n{%- if message['content'] is not string -%}\n{{- raise_exception('Iris Content Guard requires string content') -}}\n{%- elif message['role'] == 'user' -%}\n{{- '<|start|>user<|message|>' + message['content'] + '<|end|>' -}}\n{%- elif message['role'] == 'assistant' and not message.get('tool_calls') -%}\n{{- '<|start|>assistant<|channel|>analysis<|message|><|end|>' -}}\n{{- '<|start|>assistant<|channel|>final<|message|>' + message['content'] + '<|return|>' -}}\n{%- else -%}\n{{- raise_exception('Iris Content Guard supports plain user and assistant turns') -}}\n{%- endif -%}\n{%- endfor -%}\n"
}
|