Views
No views yet

2025.09.18 🌟 SAIL-VL2 Technical Report is now available at arxiv.
| Architecture | ViT | LLM | Adapter | Token Merge | Resolution |
|---|---|---|---|---|---|
| 🤗SAIL-VL2-2B | 🤗SAILViT-Huge | 🤗Qwen3-1.7B | 2-layer MLP | 2x2 | 448x448xN |
| 🤗SAIL-VL2-8B | 🤗SAILViT-Huge | 🤗Qwen3-8B | 2-layer MLP | 2x2 | 448x448xN |
| 🤗SAIL-VL2-2B-Thinking | 🤗SAILViT-Huge | 🤗Qwen3-1.7B | 2-layer MLP | 2x2 | 448x448xN |
| 🤗SAIL-VL2-8B-Thinking | 🤗SAILViT-Huge | 🤗Qwen3-8B | 2-layer MLP | 2x2 | 448x448xN |
1import torch
2from transformers import AutoTokenizer, AutoModel, AutoProcessor
3from PIL import Image
4
5
6model_path = "your model path"
7
8tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
9processor = AutoProcessor.from_pretrained(model_path, trust_remote_code=True)
10device = torch.cuda.current_device()
11model = AutoModel.from_pretrained(model_path, trust_remote_code=True, torch_dtype=torch.bfloat16,).to(device)
12
13print("##### with images")
14messages = [
15 {"role": "user", "content": [{"type": "image", "image": 'image_path'},
16 {"type": "text", "text": "describe the image"}]}
17]
18text = processor.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
19
20image_path = 'your image path'
21image = Image.open(image_path)
22inputs = processor(images=image, text=text, return_tensors="pt", padding=True, truncation=True).to(model.device).to(torch.bfloat16)
23
24generated_ids = model.generate(**inputs, max_new_tokens=512)
25response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
26response = response.split('<|im_end|>')[0].strip()
27print(response)
28
29
30print("##### without images")
31messages = [
32 {
33 "role": "user",
34 "content": [{"type": "text", "text": "中国的首都是哪里?"}]
35 }
36]
37text = processor.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
38inputs = processor(images=None, text=text, return_tensors="pt", padding=True, truncation=True).to(model.device).to(torch.bfloat16)
39generated_ids = model.generate(**inputs, max_new_tokens=512)
40response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
41response = response.split('<|im_end|>')[0].strip()
42print(response)
43





@misc{yin2025sailvl2technicalreport,
title={SAIL-VL2 Technical Report},
author={Weijie Yin and Yongjie Ye and Fangxun Shu and Yue Liao and Zijian Kang and Hongyuan Dong and Haiyang Yu and Dingkang Yang and Jiacong Wang and Han Wang and Wenzhuo Liu and Xiao Liang and Shuicheng Yan and Chao Feng},
year={2025},
eprint={2509.14033},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2509.14033},
}@article{dong2025scalable,
title={Scalable vision language model training via high quality data curation},
author={Dong, Hongyuan and Kang, Zijian and Yin, Weijie and Liang, Xiao and Feng, Chao and Ran, Jiao},
journal={arXiv preprint arXiv:2501.05952},
year={2025}
}