feat: overlap NeMo Gym init with vLLM init - #2741
Merged
Merged
Conversation
Point 3rdparty/Gym-workspace/Gym at the current tip of NVIDIA-NeMo/Gym main in preparation for converging NeMo-Gym init to the ultra-v3 final state. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com> Co-Authored-By: Felipe Vieira Frujeri <ffrujeri@nvidia.com> Co-Authored-By: Peter Jin <pjin@nvidia.com> Co-Authored-By: Yashaswi Karnati <ykarnati@nvidia.com>
Port the deferred-load mechanism from the ultra-v3 lineage (eb401ba), adapted to main's refactored vLLM workers: - VllmGeneration: defer_model_load flag; when set, workers only reserve ports and dp_openai_server_base_urls is populated immediately via _collect_reserved_urls(); load_and_start() performs the heavy load later. - BaseVllmGenerationWorker: split __init__ into _init_config()/_apply_vllm_patches() /_load_model(); patches now applied for all workers (incl. non-owners). - VllmAsyncGenerationWorker: reserve a listening socket in __init__ and hand it to uvicorn via server.serve(sockets=) (no close/rebind race); load_model() and get_reserved_url() added. - Add test_vllm_deferred_model_load. Enables overlapping vLLM model loading with NeMo Gym spinup. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com> Co-Authored-By: Felipe Vieira Frujeri <ffrujeri@nvidia.com> Co-Authored-By: Peter Jin <pjin@nvidia.com> Co-Authored-By: Yashaswi Karnati <ykarnati@nvidia.com>
Converge NemoGym to the ultra-v3 final shape (c722c91, post-f9cce2ae cleanup): - Move the head-server/rollout-helper startup out of __init__ into an explicit _spinup() so the actor can be created cheaply and spun up once vLLM server URLs are ready (overlapping with vLLM model load). - Add NemoGymConfig.ray_num_gpus_per_node and ray_namespace; surface them into the gym global config when set. (No ray_gpu_nodes/ray_gpu_pgs — removed by the pipeclean cleanup.) - Remove health_check; callers now use _spinup as the blocking spinup wait. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com> Co-Authored-By: Felipe Vieira Frujeri <ffrujeri@nvidia.com> Co-Authored-By: Peter Jin <pjin@nvidia.com> Co-Authored-By: Yashaswi Karnati <ykarnati@nvidia.com>
Converge grpo.setup() to the ultra-v3 gym-init shape (c722c91 + eb401ba, post-f9cce2ae cleanup), so NeMo Gym spinup overlaps vLLM model loading and so future ultra cherry-picks land cleanly: - When NeMo Gym is enabled, reserve vLLM ports via deferred model load, then run init_vllm/init_policy/init_nemo_gym concurrently via ThreadPoolExecutor (sequential when colocated). init_nemo_gym builds NemoGymConfig with the reserved URLs + ray_num_gpus_per_node/ray_namespace and calls actor._spinup(). - setup() now returns the gym actor (3rd element); run_grpo_nemo_gym.py consumes it instead of building/health-checking the gym itself. - Non-gym vLLM/SGLang/Megatron paths keep main's existing initialize_generation_with_policy flow. Cluster creation is unchanged (gym scheduling via soft NodeAffinity); GPU-node reservation is a follow-up. - invalid_tool_call_patterns/thinking_tags are preserved as NemoGymConfig fields. Excludes the tabled gym-venv-caching (05eb916) so it can be applied separately. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com> Co-Authored-By: Felipe Vieira Frujeri <ffrujeri@nvidia.com> Co-Authored-By: Peter Jin <pjin@nvidia.com> Co-Authored-By: Yashaswi Karnati <ykarnati@nvidia.com>
Apply ruff format to the deferred-load changes and remove the unused `ray` import in run_grpo_nemo_gym.py (the health_check call it served was removed now that the gym actor is spun up inside setup()). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com> Co-Authored-By: Felipe Vieira Frujeri <ffrujeri@nvidia.com> Co-Authored-By: Peter Jin <pjin@nvidia.com> Co-Authored-By: Yashaswi Karnati <ykarnati@nvidia.com>
yfw
commented
Jun 8, 2026
- setup() returns an 11-tuple (the NeMo-Gym actor is at index 2). Update the three non-gym callers (run_grpo, run_grpo_sliding_puzzle, run_vlm_grpo) to unpack the extra element so they don't fail with a ValueError, and fix the setup() docstring, which listed a stale tuple. - Drop the dead ray_namespace / ray_num_gpus_per_node gym config fields: the pinned Gym (9b52dc8) has zero references to them, so they were set into the gym global config but silently ignored. Keep ray_head_node_address, which the Gym does consume. The _apply_vllm_patches() non-owner write race is handled separately by #2739, which lands before this PR. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
Contributor
Author
|
/ok to test 165ac4f |
yfw
added a commit
that referenced
this pull request
Jun 9, 2026
- setup() returns an 11-tuple (the NeMo-Gym actor is at index 2). Update the three non-gym callers (run_grpo, run_grpo_sliding_puzzle, run_vlm_grpo) to unpack the extra element so they don't fail with a ValueError, and fix the setup() docstring, which listed a stale tuple. - Drop the dead ray_namespace / ray_num_gpus_per_node gym config fields: the pinned Gym (9b52dc8) has zero references to them, so they were set into the gym global config but silently ignored. Keep ray_head_node_address, which the Gym does consume. The _apply_vllm_patches() non-owner write race is handled separately by #2739, which lands before this PR. Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com>
Contributor
Author
|
/ok to test 86ebabb |
4 tasks
Contributor
Author
|
/ok to test 86ebabb |
Contributor
Author
|
/ok to test d00a5e1 |
Contributor
Author
|
/ok to test d00a5e1 |
ananthsub
approved these changes
Jun 10, 2026
yfw
enabled auto-merge (squash)
June 10, 2026 17:56
4 tasks
pengdurice
pushed a commit
to pengdurice/RL
that referenced
this pull request
Jun 12, 2026
Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Felipe Vieira Frujeri <ffrujeri@nvidia.com> Co-authored-by: Peter Jin <pjin@nvidia.com> Co-authored-by: Yashaswi Karnati <ykarnati@nvidia.com>
ashors1
pushed a commit
that referenced
this pull request
Jun 27, 2026
Signed-off-by: Yi-Fu Wu <yifu.wu@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Felipe Vieira Frujeri <ffrujeri@nvidia.com> Co-authored-by: Peter Jin <pjin@nvidia.com> Co-authored-by: Yashaswi Karnati <ykarnati@nvidia.com> Signed-off-by: Anna Shors <ashors@nvidia.com>
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 ?
Pulls in and squashes several commits from the super / ultra branches related to gym and vllm startup. Includes a Gym bump to latest
main. Pulled in the commits together and squashed because several early commits were later partially un-done by the "Pipeclean GenRMModel flow and local_vllm_model use" MR (f9cce2ae33776de372a7a7801de5b933c495fe45).Claude generated description below:
Re-architect NeMo-Gym startup so the gym is created inside grpo.setup() and its spin-up overlaps vLLM/policy initialization: vLLM does a deferred model load (reserve ports first), the gym actor starts via _spinup(), and vLLM + policy + gym initialize concurrently via init_tasks. This converges main's NeMo-Gym init to the ultra-v3 final shape.
Changes:
Provenance — ultra-v3-posttraining gym-init series (public GitHub, NVIDIA-NeMo/RL):
Reflected in this branch (net):
- Support for ray spinup within gym:
c722c91
- overlap NeMo Gym init with vLLM init:
eb401ba
In the series but UNDONE by the Pipeclean GenRMModel commit, so intentionally NOT in this branch:
- add genrm rlhf to gym:
5bbf159
- Fix genrm for async gym:
3f391da
- Fix for ray state API usage (list_nodes with limit):
5c6d5e4
- fix genrm reasoning off:
48fe510
- Pass explicit PG to gym:
46e5ec5
Final state defined by:
Update (2026-06-09): Separate the vllm deferred load changes to a separate PR: #2750
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