Views
No views yet


| Model Variant | Parameters | Base Model | Link |
|---|---|---|---|
| SafeWork-R1 | 72B | Qwen2.5-VL-72B | 🤗 link |
| SafeWork-R1-InternVL3-78B | 78B | InternVL3-78B | 🤗 link |
| SafeWork-R1-DeepSeek-70B | 70B | Deepseek-R1-DistillLlama-70B | 🤗 link |
| SafeWork-R1-Qwen2.5VL-7B | 7B | Qwen2.5-VL-7B | 🤗 link |
1from transformers import AutoProcessor, AutoModelForCausalLM
2import torch
3
4model_name = "AI45Research/SafeWork-R1-Qwen2.5VL-7B"
5processor = AutoProcessor.from_pretrained(model_name, trust_remote_code=True)
6model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", torch_dtype="auto", trust_remote_code=True)
7
8messages = [
9 {
10 "role": "user",
11 "content": [
12 {
13 "type": "image",
14 "image": "file:///path/to/image",
15 },
16 {"type": "text", "text": "Prompt containing harmful content."},
17 ],
18 }
19]
20
21# Preparation for inference
22text = processor.apply_chat_template(
23 messages, tokenize=False, add_generation_prompt=True
24)
25image_inputs, video_inputs = process_vision_info(messages)
26inputs = processor(
27 text=[text],
28 images=image_inputs,
29 videos=video_inputs,
30 padding=True,
31 return_tensors="pt",
32)
33inputs = inputs.to("cuda")
34
35# Inference: Generation of the output
36generated_ids = model.generate(**inputs, max_new_tokens=8192)
37generated_ids_trimmed = [
38 out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
39]
40output_text = processor.batch_decode(
41 generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
42)
43print(output_text)@misc{lab2025safework,
title={SafeWork-R1: Coevolving Safety and Intelligence under the AI-45 Law},
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},
journal={arXiv preprint arXiv:2507.18576},
year={2025}
}