Repository navigation
build(deps): make Ray an optional dependency - #4350
Merged
Merged
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Contributor
|
🌿 Preview your docs: https://nvidia-preview-pr-4350-7c54b11affa0.docs.buildwithfern.com/nemo/gym |
hemildesai
approved these changes
Oct 10, 2026
hemildesai
approved these changes
Oct 10, 2026
ananthsub
force-pushed
the
ananthsub/ray-optional-dependency
branch
from
October 12, 2026 13:49
cfb3737 to
9d5360e
Compare
Contributor
Author
|
/ok to test 9d5360e |
ananthsub
force-pushed
the
ananthsub/ray-optional-dependency
branch
from
October 13, 2026 23:36
9d5360e to
4b25988
Compare
Contributor
Author
|
/ok to test 4b25988 |
chtruong814
approved these changes
Oct 13, 2026
ananthsub
enabled auto-merge
October 13, 2026 23:39
This was referenced Oct 13, 2026
khazic
pushed a commit
to khazic/Gym-lao
that referenced
this pull request
Oct 14, 2026
…dules (NVIDIA-NeMo#4581) ## What changed `responses_api_agents/stirrup_agent/__init__.py` now loads the agent module (`app.py`) only when one of the agent classes (`StirrupAgentWrapper`, `StirrupAgentWrapperConfig`, `StirrupRunRequest`) is accessed. Before, it imported `app.py` eagerly, so importing any stirrup_agent helper module loaded the whole agent. `TaskStrategy` is still imported directly, since it's lightweight. ## Why gdpval doesn't use Ray, but it imports two stirrup_agent helper modules: - `file_reader`, in `app.py`, to read deliverables during `verify`; - `task_distribution`, in `multistage_elo.py`. Because the package `__init__.py` imported the agent, and the agent imports Ray at module level, those imports needed Ray. Every server venv used to have Ray, so this went unnoticed. With NVIDIA-NeMo#4350, which makes Ray an optional dependency, gdpval's venv no longer has Ray. gdpval's tests then fail with `No module named 'ray'`, and so would `verify` for any task with a deliverables directory. This unblocks NVIDIA-NeMo#4350. Nothing in the repository imports the agent classes through the package; callers import submodules directly. Accessing `responses_api_agents.stirrup_agent.StirrupAgentWrapper` still works. ## Validation All of the following ran on NVIDIA-NeMo#4350's head with this change applied: - **gdpval's tests, without Ray:** in a venv built from `resources_servers/gdpval/requirements.txt`, the `pytest tests` run passes. With the previous `__init__.py` in the same venv, the gdpval failures from NVIDIA-NeMo#4350's CI reproduce. - **stirrup_agent's tests, with Ray:** in a venv built from `responses_api_agents/stirrup_agent/requirements.txt` and its `overrides.txt`, the `pytest tests` run passes. - **Imports in an environment without Ray:** - `responses_api_agents.stirrup_agent.file_reader` and `responses_api_agents.stirrup_agent.task_distribution` import cleanly, where they previously failed; - with Ray installed, `from responses_api_agents.stirrup_agent import StirrupAgentWrapper, StirrupRunRequest, TaskStrategy` still works. - `pre-commit run` on the changed file. ## Rollout evidence N/A. This only changes when the agent module is imported. The agent's behavior, prompts, trajectories, verification and rewards are unchanged. ## Compatibility None. Package-level access to the agent classes behaves as before. The agent module now loads on first access instead of at package import. Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
Move `ray[default]` and its `jinja2` pin out of nemo-gym's core dependencies into the `ray` extra, so a plain `pip install nemo-gym` no longer installs Ray. Gym already runs without Ray, and the servers that declare `ray_enabled = True` request the extra in their own manifests. - CI: the core unit-test, unit-test and full-test-suite syncs add `--extra ray`, so Ray code paths stay tested. The wheel smoke test and server-test setup stay without it. - Docker: the image builds add `--extra ray`. - Tests: the Ray Serve gateway test and the Super 3.5 launcher's prebuilt-environment check skip when Ray isn't installed. - Docs: installation, development setup and FAQ describe the extra. Closes #4316. Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
ananthsub
force-pushed
the
ananthsub/ray-optional-dependency
branch
from
October 14, 2026 14:54
4b25988 to
7c54b11
Compare
Contributor
Author
|
/ok to test 7c54b11 |
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/38587741688 |
qiaochuz-nv
added a commit
that referenced
this pull request
Oct 15, 2026
… deliverables dir The GDPVal run recipe could not work as written on main: - The benchmark config defaults persist_deliverables_dir to the relative output/gdpval/deliverables, which the Stirrup agent rejects at startup. - With an absolute PERSIST_DELIVERABLES_DIR, every task fails with "GDPval requires the Apptainer sandbox" because GDPVAL_CONTAINER_PATH is unset; the run then stops with "None of the N dispatched rollouts produced a result" and no aggregate metrics. - Since Ray became an optional extra (#4350), a `uv sync --extra dev` install stops before the run because the Stirrup agent needs Ray. Add a "Prerequisites for every run" section to the benchmark README and the config's run recipe. Correct the Stirrup README, which still called Apptainer optional, said the agent falls back to a local sandbox, and installed Gym without Ray, and fix the aggregate-metrics filename (<stem>_aggregate_metrics.json) in both READMEs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: qiaochuz <qiaochuz@nvidia.com>
This branch was previously deployed
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.
Closes #4316.
What changed
ray[default]and itsjinja2pin move out of nemo-gym's core dependencies and live only in therayextra (also part ofall). A plainpip install nemo-gymno longer installs Ray.pyproject.tomlanduv.lock. The lockfile change is metadata only; Ray andjinja2stay locked through the extra, and no package versions move.scripts/ci/core_unit_tests.sh, plus the unit-test and full-test-suite syncs, add--extra ray, so Ray code paths stay tested and stay in the coverage gate.--extra ray. Theray_dist.jarremoval for the CVE is unchanged.tests/unit_tests/test_ray_serve_gateway.py, because the gateway imports Ray Serve at module level;rayextra, and the FAQ no longer says Ray is a core dependency.Why
This is the last step of #3669. Earlier changes made Gym run without Ray (#4300), had Ray servers request the extra (#4301), and made servers run without Ray unless they declare
ray_enabled = True(#4307). The only remaining reason every install got Ray was nemo-gym's own core dependency.Validation
uv build --wheelgivesRequires-Dist: ray[default]>=2.58.0; extra == "ray"andRequires-Dist: jinja2>=3.1; extra == "ray", with no unconditional Ray requirement.uv sync --locked --extra devgives an environment where neitherraynorjinja2is importable, andgym --versionreports"ray": "not installed".tests/unit_tests/run,-m "not sandbox"as in the core CI job. I built the core CI job's environment (dev,telemetry,mlflow,wandb) twice:--extra ray, everything passes.fern checkpasses.pre-commit runscoped to the changed files.Rollout evidence
N/A. This changes which packages a default install includes. It doesn't change prompts, model requests, trajectories, verification or rewards. #4300 smoke-tested
gym env startwith Ray uninstalled.Compatibility
This is a breaking packaging change and needs a release note (#4317):
ray_enabled = True(such aslocal_vllm_model,genrm_modelor the SWE agents) needspip install "nemo-gym[ray]", oruv sync --extra ray, wheregymruns. Without it,gym env startstops before launching anything and says so.gymruns.nemo-gym[ray]in their manifests.