初始化项目,由ModelHub XC社区提供模型
Model: anonymous-omniguard/OmniGuard-7B Source: Original Platform
This commit is contained in:
120
README.md
Normal file
120
README.md
Normal file
@@ -0,0 +1,120 @@
|
||||
---
|
||||
license: apache-2.0
|
||||
language:
|
||||
- en
|
||||
- zh
|
||||
tags:
|
||||
- safety
|
||||
- moderation
|
||||
- multimodal
|
||||
- omniguard
|
||||
pipeline_tag: text-generation
|
||||
---
|
||||
|
||||
# OmniGuard: Unified Omni-Modal Guardrails with Deliberate Reasoning
|
||||
|
||||
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.
|
||||
|
||||
## Model Information
|
||||
|
||||
- **Model Name**: OmniGuard-7B
|
||||
- **Base Model**: Qwen2.5-Omni-7B
|
||||
- **Model Type**: Multimodal Safety Moderation
|
||||
- **Supported Languages**: English, Chinese
|
||||
- **Supported Modalities**: Text, Image, Audio, Video
|
||||
- **License**: Apache-2.0
|
||||
|
||||
## Model Variants
|
||||
|
||||
We provide two model sizes:
|
||||
|
||||
- **[OmniGuard-7B](https://huggingface.co/anonymous-omniguard/OmniGuard-7B)** — 7B parameters for high-accuracy safety evaluation
|
||||
- **[OmniGuard-3B](https://huggingface.co/anonymous-omniguard/OmniGuard-3B)** — 3B parameters for resource-constrained environments
|
||||
|
||||
## Features
|
||||
|
||||
- **Omni-Modal Safety Assessment**: Evaluate safety across text, images, audio, and video inputs
|
||||
- **Structured Reasoning**: Provides deliberate, structured safety analysis beyond binary classification
|
||||
|
||||
## Installation
|
||||
|
||||
### Quick Setup
|
||||
|
||||
```bash
|
||||
# Install core dependencies
|
||||
pip install torch transformers accelerate
|
||||
|
||||
# Install Qwen2.5-Omni support
|
||||
pip uninstall transformers -y
|
||||
pip install git+https://github.com/huggingface/transformers@v4.51.3-Qwen2.5-Omni-preview
|
||||
```
|
||||
|
||||
### Requirements
|
||||
|
||||
- Python 3.8+
|
||||
- PyTorch 2.0+
|
||||
- CUDA-compatible GPU (recommended)
|
||||
- 16GB+ GPU memory for 7B model
|
||||
- Flash Attention 2 (optional, for better performance)
|
||||
|
||||
## Usage
|
||||
|
||||
```python
|
||||
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||
|
||||
model_name = "anonymous-omniguard/OmniGuard-7B"
|
||||
model = AutoModelForCausalLM.from_pretrained(
|
||||
model_name,
|
||||
torch_dtype="auto",
|
||||
device_map="auto",
|
||||
attn_implementation="flash_attention_2" # Recommended
|
||||
)
|
||||
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
||||
|
||||
# Text-only safety evaluation
|
||||
messages = [
|
||||
{"role": "user", "content": "Please analyze the safety of this content: [Your content here]"}
|
||||
]
|
||||
text = tokenizer.apply_chat_template(
|
||||
messages,
|
||||
tokenize=False,
|
||||
add_generation_prompt=True
|
||||
)
|
||||
inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
||||
|
||||
outputs = model.generate(
|
||||
**inputs,
|
||||
max_new_tokens=512,
|
||||
do_sample=False
|
||||
)
|
||||
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
||||
print(response)
|
||||
```
|
||||
|
||||
## Ethical Considerations
|
||||
|
||||
- This model is designed for safety evaluation and content moderation
|
||||
- Should be used as part of a comprehensive safety strategy
|
||||
- May reflect biases present in training data
|
||||
- Continuous monitoring and updates recommended for production use
|
||||
- Users are responsible for compliance with applicable laws and regulations
|
||||
|
||||
## License
|
||||
|
||||
This model is released under the Apache-2.0 license.
|
||||
|
||||
## Acknowledgments
|
||||
|
||||
- Built on [Qwen2.5-Omni](https://github.com/QwenLM/Qwen2.5-Omni) by Alibaba Cloud
|
||||
- Uses [LLaMA Guard 3](https://ai.meta.com/research/publications/llama-guard-llm-based-input-output-safeguard-for-human-ai-conversations/) safety framework
|
||||
- Trained on diverse multimodal safety datasets
|
||||
|
||||
## Support
|
||||
|
||||
For issues, questions, or contributions:
|
||||
- Repository: https://github.com/anonymous-2654a/neurips-2026-sub
|
||||
- HuggingFace: https://huggingface.co/anonymous-omniguard
|
||||
|
||||
---
|
||||
|
||||
*Anonymous release accompanying a paper currently under peer review.*
|
||||
Reference in New Issue
Block a user