Repository navigation
Conversation
|
/ok to test d99873c |
d99873c to
743d58d
Compare
|
/ok to test 743d58d |
|
Rebased onto current Also pre-emptively applied both failure classes @yuki-97 found on #3916:
|
Third PR in the utils-layer config v1 -> v2 series (NVIDIA-NeMo#3916 ClusterConfig, NVIDIA-NeMo#4152 checkpointing configs; pattern from NVIDIA-NeMo#2518). Schema: WandbConfig, SwanlabConfig, TensorboardConfig, MLflowConfig, GPUMonitoringConfig, and LoggerConfig move from TypedDict to BaseModel(extra="allow"); NotRequired fields become Optional[...] = None. GpuMetricSnapshot stays TypedDict (internal data container, not YAML-loaded config). Behavior-preserving details: - WandbLogger/SwanlabLogger passed dict(cfg) / **cfg straight into wandb.init / swanlab.init; they now pass model_dump(exclude_none=True) so unset Optional fields do not reach the backends as explicit Nones, while extra= passthrough keys survive. - Logger.__init__ raises a named ValueError when a backend is enabled but its sub-config block is absent (previously a KeyError). - MLflowLogger keeps its cfg-or-env fallbacks, now via attributes. Call sites (~22 across algorithms, sync_rollout_actor, trajectory_collector, SC setup, all example run scripts, flow_grpo) move to attribute access. Reference configs: always-emitted Optional keys are added with their default values at both the logger level and inside the nested wandb/tensorboard/mlflow blocks (deep-verified: each reference logger block now matches LoggerConfig.model_dump exactly). Test fixtures wrap logger dict literals in LoggerConfig.model_construct and move subscripts to attribute access. Signed-off-by: Shubhankar Tripathy <[email protected]>
Third PR in the utils-layer config v1 -> v2 series (NVIDIA-NeMo#3916 ClusterConfig, NVIDIA-NeMo#4152 checkpointing configs; pattern from NVIDIA-NeMo#2518). Schema: WandbConfig, SwanlabConfig, TensorboardConfig, MLflowConfig, GPUMonitoringConfig, and LoggerConfig move from TypedDict to BaseModel(extra="allow"); NotRequired fields become Optional[...] = None. GpuMetricSnapshot stays TypedDict (internal data container, not YAML-loaded config). Behavior-preserving details: - WandbLogger/SwanlabLogger passed dict(cfg) / **cfg straight into wandb.init / swanlab.init; they now pass model_dump(exclude_none=True) so unset Optional fields do not reach the backends as explicit Nones, while extra= passthrough keys survive. - Logger.__init__ raises a named ValueError when a backend is enabled but its sub-config block is absent (previously a KeyError). - MLflowLogger keeps its cfg-or-env fallbacks, now via attributes. Call sites (~22 across algorithms, sync_rollout_actor, trajectory_collector, SC setup, all example run scripts, flow_grpo) move to attribute access. Reference configs: always-emitted Optional keys are added with their default values at both the logger level and inside the nested wandb/tensorboard/mlflow blocks (deep-verified: each reference logger block now matches LoggerConfig.model_dump exactly). Test fixtures wrap logger dict literals in LoggerConfig.model_construct and move subscripts to attribute access. Signed-off-by: Shubhankar Tripathy <[email protected]>
|
/ok to test 93242d3 |
|
Local deep-test pass (same hand-built-venv setup as on #4278): |
|
/ok to test f181f5c |
93242d3 to
f181f5c
Compare
|
Rebased onto main after #4278 and #3916 landed — the conflicts were the expected overlap in shared test fixtures (logger/cluster wrappings from the merged PRs vs this PR's checkpointing wrappings; resolution keeps both). Re-verified locally on the rebased branch: |
|
/ok to test 7c17278 |
f181f5c to
7c17278
Compare
fa3466f to
e33acf6
Compare
|
/ok to test 3e41070 |
test_generic_launchers_reject_nemo_gym_configs came in from main with
checkpointing={"enabled": False}. This branch makes CheckpointingConfig a
BaseModel, so run_grpo.py reads config.checkpointing.enabled and the
native case failed with AttributeError in L0_Unit_Tests_Other.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Shubhankar Tripathy <[email protected]>
yuki-97
left a comment
There was a problem hiding this comment.
Merge blockers — please rebase on main; the branch now conflicts with #5009 in three tests/unit/single_controller/ files, and the "Check if PR branch is up to date" job allows at most 10 commits behind.
Thanks for moving CheckpointingConfig and PretrainedCheckpointConfig onto BaseModel; the migration keeps the Automodel-only legacy keys failing at startup with a clear error through model_extra, so stale recipes are still caught.
Scope: the CheckpointingConfig / PretrainedCheckpointConfig migration with its callers and tests, at 5202d4d
Checked:
- Schema defaults vs exemplar YAMLs —
save_optimizer,save_data_planeandcheckpoint_must_save_bymatch;load_replay_bufferdoes not (inline); the remainingNonedefaults keep the old absent-key behaviour. - Dict-style readers — none left on the migrated config in
nemo_rl/; the two remaining.getreads operate on a dumped dict and on the raw YAML. - Reference configs — the new
Optionalkeys are dumped, sotest_config_v2_same_as_v1stays in sync.
Remaining comments are on:
load_replay_bufferdeclared as a tri-state that no reader distinguishes fromTrue- defaulting
save_periodto10, with a note thathigher_is_betteris only read whenmetric_nameis set - keeping
PretrainedCheckpointConfiga TypedDict untilPolicyConfigmigrates, which removes themodel_dump()hand-offs
nit
- unify test config construction to keyword arguments
- indent the
CheckpointingConfigdocstring entries underAttributes:and add the three missing ones
Merge origin/main (49 commits) to clear the conflicts with NVIDIA-NeMo#5009 and the "Check if PR branch is up to date" gate. Code main moved into rollout_checkpointing/ and main's new tests get the same attribute access as the rest of this PR. Review fixes: - load_replay_buffer is a plain bool defaulting to True; readers test `not load_replay_buffer`, and the reference configs dump `true`. - save_period defaults to 10; note that higher_is_better is only read when metric_name is set. - PretrainedCheckpointConfig stays a TypedDict until PolicyConfig migrates (NVIDIA-NeMo#3197), so setup hands it over unchanged and PolicyConfig.pretrained_checkpoint keeps its TypedDict annotation. - Indent the CheckpointingConfig docstring under Attributes: and document save_period, checkpoint_must_save_by and pretrained_checkpoint. - Tests build CheckpointingConfig with keyword arguments. - Drop the defaults-only CheckpointManager test (NVIDIA-NeMo#5009 testing rules). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Shubhankar Tripathy <[email protected]>
|
Thanks @yuki-97, all addressed in 47d151c. Merge blockers: merged Inline comments:
I also dropped Local: ruff and pyrefly clean on the PR files; 431/431 in |
Main's new reads of checkpointing (snapshot gating in setup.py, the pump epilogue, and three tests) still used dict access; switch them to attributes. Signed-off-by: Shubhankar Tripathy <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
yuki-97
left a comment
There was a problem hiding this comment.
Thanks for addressing the previous round's comments.
Scope: fix commits 47d151c through cf10c7a, checked against the previous review's open threads, plus a scan of the current PR changes.
Checked:
- Replay restoration now uses a boolean contract consistently across the schema, both readers, reference configs and tests.
- The pretrained checkpoint remains a TypedDict and all seven setup hand-offs match the downstream dictionary consumers.
- The requested constructor conversions, field documentation and save-period default are implemented.
- Validation was static inspection plus an extracted-constructor reproduction; pytest/GPU tests were not run, and current-head checks contain no unit-test results.
Remaining comments are on:
- Two remaining dictionary fixtures need migration to the model-only CheckpointManager interface.
nit
- Refresh the PR description and two stale or inaccurate documentation statements.
Generated by Codex
Signed-off-by: Yuki Huang <[email protected]>
|
/ok to test f83d7a1 |
|
/ok to test f55d456 |
|
hi @lonexreb , thanks for helping on so much things! |
|
Hi @yuki-97, yes please, go ahead and open your own PR with these changes. Thanks for the reviews and for adding me as co-author. I'll leave this branch alone so it doesn't drift from yours, and you can close this PR once yours lands. If CI turns up anything in the checkpointing changes, ping me here and I'll take a look. |
Pull request was closed
What does this PR do ?
Second PR in the utils-layer config v1 → v2 series (after #3916 /
ClusterConfig; pattern from #2518, running alongside #3197 policy-config and #3289 generation-config series). MigratesCheckpointingConfig(nemo_rl/utils/checkpoint.py) fromTypedDicttoBaseModel(extra="allow").PretrainedCheckpointConfigremains a TypedDict.Schema decisions:
save_optimizer=Trueandsave_data_plane=False.load_replay_bufferis a boolean defaulting toTrue;Falseopts out of restoring replay-buffer state.save_perioddefaults to10.save_optimizer/keep_top_kpreviously hit a latentKeyError(config["save_optimizer"]on aNotRequiredkey); they now get the documented defaults.Call sites: ~85 across all algorithms, SC utils, and
lm_policymove to attribute access.PretrainedCheckpointConfigis forwarded directly topolicy_config["pretrained_checkpoint"]as a dictionary, matching the existing PolicyConfig and Megatron consumers.Tests: checkpointing fixtures use keyword-based
CheckpointingConfig(...)construction when required fields are present, andCheckpointingConfig.model_construct(...)for partial fixtures.Reference configs are updated to reflect the resolved checkpoint defaults. Exemplar YAMLs and
tests/unit/test_config_v2.pyare unchanged.Issues
Part of the TypedDict → BaseModel migration tracked by
tests/unit/test_config_v2.py(see also #1675 / #2102).Usage
No user-facing YAML change. Unknown/legacy keys under
checkpointing:continue to load; missing required keys (enabled,checkpoint_dir,metric_name,higher_is_better) now fail at config validation time with a clear pydantic error.Before your PR is "Ready for review"
model_save_format=None; nestedpretrained_checkpointcoerces and dumps back; extra keys preserved;model_constructdefault-fill)ruff format+checkclean (repo-pinned 0.9.9);py_compileon all touched files; zero3rdparty/changes (gitlinks verified againstmain)