Repository navigation
Conversation
Closes NVIDIA-NeMo#2305. When the NeMo-Gym agent crashes silently (e.g. CPU OOM during rollout collection on oversized batches), `run_rollouts.remote(...)` may return fewer results than input rows. The previous code accepted the mismatch and built a partial `final_batch` from whatever came back, producing "empty epochs" downstream — training continued without crashing, masking the underlying agent failure. `run_async_nemo_gym_rollout` now compares `len(results)` against `len(nemo_gym_rows)` immediately after the `ray.get`, and raises a `RuntimeError` naming the size mismatch, the likely cause (silent OOM / crash inside Gym), where to look (Gym agent logs), and which knobs to turn (`grpo.num_prompts_per_step`, `grpo.num_generations_per_prompt`, per-row `max_output_tokens`). The check is O(1) and never fires on the success path, where Gym returns exactly one result per input row. Added a regression test (`test_run_async_nemo_gym_rollout_raises_on_silent_agent_failure`) that monkeypatches `ray.get` to return both a short-by-one and a fully empty result list, asserting the RuntimeError fires with the expected message in both cases. Signed-off-by: Shubhankar Tripathy <[email protected]>
Contributor
Author
|
Closing as a duplicate of #2394 — same issue (#2305), better layer. #2394 patches |
DanialTaheri
added a commit
that referenced
this pull request
Aug 21, 2026
The image tools env landed upstream as squash-merge 4a582181
("Add image tools agent and PivotRL verifier", NVIDIA-NeMo/Gym#2624), plus
follow-up 0951c9b1 ("fix(ci): make image tools agent discoverable", #2643)
which adds responses_api_agents/image_tools_agent/README.md. Neither of the
branch's own commits is an ancestor of main, so the previous pointer at
8c53f682 referenced a fork-only commit that upstream CI cannot fast-forward to.
Pointing at origin/main (fa0d2515) instead. Verified this tree carries every
fix from the branch: the asyncio.to_thread wrapper around
process_nonterminal_turn, the corrected response-model keys in the agent test
(zero remaining references to the non-existent image_tool_call_count), and
both data/example_rollouts.jsonl and data/example_metrics.json.
Signed-off-by: DanialTaheri <[email protected]>
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.
Summary
Closes #2305.
When the NeMo-Gym agent crashes silently — most commonly CPU OOM during rollout collection on oversized batches — `run_rollouts.remote(...)` may return fewer results than input rows. The previous code accepted the mismatch and built a partial `final_batch` from whatever came back, producing "empty epochs" downstream. Training continued without crashing, masking the underlying agent failure (exactly what was reported in #2305).
What changed
`run_async_nemo_gym_rollout` in `nemo_rl/experience/rollouts.py` now compares `len(results)` against `len(nemo_gym_rows)` immediately after the `ray.get` and raises a `RuntimeError` if they don't match:
```
RuntimeError: NeMo-Gym returned 0 rollout result(s) for 1024 input row(s).
This usually means the Gym agent crashed silently (most commonly CPU OOM
during rollout collection for large batches). Check the Gym agent logs
for OOM / killed-process messages and consider reducing
grpo.num_prompts_per_step * grpo.num_generations_per_prompt, or the
per-row max_output_tokens, to fit available memory.
```
The error names the size mismatch, the likely cause, where to look (Gym agent logs), and which knobs to turn. The check is O(1) and only fires on the failure path; the success case (one result per input row) is unaffected.
Test plan
Refs: #2305