Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,128 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
pipeline_tag: image-text-to-text
|
| 4 |
+
base_model:
|
| 5 |
+
- Qwen/Qwen2.5-VL-7B-Instruct
|
| 6 |
+
language:
|
| 7 |
+
- multilingual
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# SafeWork-R1-Qwen2.5VL-7B
|
| 11 |
+
|
| 12 |
+
[📂 GitHub](https://github.com/AI45Lab/SafeWork-R1) · [📜Technical Report](https://arxiv.org/abs/2507.18576) · [💬Online Chat](https://safework-r1.ai45.shlab.org.cn/)
|
| 13 |
+
|
| 14 |
+
<div align="center">
|
| 15 |
+
<img alt="image" src="https://cdn-uploads.huggingface.co/production/uploads/666fe1a5b07525f0bde69c27/9VqjAkK1Lshl3TVpMFV9-.png">
|
| 16 |
+
</div>
|
| 17 |
+
|
| 18 |
+
## Overview
|
| 19 |
+
|
| 20 |
+
We introduce SafeWork-R1, a cutting-edge multimodal reasoning model demonstrating the coevolution of safety and general intelligence under the guiding principle of the AI-45° Law.
|
| 21 |
+
|
| 22 |
+
SafeWork-R1 is built upon the SafeLadder framework, which integrates large-scale, progressive, safety-oriented reinforcement learning post-training supported by multi-principled verifiers. Unlike conventional RLHF that simply learns human preferences, SafeLadder enables SafeWork-R1 to develop intrinsic safety reasoning and self-reflection abilities, leading to emergent safety “aha” moments.
|
| 23 |
+
|
| 24 |
+
<div align="center">
|
| 25 |
+
|
| 26 |
+

|
| 27 |
+
|
| 28 |
+
</div>
|
| 29 |
+
|
| 30 |
+
## Model Zoo
|
| 31 |
+
|
| 32 |
+
<table>
|
| 33 |
+
<tr>
|
| 34 |
+
<th>Model Variant</th>
|
| 35 |
+
<th>Parameters</th>
|
| 36 |
+
<th>Base Model</th>
|
| 37 |
+
<th>Link</th>
|
| 38 |
+
</tr>
|
| 39 |
+
<tr>
|
| 40 |
+
<td>SafeWork-R1</td>
|
| 41 |
+
<td>72B</td>
|
| 42 |
+
<td>Qwen2.5-VL-72B</td>
|
| 43 |
+
<td><a href="https://huggingface.co/AI45Research/SafeWork-R1">🤗 link</a></td>
|
| 44 |
+
</tr>
|
| 45 |
+
<tr>
|
| 46 |
+
<td>SafeWork-R1-InternVL3-78B</td>
|
| 47 |
+
<td>78B</td>
|
| 48 |
+
<td>InternVL3-78B</td>
|
| 49 |
+
<td><a href="https://huggingface.co/AI45Research/SafeWork-R1-InternVL3-78B">🤗 link</a></td>
|
| 50 |
+
</tr>
|
| 51 |
+
<tr>
|
| 52 |
+
<td>SafeWork-R1-DeepSeek-70B</td>
|
| 53 |
+
<td>70B</td>
|
| 54 |
+
<td>Deepseek-R1-DistillLlama-70B</td>
|
| 55 |
+
<td><a href="https://huggingface.co/AI45Research/SafeWork-R1-DeepSeek-70B">🤗 link</a></td>
|
| 56 |
+
</tr>
|
| 57 |
+
<tr>
|
| 58 |
+
<td>SafeWork-R1-Qwen2.5VL-7B</td>
|
| 59 |
+
<td>7B</td>
|
| 60 |
+
<td>Qwen2.5-VL-7B</td>
|
| 61 |
+
<td><a href="https://huggingface.co/AI45Research/SafeWork-R1-Qwen2.5VL-7B">🤗 link</a></td>
|
| 62 |
+
</tr>
|
| 63 |
+
</table>
|
| 64 |
+
|
| 65 |
+
## Quick Start
|
| 66 |
+
|
| 67 |
+
```python
|
| 68 |
+
from transformers import AutoProcessor, AutoModelForCausalLM
|
| 69 |
+
import torch
|
| 70 |
+
|
| 71 |
+
model_name = "AI45Research/SafeWork-R1-Qwen2.5VL-7B"
|
| 72 |
+
processor = AutoProcessor.from_pretrained(model_name, trust_remote_code=True)
|
| 73 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", torch_dtype="auto", trust_remote_code=True)
|
| 74 |
+
|
| 75 |
+
messages = [
|
| 76 |
+
{
|
| 77 |
+
"role": "user",
|
| 78 |
+
"content": [
|
| 79 |
+
{
|
| 80 |
+
"type": "image",
|
| 81 |
+
"image": "file:///path/to/image",
|
| 82 |
+
},
|
| 83 |
+
{"type": "text", "text": "Prompt containing harmful content."},
|
| 84 |
+
],
|
| 85 |
+
}
|
| 86 |
+
]
|
| 87 |
+
|
| 88 |
+
# Preparation for inference
|
| 89 |
+
text = processor.apply_chat_template(
|
| 90 |
+
messages, tokenize=False, add_generation_prompt=True
|
| 91 |
+
)
|
| 92 |
+
image_inputs, video_inputs = process_vision_info(messages)
|
| 93 |
+
inputs = processor(
|
| 94 |
+
text=[text],
|
| 95 |
+
images=image_inputs,
|
| 96 |
+
videos=video_inputs,
|
| 97 |
+
padding=True,
|
| 98 |
+
return_tensors="pt",
|
| 99 |
+
)
|
| 100 |
+
inputs = inputs.to("cuda")
|
| 101 |
+
|
| 102 |
+
# Inference: Generation of the output
|
| 103 |
+
generated_ids = model.generate(**inputs, max_new_tokens=8192)
|
| 104 |
+
generated_ids_trimmed = [
|
| 105 |
+
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
| 106 |
+
]
|
| 107 |
+
output_text = processor.batch_decode(
|
| 108 |
+
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
| 109 |
+
)
|
| 110 |
+
print(output_text)
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
## License
|
| 114 |
+
|
| 115 |
+
This project is released under the Apache 2.0 license.
|
| 116 |
+
|
| 117 |
+
## Citation
|
| 118 |
+
|
| 119 |
+
If you find this work useful, feel free to give us a cite.
|
| 120 |
+
|
| 121 |
+
```
|
| 122 |
+
@misc{lab2025safework,
|
| 123 |
+
title={SafeWork-R1: Coevolving Safety and Intelligence under the AI-45 Law},
|
| 124 |
+
author={Lab, Shanghai AI and Bao, Yicheng and Chen, Guanxu and Chen, Mingkang and Chen, Yunhao and Chen, Chiyu and Chen, Lingjie and Chen, Sirui and Chen, Xinquan and Cheng, Jie and others},
|
| 125 |
+
journal={arXiv preprint arXiv:2507.18576},
|
| 126 |
+
year={2025}
|
| 127 |
+
}
|
| 128 |
+
```
|