Repository navigation
Description
Queue rank 22/48 · Difficulty 2/5 · Status on main: not_fixed
NVBug: https://nvbugspro.nvidia.com/bug/6805516 · priority: Unprioritized · ARB: Adil Asif
GitHub: no fix PR found; ref apache/arrow#51305, Gym PR #3128 (open)
Summary
Gym's data-prep scripts route a raw JSONL artifact through datasets.load_dataset(), which parses it into Arrow only to re-export JSONL. instruction_following hits upstream Arrow null-offset defect apache/arrow#51305 (ArrowIndexError: array slice would exceed array length); reasoning_gym hits an Arrow schema-type conflict (ArrowInvalid). Both fail before any model inference, so neither dataset can be prepared. This NVBug bundles both scripts.
Reproduction
From a Gym checkout with deps installed:
.venv/bin/python environments/instruction_following/prepare.py raises ArrowIndexError.
.venv/bin/python environments/reasoning_gym/prepare.py raises DatasetGenerationError (ArrowInvalid schema conflict, e.g. metadata.solution list vs int).
Root cause
instruction_following: upstream Arrow bug #51305 (OPEN; state not re-verified here, non-blocking since the fix bypasses it) on valid null kwargs entries. reasoning_gym: 13 metadata keys carry conflicting JSON types, so Arrow cannot infer one schema (hypothesis: distinct defect; a #51305 fix will not help). Common Gym defect: prepare.py needlessly passes a raw JSONL artifact through Arrow.
Status on main (not_fixed)
HEAD 75bb53e. environments/instruction_following/prepare.py:34 still load_dataset("nvidia/Nemotron-RL-instruction_following", split=split); environments/reasoning_gym/prepare.py:35 still load_dataset("nvidia/Nemotron-RL-ReasoningGym-v1", split=split). git log 399e6783..HEAD on the IF path is empty; last changed by #1403 (fa64c17) / #1378 (ff51aea). No merged fix PR. PR #3128 (OPEN) adds a copy-not-rename pattern but only for calendar/calendar_v2/code_gen.
Proposed fix
In both prepare.py, replace load_dataset(...) with hf_hub_download(repo_id=..., filename=<artifact_fpath>, repo_type="dataset") then shutil.copyfile(downloaded, output_path) — copy, not Path.rename(), to keep the shared HF cache intact (per PR #3128). artifact_fpath from config.yaml: instruction_following.jsonl, data/train.jsonl. Keep stdout Wrote {n} rows to {output_path} with n = copied line count. Add a unit test in the NEW tests/unit_tests/test_environment_prepare.py (created by #3128; mock hf_hub_download; assert copy + reported count). Coordinate with maintainer on whether to split reasoning_gym out.
Validation
Re-run testcases/environments/instruction_following.py (case full_readme_preparation, IF:461-462, checks Wrote {len} rows to; a 2nd case readme_usage_vllm also runs prepare) and testcases/environments/reasoning_gym.py::download (checks Wrote (\d+) rows to equals materialized rows). The 46,391/15,000 counts are bug-record expecteds; the tests compare to the materialized len, not hardcoded values. Needs HF network access; no GPU.
Triage
Difficulty 2/5 — localized two-file change, root cause pinpointed, reference impl and test pattern exist (PR #3128); bundles two environments so slight coordination needed. Needs GPU: no.
Reviewer notes
Verifier confirmed both prepare.py paths and status not_fixed on main (HEAD 75bb53e; #3128 still OPEN, touches only calendar/calendar_v2/code_gen + the new test); difficulty held at 2. Corrections applied: test_environment_prepare.py is a NEW file added by #3128, not existing; the IF prepare case is full_readme_preparation (with readme_usage_vllm as a second prepare case); the 46,391/15,000 figures are bug-record expecteds while tests assert against materialized len; and Arrow #51305's state was not re-verified (non-blocking).
Activity