Skip to content

fix(math_with_judge): restore trajectory collection config cited by README - #4574

Merged
qiaochuz-nv merged 3 commits into
mainfrom
qiaochuz/nvb-6847517-math-judge-readme-trajectory-config
Oct 14, 2026
Merged

qiaochuz-nv merged 3 commits into
mainfrom
qiaochuz/nvb-6847517-math-judge-readme-trajectory-config

Conversation

@qiaochuz-nv

Copy link
Copy Markdown
Contributor

What does this PR do?

The math_with_judge README's "Prepare for trajectory collection" command works again. It loads configs/dapo17k_trajectory_collection.yaml, which no longer exists, so gym dataset collate exited with ConfigPathNotFoundError before downloading anything. This PR restores that config in the current schema, documents the step's prerequisites, and adds a regression test that replays the README command.

Running the README's other GitLab download, OpenMathReasoning, from outside the Gym root exposed a second bug: the GitLab downloader did not create the output directory. The second commit fixes it.

Fixes NVBug 6847517.
Closes #4498.

Cause

#859 ("Gym 0.2.0 huggingface dataset pointers") deleted three dapo17k variants under resources_servers/math_with_judge/configs/, including dapo17k_trajectory_collection.yaml, and removed their root-README rows. The math_with_judge README, which has cited that file since #291, was not updated. Config resolution (nemo_gym/global_config.py load_extra_config_paths) then raises ConfigPathNotFoundError.

dapo17k.yaml is not a drop-in replacement. The deleted config put the DAPO17k train problems in the validation split, repeated 16 times, because NeMo RL with is_trajectory_collection: true collects from the validation dataloader only. dapo17k.yaml has DAPO17k as train ×1 and AIME24 ×32 as validation, so trajectory collection would run on AIME24.

Restoring the old file verbatim would not work either. It set judge_model_server.name: ???, and since #1575 the parser rejects any ??? left after merging (ConfigMissingValuesError).

The second bug is in download_jsonl_dataset (nemo_gym/gitlab_utils.py). It opened output_fpath for writing without creating its directory. A Gym checkout tracks data/, so the README's --output data/open_math_reasoning_problems.jsonl works from the Gym root but fails with FileNotFoundError from any other directory. gym dataset collate --download fails the same way for GitLab-backed datasets. The Hugging Face download already creates the directory (hf_utils.py).

