Repository navigation
fix(verl): match rollout alpha compositing for RGBA images - #701
Open
Chao Wang (chaoworks) wants to merge 1 commit into
Open
Chao Wang (chaoworks) wants to merge 1 commit into
Chao Wang (chaoworks) wants to merge 1 commit into
Conversation
Signed-off-by: Chao Wang <132262609+chaoworks@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the change aligning training image decoding with rollout behavior.
No open issues 🎉
What changed in this PR
This PR aligns training image decoding with vLLM’s default rollout behavior by compositing RGBA images onto white, preventing mismatched vision inputs between rollout and training.
Changes:
- Applies shared image conversion across data, file, and HTTP(S) URLs while preserving conversion for other image modes.
- Adds six regression cases covering RGB and RGBA images across supported URL paths.
- Documents pre-compositing for servers using custom background colors.
| File | Description |
|---|---|
tests/verl/test_rollout_adapter.py |
Adds pixel-level regression coverage for RGB and RGBA decoding. |
docs/80-example-multimodal-qa.md |
Explains white compositing and custom-background handling. |
agentlightning/verl/rollout_adapter.py |
Unifies decoding and composites RGBA images onto white. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem and change
A transparent PNG is decoded differently during rollout and training. The recommended vLLM 0.20.2 backend composites RGBA images onto a white background;
_load_pil_image()currently callsconvert("RGB"), which discards alpha and exposes the hidden RGB channels. For example,(10, 20, 30, 0)becomes white for rollout but(10, 20, 30)for training. The generated response/logprobs are therefore paired with different vision inputs when constructing the training batch.Composite RGBA onto white after decoding any supported URL scheme (
data:,file://, HTTP(S)). Keep the existing conversion for other image modes. Document how to pre-composite images when a serving deployment uses a custom background color.This is a source-audited bug with a deterministic reproduction. The reference behavior is in vLLM 0.20.2's image conversion and ImageMediaIO; that backend version is recommended in this repository's installation guide.
Validation
bc3a9e8: 3 failed, 3 passed; with the fix: all six pass.uv run --locked --no-sync pytest -q tests→ 247 passed, 4 skipped.Qwen2VLImageProcessorPil. Before: maximumpixel_valuesdifference 3.5766143798828125. After: image bytes,pixel_values(shape[12, 1176]), andimage_grid_thwmatch exactly.mkdocs build --strictanduv build --no-sourcespass.No GPU model rollout or RL training was run; the reproduction exercises image decoding and actual vision preprocessing on CPU. Custom serving background colors are not inferred from rollout events; pre-compositing to RGB keeps those deployments consistent, as documented.
AI assistance was used for implementation and validation. The diff and caller behavior were reviewed before submission.