Skip to content

Commit f4916c2

Browse files
author
Ruochen Xu
committed
update README
1 parent 0065154 commit f4916c2

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,54 @@ pip install -e ".[torch,metrics]"
8686
llamafactory-cli train examples/train_full/qwen2_5_vl_full_sft.yaml
8787
```
8888

89+
### For you own data
90+
We also support data loading the jsonl data of this format in [`src/open-r1-multimodal/src/open_r1/grpo_jsonl.py`](src/open-r1-multimodal/src/open_r1/grpo_jsonl.py).
8991

92+
The jsonl has the format as follows:
93+
```json
94+
{"id": 1, "image": "Clevr_CoGenT_TrainA_R1/data/images/CLEVR_trainA_000001_16885.png", "conversations": [{"from": "human", "value": "<image>What number of purple metallic balls are there?"}, {"from": "gpt", "value": "0"}]}
95+
```
96+
97+
Note: The image path in the jsonl file should be relative to the image folder specified in `--image_folders`. The absolute path of the input image is constructed as `os.path.join(image_folder, data['image'])`. For example:
98+
- If your jsonl has `"image": "folder1/image1.jpg"`
99+
- And you specify `--image_folders "/path/to/images/"`
100+
- The full image path will be `/path/to/images/folder1/image1.jpg`
101+
102+
Multiple data files and image folders can be specified using ":" as a separator:
103+
```bash
104+
--data_file_paths /path/to/data1.jsonl:/path/to/data2.jsonl \
105+
--image_folders /path/to/images1/:/path/to/images2/
106+
```
90107

108+
The script can be run like this:
109+
```bash
110+
torchrun --nproc_per_node="8" \
111+
--nnodes="1" \
112+
--node_rank="0" \
113+
--master_addr="127.0.0.1" \
114+
--master_port="12345" \
115+
src/open_r1/grpo_jsonl.py \
116+
--output_dir output/$RUN_NAME \
117+
--model_name_or_path Qwen/Qwen2.5-VL-3B-Instruct \
118+
--deepspeed local_scripts/zero3.json \
119+
--dataset_name <your_dataset_name> \
120+
--data_file_paths /path/to/your/data.jsonl \ # can be multiple, seperated by ":"
121+
--image_folders /path/to/your/image/folder/ \ # can be multiple, seperated by ":"
122+
--max_prompt_length 1024 \
123+
--per_device_train_batch_size 1 \
124+
--gradient_accumulation_steps 2 \
125+
--logging_steps 1 \
126+
--bf16 \
127+
--report_to wandb \
128+
--gradient_checkpointing True \
129+
--attn_implementation flash_attention_2 \
130+
--max_pixels 401408 \
131+
--num_train_epochs 2 \
132+
--run_name <your_run_name> \
133+
--save_steps 100 \
134+
--save_only_model true \
135+
--num_generations 8
136+
```
91137
## Evaluation
92138

93139
![image](./assets/data.png)

0 commit comments

Comments
 (0)