Update README.md
Browse files
README.md
CHANGED
|
@@ -1,58 +1,125 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
language:
|
| 4 |
-
- zh
|
| 5 |
- en
|
|
|
|
| 6 |
tags:
|
| 7 |
- safety
|
| 8 |
- moderation
|
| 9 |
- multimodal
|
|
|
|
| 10 |
pipeline_tag: text-generation
|
| 11 |
---
|
| 12 |
|
| 13 |
-
# OmniGuard-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
- **模型名称**: OmniGuard-3B-Fast
|
| 20 |
-
- **原始模型**: OmniGuard-3B
|
| 21 |
-
- **模型类型**: 多模态安全审核
|
| 22 |
-
- **支持语言**: 中文、英文
|
| 23 |
|
| 24 |
-
## 使用方法
|
| 25 |
|
| 26 |
```python
|
| 27 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 28 |
|
| 29 |
-
model_name = "anonymousICML/OmniGuard-3B
|
| 30 |
model = AutoModelForCausalLM.from_pretrained(
|
| 31 |
model_name,
|
| 32 |
torch_dtype="auto",
|
| 33 |
device_map="auto",
|
| 34 |
-
attn_implementation="flash_attention_2" #
|
| 35 |
)
|
| 36 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 37 |
|
| 38 |
-
#
|
| 39 |
messages = [
|
| 40 |
-
{"role": "user", "content": "
|
| 41 |
]
|
| 42 |
-
text = tokenizer.apply_chat_template(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 44 |
|
| 45 |
-
outputs = model.generate(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 47 |
print(response)
|
| 48 |
```
|
| 49 |
|
| 50 |
-
## 性能
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
-
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
language:
|
|
|
|
| 4 |
- en
|
| 5 |
+
- zh
|
| 6 |
tags:
|
| 7 |
- safety
|
| 8 |
- moderation
|
| 9 |
- multimodal
|
| 10 |
+
- omniguard
|
| 11 |
pipeline_tag: text-generation
|
| 12 |
---
|
| 13 |
|
| 14 |
+
# OmniGuard: Unified Omni-Modal Guardrails with Deliberate Reasoning
|
| 15 |
+
|
| 16 |
+
OmniGuard is a multimodal safety evaluation model designed to assess content safety across text, images, audio, and video. Built on the Qwen2.5-Omni architecture, it provides structured safety reasoning and policy enforcement.
|
| 17 |
+
|
| 18 |
+
## Model Information
|
| 19 |
+
|
| 20 |
+
- **Model Name**: OmniGuard-3B
|
| 21 |
+
- **Base Model**: Qwen2.5-Omni-3B
|
| 22 |
+
- **Model Type**: Multimodal Safety Moderation
|
| 23 |
+
- **Supported Languages**: English, Chinese
|
| 24 |
+
- **Supported Modalities**: Text, Image, Audio, Video
|
| 25 |
+
- **License**: Apache-2.0
|
| 26 |
+
|
| 27 |
+
## Model Variants
|
| 28 |
+
|
| 29 |
+
We provide two model sizes:
|
| 30 |
+
|
| 31 |
+
- **[OmniGuard-3B](https://huggingface.co/anonymousICML/OmniGuard-3B)** - 3B parameters for high-accuracy safety evaluation
|
| 32 |
+
- **[OmniGuard-3B](https://huggingface.co/anonymousICML/OmniGuard-7B)** - 7B parameters for resource-constrained environments
|
| 33 |
+
|
| 34 |
+
## Features
|
| 35 |
+
|
| 36 |
+
- **Omni-Modal Safety Assessment**: Evaluate safety across text, images, audio, and video inputs
|
| 37 |
+
- **Structured Reasoning**: Provides deliberate, structured safety analysis beyond binary classification
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
## Installation
|
| 41 |
+
|
| 42 |
+
### Quick Setup
|
| 43 |
+
|
| 44 |
+
```bash
|
| 45 |
+
# Install core dependencies
|
| 46 |
+
pip install torch transformers accelerate
|
| 47 |
|
| 48 |
+
# Install Qwen2.5-Omni support
|
| 49 |
+
pip uninstall transformers -y
|
| 50 |
+
pip install git+https://github.com/huggingface/transformers@v4.51.3-Qwen2.5-Omni-preview
|
| 51 |
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
### Requirements
|
| 55 |
+
|
| 56 |
+
- Python 3.8+
|
| 57 |
+
- PyTorch 2.0+
|
| 58 |
+
- CUDA-compatible GPU (recommended)
|
| 59 |
+
- 8GB+ GPU memory for 3B model
|
| 60 |
+
- Flash Attention 2 (optional, for better performance)
|
| 61 |
+
|
| 62 |
+
## Usage
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
|
|
|
| 65 |
|
| 66 |
```python
|
| 67 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 68 |
|
| 69 |
+
model_name = "anonymousICML/OmniGuard-3B"
|
| 70 |
model = AutoModelForCausalLM.from_pretrained(
|
| 71 |
model_name,
|
| 72 |
torch_dtype="auto",
|
| 73 |
device_map="auto",
|
| 74 |
+
attn_implementation="flash_attention_2" # Recommended
|
| 75 |
)
|
| 76 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 77 |
|
| 78 |
+
# Text-only safety evaluation
|
| 79 |
messages = [
|
| 80 |
+
{"role": "user", "content": "Please analyze the safety of this content: [Your content here]"}
|
| 81 |
]
|
| 82 |
+
text = tokenizer.apply_chat_template(
|
| 83 |
+
messages,
|
| 84 |
+
tokenize=False,
|
| 85 |
+
add_generation_prompt=True
|
| 86 |
+
)
|
| 87 |
inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 88 |
|
| 89 |
+
outputs = model.generate(
|
| 90 |
+
**inputs,
|
| 91 |
+
max_new_tokens=512,
|
| 92 |
+
do_sample=False
|
| 93 |
+
)
|
| 94 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 95 |
print(response)
|
| 96 |
```
|
| 97 |
|
|
|
|
| 98 |
|
| 99 |
+
## Ethical Considerations
|
| 100 |
+
|
| 101 |
+
- This model is designed for safety evaluation and content moderation
|
| 102 |
+
- Should be used as part of a comprehensive safety strategy
|
| 103 |
+
- May reflect biases present in training data
|
| 104 |
+
- Continuous monitoring and updates recommended for production use
|
| 105 |
+
- Users are responsible for compliance with applicable laws and regulations
|
| 106 |
|
| 107 |
+
## License
|
| 108 |
+
|
| 109 |
+
This model is released under the Apache-2.0 license.
|
| 110 |
+
|
| 111 |
+
## Acknowledgments
|
| 112 |
+
|
| 113 |
+
- Built on [Qwen2.5-Omni](https://github.com/QwenLM/Qwen2.5-Omni) by Alibaba Cloud
|
| 114 |
+
- Uses [LLaMA Guard 3](https://ai.meta.com/research/publications/llama-guard-llm-based-input-output-safeguard-for-human-ai-conversations/) safety framework
|
| 115 |
+
- Trained on diverse multimodal safety datasets
|
| 116 |
+
|
| 117 |
+
## Support
|
| 118 |
+
|
| 119 |
+
For issues, questions, or contributions:
|
| 120 |
+
- Repository: https://github.com/anonymous-2654a/icml-2026-sub
|
| 121 |
+
- HuggingFace: https://huggingface.co/anonymousICML
|
| 122 |
+
|
| 123 |
+
---
|
| 124 |
|
| 125 |
+
**Note**: This is an anonymous submission for ICML 2026. Full details will be released upon acceptance.
|