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: 617 Bytes
dea61b9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 | {%- for message in messages -%}
{%- if message['content'] is not string -%}
{{- raise_exception('Iris Content Guard requires string content') -}}
{%- elif message['role'] == 'user' -%}
{{- '<|start|>user<|message|>' + message['content'] + '<|end|>' -}}
{%- elif message['role'] == 'assistant' and not message.get('tool_calls') -%}
{{- '<|start|>assistant<|channel|>analysis<|message|><|end|>' -}}
{{- '<|start|>assistant<|channel|>final<|message|>' + message['content'] + '<|return|>' -}}
{%- else -%}
{{- raise_exception('Iris Content Guard supports plain user and assistant turns') -}}
{%- endif -%}
{%- endfor -%}
|