Fix

  • Restore configs/dapo17k_trajectory_collection.yaml. The validation split is the dapo17k 0.0.1 dapo17k_train.jsonl artifact (the same GitLab source as dapo17k.yaml), num_repeats: 16. Grading uses math-verify only (should_use_judge: false), so judge_model_server.name is policy_model and the README command needs no override. The file has description/value and the environment-server block like dapo17k.yaml. The update-readme-table hook re-adds its root-README row.
  • It keeps its own local file, data/dapo17k_trajectory_collection_train.jsonl, as before Gym 0.2.0 huggingface dataset pointers #859. Collate checks each dataset against <jsonl stem>_metrics.json. Sharing dapo17k.yaml's dapo17k_train.jsonl would compare the ×16 validation stats with that file's train sidecar and fail (train != validation, 17398 != 278368).
  • Add data/dapo17k_trajectory_collection_train_metrics.json, written by a real collate run (278368 rows = 17398 × 16). Its word and turn statistics match dapo17k_train_metrics.json exactly, so the rows are the same.
  • README: the command is unchanged. One note says the GitLab downloads in this README (the OpenMathReasoning download and this --download) need the mlflow extra (optional since (fix) Move mlflow/wandb out of core deps and into extras #3547) and mlflow_tracking_uri / mlflow_tracking_token in env.yaml. The section says what it writes and why the split is validation.

Test: tests/unit_tests/test_math_with_judge_readme_trajectory_config.py takes the README's gym dataset collate block and runs it through the real CLI with dispatch intercepted. It resolves the config offline (no env.yaml), checks the single dataset is validation ×16 with dapo17k.yaml's GitLab identifier, and checks the committed sidecar describes that split. It then runs TrainDataProcessor on a three-row fixture in a temporary directory, without network access, and checks that only validation.jsonl and its metrics come out, with each question repeated 16 times in order.

  • download_jsonl_dataset now creates the output's parent directory, as the Hugging Face download does. A new test in tests/unit_tests/test_gitlab_utils.py fakes the registry lookup and the HTTP fetch, then downloads into a missing nested directory. It fails before this change with the same FileNotFoundError and passes after.

These plausible wrong fixes all fail the trajectory test:

  • restoring the file verbatim (???);
  • pointing the README at dapo17k.yaml with a judge override;
  • num_repeats: 1;
  • a train split;
  • sharing dapo17k_train.jsonl.

Before the fix

Gym 977583d3d (main), the README command from the Gym root:

gym dataset collate \
    --config resources_servers/math_with_judge/configs/dapo17k_trajectory_collection.yaml \
    --config responses_api_models/openai_model/configs/openai_model.yaml \
    --output-dir data/dapo17k_trajectory_collection \
    --mode train_preparation \
    --download
nemo_gym.config_types.ConfigPathNotFoundError: config_paths entry 'resources_servers/math_with_judge/configs/dapo17k_trajectory_collection.yaml' was not found. Looked in:
  - <gym>/resources_servers/math_with_judge/configs/dapo17k_trajectory_collection.yaml
Check the path is spelled correctly and is relative to your working directory, an extra root
(NEMO_GYM_EXTRA_ROOTS / --search-dir), or the Gym install root.
EXIT=1

The README's OpenMathReasoning GitLab download, from a directory without data/, same base:

gym dataset download --storage gitlab --name math_open_math_reasoning --revision 0.0.1 \
    --artifact open_math_reasoning_problems.jsonl --output data/open_math_reasoning_problems.jsonl
  File ".../nemo_gym/gitlab_utils.py", line 111, in download_jsonl_dataset
    with open(config.output_fpath, "w") as f:
FileNotFoundError: [Errno 2] No such file or directory: '<workspace>/data/open_math_reasoning_problems.jsonl'

After the fix

This branch, same command, with the mlflow extra and GitLab registry credentials in env.yaml. No local data beforehand:

Downloading dataset `validation` for `math_with_judge_simple_agent` from gitlab using dataset_name='dapo17k' version='0.0.1' artifact_fpath='dapo17k_train.jsonl' output_fpath='resources_servers/math_with_judge/data/dapo17k_trajectory_collection_train.jsonl'
Dataset validation repeating 16x: each line repeated 16 times (e.g. pattern: abc -> aaaabbbbcccc)
Aggregate metrics for resources_servers/math_with_judge/data/dapo17k_trajectory_collection_train_metrics.json
Aggregate metrics for data/dapo17k_trajectory_collection/validation_metrics.json
EXIT=0
$ wc -l data/dapo17k_trajectory_collection/validation.jsonl
278368 data/dapo17k_trajectory_collection/validation.jsonl

There are 17398 runs of identical questions, each 16 rows long, and no train.jsonl. A second run skips the download, reports the sidecar already up to date, and exits 0.

The OpenMathReasoning download, same command and directory: exit 0, with the file written (the QA case below checks its rows).

Validation

  • QA testcase math_with_judge, which runs both README GitLab steps from a scratch directory with registry credentials:
    • base 977583d3d: 0/2. Trajectory collation fails because the config is missing; the download fails with FileNotFoundError.
    • this branch: 2/2. The download passes in 4.4 s; the trajectory collation passes in 20.3 s with 17398 × 16 rows and the committed sidecar unchanged.
    • The QA-suite change ships separately.
  • New tests: trajectory test before 1 failed (ConfigPathNotFoundError), after 1 passed, and the five wrong fixes above fail it. Downloader test before 1 failed (FileNotFoundError), after 1 passed, also with the real mlflow 3.16.1 installed.
  • test_train_data_utils.py, test_cli_main.py, test_global_config.py, test_dataset_source.py, test_task_data.py::TestSchemaPresence, test_ray_opt_out.py, test_cli_resources_servers.py, test_model_registry.py, test_resources_server_registry.py, test_environment_scaffold.py, test_gitlab_utils.py, test_hf_utils.py, and the new tests: 592 passed.
  • pre-commit run --all-files: passed.
  • Rollout evidence: N/A. This is a config and docs change, and gym dataset collate runs no model. The full download-and-collate run above uses the real registry data.

Compatibility

A new config file. Nothing that loads other configs changes. GitLab downloads now create a missing output directory instead of failing. The restored config uses the same GitLab artifact as dapo17k.yaml, but a separate local file, so each keeps its own metrics sidecar.

🤖 Generated with Claude Code

qiaochuz-nv and others added 2 commits October 13, 2026 13:11
…EADME

The README's "Prepare for trajectory collection" command loads
configs/dapo17k_trajectory_collection.yaml, which #859 deleted, so it
fails with ConfigPathNotFoundError. dapo17k.yaml is not a substitute:
NeMo RL's is_trajectory_collection reads only the validation split,
where dapo17k.yaml has AIME24 x32 instead of the DAPO17k train problems.

Restore the config in the current schema: the DAPO17k train artifact
(same GitLab source as dapo17k.yaml) as the validation split x16, in its
own local file so collate checks it against its own metrics sidecar,
which is added from a real collate run (278368 rows = 17398 x 16). Set
judge_model_server.name to policy_model, since grading uses math-verify
only and a '???' fails the strict missing-value check added in #1575.
Document what the step writes and that --download needs the mlflow
extra and GitLab registry credentials.

Add a test that replays the README command through the CLI, checks the
committed sidecar matches the split, and runs the collator offline on a
fixture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: qiaochuz <qiaochuz@nvidia.com>
download_jsonl_dataset opened its output path without creating the
parent directory, so `gym dataset download --storage gitlab --output
data/x.jsonl` (the math_with_judge README command) and `gym dataset
collate --download` for GitLab-backed datasets failed with
FileNotFoundError outside the Gym root, where data/ is tracked. The
Hugging Face download already creates the directory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: qiaochuz <qiaochuz@nvidia.com>
@qiaochuz-nv qiaochuz-nv added bug Something isn't working QA_fix Fix implemented by a QA team member area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers needs-review PR is ready for code review and waiting on a reviewer complexity:low Localized change in one scope with a small, straightforward review surface labels Oct 13, 2026
@qiaochuz-nv
qiaochuz-nv requested a review from yaoyu-33 October 13, 2026 20:32
@copy-pr-bot

copy-pr-bot Bot commented Oct 13, 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.

@yaoyu-33 yaoyu-33 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Reviewed the restored trajectory config and download-directory fix; 43 focused tests passed locally.

@yaoyu-33 yaoyu-33 added ready-to-merge PR is approved, current, and waiting for final CI or merge and removed needs-review PR is ready for code review and waiting on a reviewer labels Oct 13, 2026
@zyzhou5

zyzhou5 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

/ok to test d6427eb

@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/38633274932

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 14, 2026
@qiaochuz-nv
qiaochuz-nv added this pull request to the merge queue Oct 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/38646874566

Merged via the queue into main with commit 200a0d7 Oct 14, 2026
54 checks passed
@qiaochuz-nv
qiaochuz-nv deleted the qiaochuz/nvb-6847517-math-judge-readme-trajectory-config branch October 14, 2026 22:36

This branch was previously deployed

1 inactive deployment
public — d6427eb5 Deployed Oct 14, 2026 by copy-pr-bot[bot] via release / finalize / notify #5342
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers bug Something isn't working complexity:low Localized change in one scope with a small, straightforward review surface QA_fix Fix implemented by a QA team member ready-to-merge PR is approved, current, and waiting for final CI or merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NVBug 6847517] Fix math_with_judge README referencing deleted trajectory config

3 participants