[feat] Initial support for VLMs, add Qwen2.5VL GRPO example #386
+774
−104
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR migrates the feature of RL on VLMs in our implementation in EasyR1 fork back to veRL. We have validated this feature using Qwen2.5-VL 7B model on 8*H100 GPUs. The configuration and data processing script are provided along this PR for easy reproducing.
How to reproduce?
python3 examples/data_preprocess/geo3k.py --local_dir ~/data/geo3k
Dependencies
Major Changes
New dataflow for multimodal RL
In this PR, we introduce two new concepts in the dataflow,
multi_modal_data
andmulti_modal_inputs
. The former means the multi-modal features required by the rollout worker (such as vLLM), while the latter means the multi-modal features required by the actor/critic worker (such as an HF model). They are different because the rollout and actor workers have their own data format requirements.Taking Qwen2-VL + huggingface + vLLM as an example, the data structure should be:
Both of them are converted to numpy objects and placed in the non-tensor batch in DataProto.
This design can be extended to other modalities/VLMs easily due to the agnostic of models.
Other changes
Data
config.data.image_key
, which should be a list of Pillow images.Actor/Ref/Critic
multi_modal_inputs
.Rollout
multi_modal_data
.raw_prompt_ids
as the vLLM inputs to avoid unpadding the input ids.Reward Manager
Models
Sharding Manager
FSDP Workers / Checkpoint Merger
AutoModelForVision2Seq
at model initialization.Note: The Ulysses parallelism is not completed yet. We will support it in the next update.
Performance
We provide the estimated MFU of the language model part for H100 GPUs. These values are lower than the actual ones because we did not compute the FLOPs of the vision tower part.
remove_padding=False
: MFU ~7%remove_padding=True
: MFU ~20%The training and test reward score curves are presented as follows.
Who can review?
@vermouth1992 @PeterSH6