NVIDIA-NeMo/RL #4818,
one line in vllm_worker_async.py. Permalinks pin head f0d9860e; the old line is linked at base f0639c60.
None as its image tensors, and the call staged normally.dict(...) so top-K columns can be added to the same mapping. dict(None) raises.Six pages on this PR, one question each โ this one: the image-capture regression.
CapturedMedia(items, tensors)
(_capture_request_media).
tensors holds only the images that are new in this call. Gym sends the whole conversation, so an earlier turn's image is in the prompt again, but that earlier call already staged it: it is only checked, not staged again (captured_media.py L380).
So when a call adds no image, tensors is None
(capture_processed_media,
type dict | None).Why a score-centering PR touched image capture. Score centering has to ship vLLM's top-K tensors
from the vLLM worker to the data plane. The PR's first version did that with a second, separate write, and its own self-review
flagged that a failure there was only logged. The fix, commit
0be78315e, moved the top-K tensors into the
existing single write, through the attachments mapping. Until then, that mapping only ever held image tensors. To add two
more keys, the code copies the image mapping with dict(...). That copy assumes the image tensors are always a mapping,
but they are None whenever a call adds no new image. The crash is collateral damage from sharing that slot, and it fires
with score centering off because the copy runs on every captured call.
Running the real _finish_request_capture from each commit with
media=CapturedMedia((), None) and centering off: base stages with attachments=None;
head raises TypeError and leaves no capture state behind. The existing VLM token-capture functional
tests send one image per call, so they never build a call with tensors=None.
Which calls crash. Every captured call that adds no new image. Two patterns:
| Images arrive on turns | Calls with no new image (crash) | Rollout dies at |
|---|---|---|
| 1, 5, 10 | 2, 3, 4, 6, 7, 8, 9 (earlier images are in the prompt but already staged) | turn 2 |
| 6, 7, 8 (text before that) | 1, 2, 3, 4, 5 (no images at all yet) | turn 1 |
Where the fix lands: RL only, one line plus a unit test.
vllm_worker_async.py L968.
No Gym change: Gym already accepts attachments=None, as the base code relied on.
@@ vllm_worker_async.py L968 ยท _finish_request_capture ) - attachments = dict(state.media.tensors) if state.media is not None else {} + attachments = dict(state.media.tensors or {}) if state.media is not None else {} if sampler_topk is not None: attachments.update(
With the fix, turn 2 builds {}; with centering off it stays empty and
attachments or None a few lines below
(L978-L982)
passes None, exactly as before the PR; with centering on it holds only the two top-K tensors.
Proposed in the review; not yet applied by the author. A unit test should call
_finish_request_capture with CapturedMedia((), None) and check that the call is staged.
capture_failed to recover from. It does not need score centering
to be on, so it reaches users who never touch the new feature.