Skip to content

fix(data): resolve deferred dataset paths after config composition - #5790

Closed
rystewart-nvidia wants to merge 8 commits into
NVIDIA-NeMo:mainfrom
rystewart-nvidia:lab-refresh/dataset-paths
Closed

rystewart-nvidia wants to merge 8 commits into
NVIDIA-NeMo:mainfrom
rystewart-nvidia:lab-refresh/dataset-paths

Conversation

@rystewart-nvidia

@rystewart-nvidia rystewart-nvidia commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Fix dataset paths that use configuration expressions such as ${selected_lab_input}. Preparation and validation could treat the expression as a filename instead of using its configured value.

Resolve only the dataset fields being consumed, after filtering by dataset type. Leave unrelated settings deferred, report unresolved paths as configuration errors, and keep the correct preparation command in missing-file errors. LAB needs selected-task paths. BioMysteryBench has the same bug: validation can treat ${prepare_script_args.output_dir}/gym.jsonl as a literal filename. This fix substitutes the configured output directory, giving the actual path: benchmarks/biomysterybench/data/gym.jsonl.

Builds on #5787. Will rebase this PR once 5787 is merged.

Validation

All 147 focused dataset-preparation, environment-validation, and dataset-source tests passed. They check all consumed path fields, loaded rows, source metadata and fallback preservation, ignored out-of-scope settings, and useful errors and preparation hints. All-files pre-commit and import checks passed.

uv sync --locked --project resources_servers/legal_agent_bench
source resources_servers/legal_agent_bench/.venv/bin/activate
PYTHONPATH=. LITELLM_LOCAL_MODEL_COST_MAP=True uv run --active --no-sync python -m pytest \
  tests/unit_tests/data/test_dataset_preparation.py \
  tests/unit_tests/environment/test_environment_validation.py \
  tests/unit_tests/config/test_dataset_source.py --import-mode=importlib -q

LITELLM_LOCAL_MODEL_COST_MAP=True avoids downloading model prices during imports; --active --no-sync uses the activated environment.

pre-commit run --all-files
git diff --check

All three read-only reproductions below passed. They need no downloads, model endpoints, or Docker.

1. Generic configuration example — example_multi_step

This changes a literal training path to ${selected_train_input} in memory. It resolves to the selected filename while preserving the configured GitLab source and its compatibility alias. The file need not exist, and no config is changed on disk.

PYTHONPATH=. LITELLM_LOCAL_MODEL_COST_MAP=True uv run --active --no-sync python - <<'PY'
from omegaconf import OmegaConf
from nemo_gym.data.dataset_preparation import TrainDataProcessor, TrainDataProcessorConfig

config = OmegaConf.load("resources_servers/example_multi_step/configs/example_multi_step.yaml")
config.selected_train_input = "resources_servers/example_multi_step/data/selected-train.jsonl"
config.example_multi_step_simple_agent.responses_api_agents.simple_agent.datasets[0].jsonl_fpath = (
    "${selected_train_input}"
)
owners = TrainDataProcessor().load_and_validate_server_instance_configs(
    TrainDataProcessorConfig(output_dirpath="", mode="train_preparation"), config
)
dataset = owners[0].datasets[0]
assert dataset.type == "train"
assert dataset.jsonl_fpath == config.selected_train_input, dataset.jsonl_fpath
print(dataset.jsonl_fpath)
PY

2. LAB — selected-task preparation

This applies LAB's planned task-selection setting to the current config in memory, so it works on this PR alone. Before the fix, the path remains an oc.select expression; afterward, it resolves to selected-lab-tasks.jsonl.

PYTHONPATH=. LITELLM_LOCAL_MODEL_COST_MAP=True uv run --active --no-sync python - <<'PY'
from omegaconf import OmegaConf
from nemo_gym.data.dataset_preparation import TrainDataProcessor, TrainDataProcessorConfig

config = OmegaConf.load("resources_servers/legal_agent_bench/configs/legal_agent_bench.yaml")
config.prepare_script_args = {"input": "selected-lab-tasks.jsonl"}
config.legal_agent_bench_harbor_agent.responses_api_agents.harbor_agent.datasets[1].jsonl_fpath = (
    "${oc.select:prepare_script_args.input,resources_servers/legal_agent_bench/data/generated/all.jsonl}"
)
owners = TrainDataProcessor().load_and_validate_server_instance_configs(
    TrainDataProcessorConfig(output_dirpath="", mode="train_preparation"), config
)
actual = str(owners[0].datasets[0].jsonl_fpath)
assert actual == "selected-lab-tasks.jsonl", actual
print(actual)
PY

3. Existing affected configuration — BioMysteryBench

The unchanged BioMysteryBench config uses ${prepare_script_args.output_dir}/gym.jsonl. This fix resolves it to benchmarks/biomysterybench/data/gym.jsonl.

