Repository navigation
refactor(data): move the task data modules into nemo_gym/data - #5229
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. |
4e5fd0d to
7fbc336
Compare
7fbc336 to
2211ddb
Compare
d2dd82f to
e98feeb
Compare
e98feeb to
99b65c6
Compare
99b65c6 to
22081c4
Compare
yaoyu-33
left a comment
There was a problem hiding this comment.
Thanks for the careful move. We found no blockers or risks. There are two small inline NOTEs and a few summary-only notes below. Verdict: SHIP.
What we checked at 419155a0
- The move is mechanical. Every renamed module is AST-identical to its old version apart from imports and docstring paths. Every rewritten import (435 distinct bindings) resolves to the same object at the old and new path. The hand edits are the ones the body lists, plus the Harbor imports in note 1 below.
- Old paths keep working. All 44 old modules (the nine modules,
tasks,tasks.harborand its 33 submodules) resolve to the identical module object with a DeprecationWarning. Nomock.patch/monkeypatchtarget in the repo stops taking effect, so the #5166 list for this PR is empty. - The task-data contract is unaffected. No in-repo
task_data.pyschema importsnemo_gym;load_task_data_schemaloads them by file path. A third-party schema that still usesfrom nemo_gym.task_data import ...loads, with one warning.import nemo_gym.data.task_datapulls in no third-party module beyond whatnemo_gym.task_datadid.normalize_task_fields,RESERVED_ROW_KEYSand the legacy-field map moved byte-identically. - Layers and the tarball.
lint-importsis KEPT, and none of the five renamed exceptions is stale. The harness_agent tarball now shipsnemo_gym/data/and still leaves out the agent's owndata/; the new test fails if either regresses. - Unit suite. No failures are caused by this PR, including a run with the moved-path DeprecationWarnings as errors. Every local failure also fails on the base tree or needs an extra / Linux.
- CI is green except the non-blocking Harness conformance job, which fails on the kilocode
model_errorprobe as on the earlier stack PRs.
Notes not tied to a diff line
- Harbor names re-exported by
nemo_gym.data.tasks.harbor.scripts/migrate_imports.py(Migrator._destinations) writesfrom nemo_gym.data.tasks.harbor import HarborTask, load_taskfor these names. The 17environment_servers/harborfiles here were converted by hand tofrom nemo_gym.data import ...instead, so open branches that run the script get the sub-package form.test_code_outside_the_library_imports_exported_names_from_the_public_apikeys on the module path in_PUBLIC_API, so it accepts the sub-package form.- The same test also accepts
from nemo_gym.data.tasks.harbor.digest import DIGEST_KEY(environment_servers/harbor/tests/test_app.py:77,environment_servers/harbor/tests/test_identity.py:12), becausenemo_gym/data/__init__.py:76mapsDIGEST_KEYto the re-exportingtasks.harborrather thantasks.harbor.digest. - Could you list the hand conversion under "By hand" in the body? Matching on the object rather than one module path, in both the script and the test, belongs with #5167 / #5189.
- Stale prose that
migrate_importsdoes not touch.nemo_gym/cli/eval.py:87,benchmarks/iheval/prepare.py:126andbenchmarks/iheval/config.yaml:20still saytrain_data_utils..gitignore:250still namesnemo_gym/tasks/harbor/hub.py.
- The CLI-refactor shims now report the new module name. Each
moved_attr_getter(__name__, ...)shim (nemo_gym/data/prompt.py:189,dataset_preparation.py:1443,dataset_orchestrator.py:63,gitlab_utils.py:154) now seesnemo_gym.data.<mod>.- So
from nemo_gym.prompt import materialize_prompts_cligives a second warning namingnemo_gym.data.prompt.materialize_prompts_cli, a path that was never published. The advice in it is still right. - This is the same as #5211's
reward_profile. A stack-wide fix (pass the published old path literally) would cover both.
- So
- Pre-existing, optional.
fern/versions/latest/pages/data/download-huggingface.mdx:281citesdataset_preparation.py:476-494for auto-download; that code is around L761-792.
For #5230: splitting Harbor out removes the materialize_task / load_task_data_schema name collisions in the inline comment below. The ORACLE_AGENT entry (tasks.harbor.cli) in nemo_gym.data._PUBLIC_API will need to follow the CLI split.
yaoyu-33
left a comment
There was a problem hiding this comment.
Approving at 419155a05b0e. The team review found no blockers or risks; the remaining inline notes are optional and can be handled here or in a follow-up.
|
Replies to the summary notes, as of
For #5230: |
prompt.py, vision_input.py, task_data.py, task_materialization.py, dataset_metrics.py, dataset_orchestrator.py, hf_utils.py, gitlab_utils.py and the tasks package move as they are, and train_data_utils.py becomes data/dataset_preparation.py. Record the ten moves in MOVED_MODULES (tasks as a package), rewrite in- repo references with scripts/migrate_imports.py, point the sandbox policy test's path to the Harbor task modules at the new directory, make the contract's data layer the nemo_gym.data package, and redirect the old library reference pages in fern/docs.yml. The task data test finds the repository root one level further up. Regenerate the public API of each layout package that exists here from what non-test code outside nemo_gym imports, and point code outside nemo_gym, tests included, at nemo_gym.<package>. Signed-off-by: Ananth Subramaniam <[email protected]>
What and why
Moves task data into a new
nemo_gym/data/package: datasets and their preparation, prompts, task rows and their materialization, and task formats such as Harbor. The Harbor task CLI is split betweendata/andcli/in the next PR, so this one moves whole modules only.Where this PR sits
The stack lands bottom-up; each PR's base is the branch of the PR before it, so each diff shows only that PR's change.
Where the package sits
An arrow means "imports"; each package imports only packages below it. Yellow: created by this PR. Green: created by an earlier PR in the stack. Grey: still to come.
What moves
Whole modules, unchanged:
nemo_gym/prompt.pynemo_gym/data/prompt.pynemo_gym/vision_input.pynemo_gym/data/vision_input.pynemo_gym/task_data.pynemo_gym/data/task_data.pynemo_gym/task_materialization.pynemo_gym/data/task_materialization.pynemo_gym/tasks/nemo_gym/data/tasks/nemo_gym/dataset_metrics.pynemo_gym/data/dataset_metrics.pynemo_gym/dataset_orchestrator.pynemo_gym/data/dataset_orchestrator.pynemo_gym/train_data_utils.pynemo_gym/data/dataset_preparation.pynemo_gym/hf_utils.pynemo_gym/data/hf_utils.pynemo_gym/gitlab_utils.pynemo_gym/data/gitlab_utils.pyHow to review
One commit. Its changes:
MOVED_MODULESinnemo_gym/_moved_paths.py.scripts/migrate_imports.py.datalayer becomes thenemo_gym.datapackage.fern/docs.ymlredirects the old library reference pages to the new ones, including every page undernemo_gym/tasks/.__init__.pybecomes a lazy public API, like the layout packages, instead of importing six names eagerly.resources_servers/agentic_turn_simulationandresponses_api_agents/agentic_turn_simulation_agent, which Agentic turn simulation environment #5027 merged with old import paths such asnemo_gym.server_utilsandnemo_gym.openai_utils.cli/eval.py, two IHEval comments, the.gitignorenote on pulled Harbor datasets, and the auto-download source in the Hugging Face download guide.tasksis recorded as a package, so every Harbor task module resolves at its old path. Sandboxes import onlynemo_gym.verifiers, which does not move, so no sandbox script needs a fallback here."nemo_gym" / "tasks"), which the rewriter does not see.data, which would have droppednemo_gym/data/from the sandbox's copy of Gym. It now excludes only the agent's owndata/, and a test builds the tarball and checks both.tests/unit_tests/data/;test_train_data_utils.pybecomestest_dataset_preparation.pywith its module. The Harbor tests stay for now: several read fixtures by path and drive the environment server too.Public API
Every layout package that exists after this PR has a lazy public API in its
__init__.py: the names code outsidenemo_gym/imports from it (servers and their tests, benchmarks, scripts, and code samples in docs and skills), plus every name it already exported, each served from the submodule that defines it on first use. Code outsidenemo_gym/and its tests (servers and their tests, benchmarks, scripts, and docs) imports those names fromnemo_gym.<package>, so later moves inside a package leave it alone. Code insidenemo_gym/, and the library's tests undertests/, import from the module that defines each name, so the import-linter contract sees every dependency and a test reads what it patches. A patch target names the module the code under test looks the name up in.AGENTS.mdstates the rule.nemo_gym.data.tasks.harborhas a public API of its own. Harbor is one task format indata/tasks/, and many of its names, such asload_task,DIGEST_KEYandTaskDataSchema, do not name the format. Exported fromnemo_gym.data, they would read as generic task-data names, and a second task format would collide with them. So code outsidenemo_gym/imports Harbor names fromnemo_gym.data.tasks.harbor, andnemo_gym.dataexports only the package's own names. The genericmaterialize_taskandload_task_data_schemaare innemo_gym.data, because their Harbor namesakes now live in the Harbor API.AGENTS.mdstates the rule, and the facade tests and the public-import check cover a nested API.Validation
pytest -n 16 tests/unit_tests, also with-W errorfor the moved paths. The only failures are environment-specific and unrelated to the move: this machine's hostname resolves to127.0.1.1, which the sandbox host check refuses (the Harbor run summary tests and the benchmark listing test), and two Docker PTY tests.lint-imports.pre-commit runon the changed files.Rollout evidence: N/A. The modules move unchanged.
Compatibility
nemo_gym.data.*. A logging config set onnemo_gymstill covers them.python scripts/migrate_imports.py <paths>.Issue
Part of #5166.