Repository navigation
feat(eval): run_examples records, run-folder shards and gym eval status read the Store - #5443
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. |
marcromeyn
left a comment
There was a problem hiding this comment.
Thanks Adam, the three PRs carry over well: the three constraints are met and the suites pass at f46c128 (1094 passed). Before merge, mostly the shard path:
- Shards can't be resumed or recovered (
rollout_collection.py:1715): the manifest comes fromRunManifest.import_legacy(legacy_import=True, unverified identity), so resume andresubmit --recoverreject it, thoughRolloutStore.readworks. Could the writer create a verified manifest and persist dispatch reservations first, like collection? _attemptsisn't a reserved shard ending (:1643): aggregation skips*_attempts, so shardsstep_1andstep_1_attemptsbreak the first. Reserve it; test both labels.- Reused rows keep their old run id (
:6059): dispatch keeps an existing_ng_run_idbut each writer makes a new manifest id, so the Store rejects those failures. Stamp every dispatched copy with the writer's run id. - Typed failures only when recording (
:6072): withenrich_results=True, route_failures_to_sidecar=Trueand no shard, a judge failure returns the legacy dict withreward=0.0, unlike the description. Use the typed path for enrichment too (or narrow the description), with a test through the real dispatcher.
Minor: the shard status is written outside the token lock (:1781), so a stale writer can overwrite a newer one's; and the final status write is skipped once the loop succeeds (:4634), so a later upload or aggregation error leaves counts stale.
Approving once these are in.
|
Thanks Marc. All six are in, each as its own signed commit on top of the earlier head:
Suites at the new head: |
run_examples records a shard on copies of the rows that name the shard's run, but the copies kept the row's own rollout id, and with it the capture key the model calls are staged under. Capture files are kept by default, so a later shard that dispatched the same task and rollout (a row an earlier shard returned, fed back, or indices numbered again each step) merged the earlier shard's calls into its own records. Each dispatched copy of a recorded shard now carries the row's own id (its _ng_rollout_id, or <task>-<rollout>) prefixed with the shard's run id. A row an earlier shard returned has that prefix replaced, not nested. The capture key is that id with the usual attempt suffix, so capture_key and the /ng-rollout/<capture key> path keep their form; only the key is now the shard's own. The Store, the manifest, the records and the returned rows use the same id, so a caller reads a capture's key from the returned row. enrich_results without recording keeps the caller's keys. Tests: two shards that dispatch the same task and rollout, with the row fed back or the indices numbered again, each record only their own calls (they fail without the change). The shard tests stage captures under the dispatched key, as the model server does. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
A recorded shard's manifest hashed the caller's rows and the recording
options, while the manifest gym eval run computes on resume hashes the
source file's bytes and the resolved configuration. Resuming a shard with
resume_from_cache was therefore refused for its source dataset and its
configuration. The earlier test passed the saved manifest in as the current
one, so it never compared the two.
The writer now builds the shard's manifest with RunManifest.create, the
identity function collection uses. Its inputs are the shard's materialized
inputs as the source file, the rows as dispatched, a collection config that
names the shard's input and output paths and leaves every other setting at
its default, and the call's server configuration. The identity file is
saved beside the manifest, as for any run, and replaced with the shard. So
gym eval run +input_jsonl_fpath=<dir>/rollouts-<shard>_materialized_inputs.jsonl
+output_jsonl_fpath=<dir>/rollouts-<shard>.jsonl +resume_from_cache=true
verifies and runs only what the shard still lacks. An operational
difference resumes with the usual drift note, and a semantic one is refused
and named. If the running configuration gives no identity (for example it
does not name the rows' agent), the shard is still recorded, with a
warning, and a resume refuses it and says why.
Tests: a shard recorded with one failure resumes through run_from_config,
dispatches only the failed row and ends with both rows scored; a shard
without a configuration identity is recorded and warns. Both fail without
the change.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
The training-framework section now says that a recorded shard dispatches each row under its rollout id prefixed with the shard's run id, so a capture's key is read from the returned row, and that a shard resumes with gym eval run on its materialized inputs and its rollouts file. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…apture keys Only a recorded shard prefixes its rollout ids with its run id. A plain gym eval run and run_examples with enrich_results alone dispatch every row under the id Gym derived before: <task>-<rollout>, or the row's own _ng_rollout_id. The saved results carry the same ids, so recovery and re-verification of such runs read the identities they always did. The test passes before and after the shard change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
…nkept omitted row With record_omitted_rollouts left off, the shard writer returned for an omitted row before its status write. When that row was the last one expected and status writes were throttled, the final counts never reached the status file: with two scored rows and an omitted third, gym eval status reported one completed result instead of two. Closing the iterator corrected it, but iterating to the end does not close it. The early return now flushes the status when it handles the last expected row. As with any flush, a writer that another writer superseded leaves the newer status alone. The saved results do not change. Test: the throttled status test also writes two scored rows and an unkept omitted row, and expects two completed and one remaining (it reports one completed without the change). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
|
/ok to test e28bb71 |
…e shard A recorded shard prefixes each row's rollout id with its run id, after removing the prefix an earlier shard put on a row it returned. A row fed back as `<earlier run>.0` and a new row whose own id is `0` therefore both became `<this run>.0` in the same call. They would then share capture files and one manifest identity. A training framework hits this when a step resubmits a returned row next to fresh rows whose numbering restarted. run_examples now refuses such a call before dispatch, and before the existing shard is replaced. The error names both rows and both of their own ids, so the caller can give each row a distinct _ng_rollout_id or distinct task and rollout indices. Test: `<earlier run>.0` beside `0` is refused with both ids named, nothing is dispatched and the existing shard is kept. `<earlier run>.0` beside `1` still dispatches, as `<run>.0` and `<run>.1`. It fails without the change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
The capture key, a rollout id with its attempt suffix, also names the model server's capture files. The longest of them is `<key>.capture.incomplete`, and a file name holds at most 255 bytes. A recorded shard adds a 33-character run-id prefix to each row's id, so a long explicit id could pass that limit and fail only when the first model call was captured, mid-rollout. A shared check, check_rollout_id_length in nemo_gym.core.episode_context, allows a rollout id of up to 230 bytes. That leaves room for attempt suffixes up to -a9999 and the longest capture file suffix, and also keeps a key under a 256-character id limit. run_examples applies it to each recorded row's id after the prefix is added, before dispatch and before the existing shard is replaced. The error names the id, its length and the limit. Test: an id one byte over the limit, after the prefix, is refused with nothing dispatched and no shard written. The longest id that fits dispatches, and its capture file name at attempt 9999 is exactly 255 bytes. It fails without the change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Adam Rajfer <[email protected]>
The library reference page generated from the judge_profile module failed
to parse: its module docstring wrote the pool node variable as
``${GYM_POOL_<POOL>_NODES}``, and the generated MDX read `<POOL>` as a tag.
The docs preview of any change that rebuilds the full reference failed on
it.
The docstring now names the variable as ``GYM_POOL_*_NODES``. No other
docstring combines a ${...} reference with an angle-bracket placeholder,
and the other pages built from docstrings parsed in the same build.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
|
/ok to test a54a932 |
|
/ok to test e39ad64 |
|
/ok to test e39ad64 |
marcromeyn
left a comment
There was a problem hiding this comment.
Thanks Adam, re-checked at the new head (suites pass, 1127). Rows that would share a shard-scoped id are now refused before dispatch and before the shard is replaced, with both source ids in the error, and over-long ids are refused against the capture file-name limit; both have tests. Approving.
…stant
The library reference page for the judge_profile module failed to parse.
The page generator writes each field's default into an MDX attribute as
its Python repr, and JudgeExecutionProfile.qos_source defaulted to the
string "the partition's default". Because of the apostrophe, the repr is
double-quoted, so the generated line was
<ParamField path="qos_source" type="str = "the partition's default"">
and MDX stopped at the `'` ("Unexpected character `'` in attribute name").
The default is now the module constant PARTITION_DEFAULT_QOS, with the same
text, so the page shows `str = PARTITION_DEFAULT_QOS`, as it does for
`kind: str = CPU_PROFILE`. The two other places that set the same source
use the constant too. The text in the operator's log does not change. No
other plain string default in nemo_gym contains an apostrophe.
Verified by generating the page locally with the docs CLI and compiling it
with MDX 3: the old page fails with the error above, the new one compiles.
The judge profile tests pass unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Adam Rajfer <[email protected]>
|
/ok to test 47cbb9b |
|
/ok to test 47cbb9b |
marcromeyn
left a comment
There was a problem hiding this comment.
Re-approving: the only change since my approval is the QOS-source default in judge_profile.py becoming a module constant, with no behaviour change.
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/41856978173 |
Signed-off-by: Adam Rajfer <[email protected]>
|
/ok to test 4eb68bf |
marcromeyn
left a comment
There was a problem hiding this comment.
Re-approving after the merge of main: the PR's own change is identical (14 files), and the two conflict resolutions are imports only.
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/41867298194 |
Training frameworks that dispatch through
RolloutCollectionHelper.run_examplesnow get the same records asgym eval run. Each returned result is the collector's own record. A call can also write its rollouts to a run folder as a shard that the Store, the run health check,gym eval aggregateandgym eval statusread like an eval run, and thatgym eval runcan resume.gym eval statusreads saved progress from the Store for every run.This carries Marc Romeyn's three run-records PRs (#5318, #5359, #5360), with his authorship and sign-off, adapted to the failure-handling work now in
main(typedRolloutFailureRecordrows, Store-based resume selection, causal failure events). The PR targetsmain.What it does
enrich_results=True,run_examplesbuilds each result with the collector's own outcome builder. A result carries its rollout identity, captured model calls (ng_model_call_capture),ng_trajectoryandng_perf. Underroute_failures_to_sidecar, a failed/runcomes back as the typedRolloutFailureRecord, with the captures behind its failure evidence kept.record_output_dirwithrecord_shardwrites each rollout as collection lays out a run. The caller picks the label and Gym owns the file names:rollouts-<shard>.jsonl, a failures sidecar created up front, the rows as materialized inputs, a verified run manifest with every row's attempt reserved before the first request, and the shard's saved progress. Rows without task and rollout indices are refused before an existing shard is replaced. A token identifies the current writer, so a superseded writer can neither append nor overwrite the newer writer's status. Reopening a label replaces the shard, so a replayed step does not duplicate rows._ng_rollout_id, or<task>-<rollout>), prefixed with the shard's run id. A row returned by an earlier shard has that shard's prefix replaced, not nested. The capture key is this id plus the usual attempt suffix, socapture_keyand the/ng-rollout/<capture key>path keep the form refactor(capture): name capture keys capture_key on the ledger control surface #5248 gave them; only the value is the shard's own. The Store, the manifest, the records and the returned rows use the same id, so a caller reads a capture's key from the returned row. Runs that are not shards (gym eval run, orrun_exampleswith onlyenrich_results) keep their ids and capture keys unchanged.RunManifest.create, the identity function collection uses, from the shard's materialized inputs, the rows as dispatched, the collection defaults and the running server configuration.gym eval run +input_jsonl_fpath=<dir>/rollouts-<shard>_materialized_inputs.jsonl +output_jsonl_fpath=<dir>/rollouts-<shard>.jsonl +resume_from_cache=truethen verifies the shard and runs only what it still lacks. As for any run, an operational difference resumes with a drift note and a semantic one is refused by name. A shard whose rollouts are not numbered 0, 1, … in order per task, or whose running configuration names no identity, is still recorded, and a resume refuses it with the reason.failures_by_kindandmodel_final_by_kind. The status file is written under the writer's lock and throttled. It is brought up to date at the end, including when the last expected row of a shard is an omitted row the shard does not keep, and when a step after collection fails.gym eval status <run dir | job id>reports completed and remaining rollouts, failures by kind, each exporter's receipt and the live tracking run id.gym eval status.Review follow-ups in this head
record_omitted_rolloutsoff, an omitted last row returned before the status write. With throttling,gym eval statusthen reported one completed result where two were saved. That path now writes the final status.Merge order
main, then this PR. Yuhe Zhang's #3881 is based on this branch, #3879 on #3881, and #5504 on #3879; they merge after this PR. Marc's originals stay open for reference and are closed when this PR lands.Validation
tests/unit_tests/rollouts/test_rollout_collection.py; each fails without its change:test_a_shard_records_only_the_model_calls_of_its_own_dispatch[returned row fed back]and[indices numbered again]test_a_recorded_shard_resumes_through_the_eval_entry_pointTestRunRecordWriter::test_a_shard_without_a_configuration_identity_is_recorded_and_says_it_will_not_resumeTestRunRecordWriter::test_shard_status_writes_are_throttled_and_end_current(two scored rows, then an unkept omitted row: two completed, one remaining)test_a_run_that_is_not_a_shard_keeps_its_rollout_ids_and_capture_keyspasses before and after the shard change, for bothgym eval runandrun_exampleswithenrich_results.🤖 Generated with Claude Code