PYTHONPATH=. LITELLM_LOCAL_MODEL_COST_MAP=True uv run --active --no-sync python - <<'PY'
from pathlib import Path
from nemo_gym.environment.validation import _resolve_manifest_composition

composition = _resolve_manifest_composition(Path("benchmarks/biomysterybench/config.yaml"))
actual = composition.datasets[0].jsonl_fpath
assert actual == "benchmarks/biomysterybench/data/gym.jsonl", actual
print(actual)
PY

Rollouts

N/A: this changes dataset selection before execution, not agent or verifier behavior. The commands above reproduce the path-resolution issue without a model call.

Compatibility and benchmark impact

Literal paths work as before. Configuration expressions now select the intended dataset, which can change the rows loaded when an override was previously ignored. Scoring, dataset ownership, and dataset types are unchanged. No new configuration field is required.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Documentation added or updated, or N/A with justification.
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format checks pass).
  • New source files include the required Apache-2.0 SPDX header.
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

@copy-pr-bot

copy-pr-bot Bot commented Nov 7, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@nemo-automation-bot nemo-automation-bot Bot added the community-request Issue reported or requested by someone from the community label Nov 7, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added bug Something isn't working area:data Datasets, preparation, task formats, and materialization needs-review PR is ready for code review and waiting on a reviewer labels Nov 7, 2026
@rystewart-nvidia
rystewart-nvidia force-pushed the lab-refresh/dataset-paths branch from 095e024 to 5d5726e Compare November 7, 2026 03:39
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Nov 9, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Nov 9, 2026
@rystewart-nvidia
rystewart-nvidia force-pushed the lab-refresh/dataset-paths branch from 5d5726e to 0acce48 Compare November 10, 2026 21:56
@cmunley1

Copy link
Copy Markdown
Contributor

A few behavior changes from resolving dataset configs more broadly:

  1. nemo_gym/environment/validation.py L112: OmegaConf.to_container(dataset, resolve=True) runs outside the try that wraps parser.parse. A dataset field with an unresolvable interpolation (${undefined_key}, ${oc.env:UNSET}) now escapes as a raw omegaconf InterpolationKeyError instead of the clean validation error, which changes the CLI exit path for gym env validate and publish.
  2. nemo_gym/data/dataset_preparation.py L619: every dataset of every instance is resolved before the in-scope filter. An out-of-scope dataset (for example an example dataset under train_preparation) with an unresolvable field now aborts the whole preparation, where before it was filtered out untouched.
  3. nemo_gym/environment/validation.py L112: resolving the whole raw dict also resolves undeclared extra keys, which the typed model used to drop. An extra field with a runtime-only interpolation now fails validation.
  4. nemo_gym/data/dataset_preparation.py L542: once jsonl_fpath is resolved, _declares_prepared_dataset compares it against the raw (unresolved) file value, so the "run this prepare command" hint loses the real config path for datasets like BioMysteryBench that use ${prepare_script_args.output_dir}.

Resolving only the declared path fields, and only for in-scope datasets, inside the existing error handling would cover 1 to 3. This core change also looks independent of the LAB stack, so it could land on its own.

@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-maintainers Waiting on maintainers to respond label Nov 12, 2026
@rystewart-nvidia
rystewart-nvidia force-pushed the lab-refresh/dataset-paths branch from 7d2ab41 to 8c26f4d Compare November 12, 2026 04:48
@rystewart-nvidia

Copy link
Copy Markdown
Contributor Author

@cmunley1 addressed each of the points in 8c26f4d

@rystewart-nvidia
rystewart-nvidia force-pushed the lab-refresh/dataset-paths branch from 8c26f4d to d7e7fbd Compare November 12, 2026 20:34
cmunley1
cmunley1 previously approved these changes Nov 13, 2026
@github-actions github-actions Bot removed the sla:triage-overdue Review assignment is over the one-business-day SLA label Nov 13, 2026
@rystewart-nvidia
rystewart-nvidia force-pushed the lab-refresh/dataset-paths branch from d7e7fbd to 9abfeed Compare November 13, 2026 15:59
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 13, 2026 15:59
Signed-off-by: Ryan Stewart <[email protected]>
Signed-off-by: Ryan Stewart <[email protected]>
Signed-off-by: Ryan Stewart <[email protected]>
Signed-off-by: Ryan Stewart <[email protected]>
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Nov 14, 2026
Signed-off-by: Ryan Stewart <[email protected]>
Signed-off-by: Ryan Stewart <[email protected]>
@rystewart-nvidia

Copy link
Copy Markdown
Contributor Author

superseded by changes merged in #5791, closing

@nemo-automation-bot nemo-automation-bot Bot removed the community-request Issue reported or requested by someone from the community label Nov 27, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-maintainers Waiting on maintainers to respond label Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:data Datasets, preparation, task formats, and materialization bug Something isn't working needs-review PR is ready for code review and waiting on a reviewer risk:high Autobot PR risk: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants