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
Download tokenizer_config.json from reflection/Iris-Content-Guard: direct link, hf CLI and curl.
- Browser
- Download file 2.35 kB
-
https://huggingface.co/reflection/Iris-Content-Guard/resolve/main/tokenizer_config.json
- Command line
-
hf download hf://reflection/Iris-Content-Guard/tokenizer_config.json
-
curl -L -o tokenizer_config.json https://huggingface.co/reflection/Iris-Content-Guard/resolve/main/tokenizer_config.json
2.35 kB
| { | |
| "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" | |
| } | |