Update README.md
Browse files
README.md
CHANGED
@@ -3,4 +3,114 @@ license: mit
|
|
3 |
base_model:
|
4 |
- Qwen/Qwen2.5-VL-7B-Instruct
|
5 |
pipeline_tag: image-text-to-text
|
6 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
base_model:
|
4 |
- Qwen/Qwen2.5-VL-7B-Instruct
|
5 |
pipeline_tag: image-text-to-text
|
6 |
+
---
|
7 |
+
# Vision-G1: Towards General Vision Language Reasoning with Multi-Domain Data Curation
|
8 |
+
[](https://arxiv.org/abs/2508.12680)
|
9 |
+
[](https://github.com/yuh-zha/Vision-G1)
|
10 |
+
[](https://huggingface.co/yzha/vision-g1)
|
11 |
+
## Introduction
|
12 |
+
We present the reasoning VLM: Vision-G1, which is trained through multi-domain data curation. Specifically, we include training data from 46 data sources across 8 dimensions. This repo includes training code, data preprocessing scripts, and evaluation scripts.
|
13 |
+
## Installation
|
14 |
+
To enable the inference of Vision-G1, you can simply install the latest transformers library:
|
15 |
+
```bash
|
16 |
+
pip install transformers
|
17 |
+
```
|
18 |
+
Optionally, if you wish to accelerate the inference, please install vllm:
|
19 |
+
```bash
|
20 |
+
pip install vllm
|
21 |
+
```
|
22 |
+
To support training, installing verl is required:
|
23 |
+
```bash
|
24 |
+
cd training/
|
25 |
+
pip install -r requirements.txt
|
26 |
+
pip install flash_attn==2.7.4.post1 --no-build-isolation
|
27 |
+
pip install -e .
|
28 |
+
```
|
29 |
+
## Inference
|
30 |
+
Our model follows the transformers format. You can load it with standard transformers APIs:
|
31 |
+
```python
|
32 |
+
from transformers import Qwen2_5_VLForConditionalGeneration, AutoTokenizer, AutoProcessor
|
33 |
+
from qwen_vl_utils import process_vision_info
|
34 |
+
|
35 |
+
model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
|
36 |
+
"yzha/vision-g1",
|
37 |
+
torch_dtype=torch.bfloat16,
|
38 |
+
attn_implementation="flash_attention_2",
|
39 |
+
device_map="auto",
|
40 |
+
)
|
41 |
+
|
42 |
+
# default processer
|
43 |
+
processor = AutoProcessor.from_pretrained("yzha/vision-g1")
|
44 |
+
|
45 |
+
messages = [
|
46 |
+
{
|
47 |
+
"role": "user",
|
48 |
+
"content": [
|
49 |
+
{
|
50 |
+
"type": "image",
|
51 |
+
"image": "<path to image>",
|
52 |
+
},
|
53 |
+
{"type": "text", "text": "<Question>"},
|
54 |
+
],
|
55 |
+
}
|
56 |
+
]
|
57 |
+
|
58 |
+
# Preparation for inference
|
59 |
+
text = processor.apply_chat_template(
|
60 |
+
messages, tokenize=False, add_generation_prompt=True
|
61 |
+
)
|
62 |
+
image_inputs, video_inputs = process_vision_info(messages)
|
63 |
+
inputs = processor(
|
64 |
+
text=[text],
|
65 |
+
images=image_inputs,
|
66 |
+
videos=video_inputs,
|
67 |
+
padding=True,
|
68 |
+
return_tensors="pt",
|
69 |
+
)
|
70 |
+
inputs = inputs.to("cuda")
|
71 |
+
|
72 |
+
# Inference: Generation of the output
|
73 |
+
generated_ids = model.generate(**inputs, max_new_tokens=128)
|
74 |
+
generated_ids_trimmed = [
|
75 |
+
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
76 |
+
]
|
77 |
+
output_text = processor.batch_decode(
|
78 |
+
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
79 |
+
)
|
80 |
+
print(output_text)
|
81 |
+
|
82 |
+
```
|
83 |
+
For faster inference, the model also supports vllm server. Simply start a vllm host by:
|
84 |
+
```bash
|
85 |
+
vllm serve yzha/vision-g1 \
|
86 |
+
--host 0.0.0.0 --port 8000 \
|
87 |
+
--max-model-len 8192 \
|
88 |
+
```
|
89 |
+
## Training
|
90 |
+
The training scripts are in `training/examples/grpo_trainer`. For single node training, please use `single_node_vision_g1.sh`. For distributed training, please use `distributed_vision_g1.sh`. Before launching the training, you need to specify the training and validation data path in the bash script, by setting `train_files` and `test_files`. To launch the training,
|
91 |
+
### Single node
|
92 |
+
```bash
|
93 |
+
cd training/
|
94 |
+
bash examples/grpo_trainer/single_node_vision_g1.sh
|
95 |
+
```
|
96 |
+
### Multiple nodes
|
97 |
+
```bash
|
98 |
+
cd training/
|
99 |
+
sbatch examples/grpo_trainer/distributed_vision_g1.sh
|
100 |
+
```
|
101 |
+
## Data
|
102 |
+
TBD
|
103 |
+
## Evaluation
|
104 |
+
TBD
|
105 |
+
## Acknowledgement
|
106 |
+
We use [verl](https://github.com/volcengine/verl) as the codebase to build our training framework.
|
107 |
+
## Citation
|
108 |
+
If you are interested in our work, please cite:
|
109 |
+
```
|
110 |
+
@article{zha2025vision,
|
111 |
+
title={Vision-G1: Towards General Vision Language Reasoning with Multi-Domain Data Curation},
|
112 |
+
author={Zha, Yuheng and Zhou, Kun and Wu, Yujia and Wang, Yushu and Feng, Jie and Xu, Zhi and Hao, Shibo and Liu, Zhengzhong and Xing, Eric P and Hu, Zhiting},
|
113 |
+
journal={arXiv preprint arXiv:2508.12680},
|
114 |
+
year={2025}
|
115 |
+
}
|
116 |
+
```
|