fix(vlm): use the vLLM prompt keys in async rollouts - #4151
Conversation
main is import-broken at 806e9d1: 4d969c9 (#3803) consolidated the per-media vllm_images/vllm_videos/vllm_audios rows into one vllm_multi_modal_data dict and replaced NATIVE_MULTIMODAL_KEYS with VLLM_PROMPT_KEYS, while 26f3b19 (#4113), merged afterwards, imports NATIVE_MULTIMODAL_KEYS in the async rollout manager. Every import of nemo_rl.experience.rollout_manager (and so of the single-controller setup) fails with ImportError, and the Lint check on main is red. Collect the vLLM prompt side channels with VLLM_PROMPT_KEYS, matching the sync rollout path, and update the two #4113 tests to the consolidated vllm_multi_modal_data key; the old per-media keys are asserted not to be forwarded. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
|
/ok to test 7444b9a |
|
/ok to test 7444b9a |
yfw
left a comment
There was a problem hiding this comment.
PR #4151 — team review (rl-expert, bug-finder, test-agent, design-reviewer, devil-advocate)
LGTM, no inline comments. The fix restores the import that #3803 (4d969c9) deleted and #4113 (26f3b19) re-added 37 minutes later without a CI re-run. VLLM_PROMPT_KEYS is the same-hunk replacement; the only producer of these side channels, vlm_hf_data_processor, already emits the two consolidated keys, and no producer or consumer of the per-media keys remains anywhere in the repo, docs, or the Gym submodule. A compatibility alias would have been wrong: an alias to the old set silently drops vllm_multi_modal_data on the async VLM path.
Verified (CPU-only host, no vLLM):
- Lint check is red on main at 806e9d1 and at b03da0f, green on this head;
pre-commit run --all-filespasses every hook here. - The whole
tests/unit/experience/directory passes at head: 388 passed, 1 skip (nemo_gymnot installed).test_vllm_utils.py(41) andtest_collate_fn.py(9) pass alongside. - The multi-turn test's
vllm_imagescontrol has teeth: a nine-mutant matrix over the two modified tests shows it is the only assertion that fires when a per-media key regrows into the constant or the filter becomes forward-everything. - Eight DatumSpec shapes (text-only, truncated, media, placeholder-style, multi-item lists, empty values, content-only, no keys) on turn 1 and later turns hand
format_prompt_for_vllm_generationidentical prompts from the async manager and the sync path; two end-to-end_run_single_rolloutruns match. A{prompt_token_ids, multi_modal_data}prompt is a validTokensPromptat the pinned vLLM 0.25.1 (vllm/inputs/llm.py#L106-L109).
Not verified: a GPU end-to-end async VLM rollout; the formatter is shared with the sync path, so nothing here is new to vLLM.
Process note, not a PR ask: branch protection requires only DCO and the quality check with strict: false, and the up-to-date job tolerates ten commits behind, so lint never ran on #4113 against the post-#3803 main. Requiring branches to be up to date, or a merge queue with Lint required, would have caught this class; no code seam would.
Generated by Claude Code
What does this PR do?
Main is import-broken at 806e9d1: #3803 (4d969c9) consolidated the per-media
vllm_images/vllm_videos/vllm_audiosrows into onevllm_multi_modal_datadict and replacedNATIVE_MULTIMODAL_KEYSwithVLLM_PROMPT_KEYS, while #4113 (26f3b19), merged afterwards, importsNATIVE_MULTIMODAL_KEYSinnemo_rl/experience/rollout_manager.py. Every import of the async rollout manager, and therefore of the single-controller setup, fails withImportError: cannot import name NATIVE_MULTIMODAL_KEYS, and the Lint check on main is red.This PR collects the vLLM prompt side channels with
VLLM_PROMPT_KEYS, matching the sync rollout path inrollouts.py, and updates the two #4113 tests to the consolidatedvllm_multi_modal_datakey (the droppedvllm_imageskey is asserted not to be forwarded).Test plan
python -c "import nemo_rl.experience.rollout_manager, nemo_rl.algorithms.single_controller_utils.setup"succeeds (fails on main).tests/unit/experience/test_rollout_manager.py -k "generate_response or single_rollout or GenerateAndPush": 22 passed on a CPU-only host.🤖 Generated with Claude Code