Repository navigation
Conversation
(cherry picked from commit f57f6adc4798334005d81ec7514e34737ebc62eb) Signed-off-by: Anish Mahishi <[email protected]>
Signed-off-by: Anish Mahishi <[email protected]>
…fu/gym_yields_rollouts
…biguation Port the internal async-GRPO rework (1f0eda7de) and its follow-up fix (5dd399698) onto a mopd_gym_bump + format_penalty base, adapted to main's package layout, typed MasterConfig, effort-shaping, and reward penalties. NeMo-Gym now streams rollouts: - nemo_gym.py: run_rollouts is an async generator yielding (rowidx, result, timing) per completed task; NaN logprobs fail loudly (no whole-batch retry). - rollouts.py: run_async_nemo_gym_rollout is an async generator yielding one AsyncNemoGymRolloutResult per prompt group (extracted _postprocess_single_group, which applies effort shaping + reward penalties per group). A new run_nemo_gym_rollout_sync drains it for synchronous callers, preserving input ordering via returns_entire_batch. - trajectory_collector.py: one worker thread per batch (was per prompt) consuming the per-group stream with create_task fan-out; the inflight semaphore is removed and per-target accounting reworked. The MOPD teacher-logprob block runs off the event loop via asyncio.to_thread. Duplicate-prompt fix (5dd399698): stamp a unique monotonic _ng_task_index per prompt group into extra_env_info and carry it into the buffered trajectory and forward group_num to NeMo-Gym, so identical prompts in one batch no longer collide in genrm_compare. The counter is checkpointed via rollouts.pt. The non-gym async rollout path is preserved (1f0eda7de had dropped it): the worker runs one batched run_async_multi_turn_rollout and slices it into per-group pushes. All run_rollouts consumers were updated for the generator API: - six synchronous run_async_nemo_gym_rollout call sites (grpo_train, validate, distillation x2, ppo, sync TQ rollout actor) route through run_nemo_gym_rollout_sync; - rollout_manager.py drains the streaming generator; - the gym actor run_rollouts consumers (rollouts.py, test_nemo_gym_sanity) iterate the streaming ObjectRefGenerator. Tests: per-group group_num metadata test, rollouts-state checkpoint test, updated the generator-shaped rollout tests, the Strategy-2 _process_batch tests, and the gym sanity test. Validated on GPU: 3 gym integration tests pass (gym sanity, streaming rollout, rollout manager). Signed-off-by: Yi-Fu Wu <[email protected]>
yfw
force-pushed
the
yifu/gym_yields_rollouts
branch
from
June 27, 2026 06:40
00e27c7 to
3f2b8ac
Compare
…e gym test Restore the transient-failure retry (MAX_RETRIES=3, exponential backoff) in AsyncTrajectoryCollector._run_prompt_group_worker that was dropped when porting the streaming rollout rework. A single transient gym failure mid-stream previously dropped trajectories with no recovery while still marking the batch complete. Add a buffered_keys dedup set (keyed by _ng_task_index on the gym path, group index otherwise) so a retry regenerates the batch but skips groups already buffered -- restoring resilience without re-pushing duplicate trajectories (a latent double-push hazard in the internal source's own retry). Also fix test_async_nemo_gym_rollout_manager_matches_original, which still called the now-async-generator run_async_nemo_gym_rollout synchronously and read .final_batch; it now uses run_nemo_gym_rollout_sync. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Signed-off-by: Yi-Fu Wu <[email protected]>
Contributor
Author
|
Merged as #3000 |
This was referenced Sep 26, 2026
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.
What does this PR do ?
Add a one line overview of what this PR aims to accomplish.
Issues
List issues that this PR closes (syntax):
Usage
# Add a code snippet demonstrating how to use thisBefore your PR is "Ready for review"
Pre checks:
Additional Information