fix(checkpointing): include optimizer scaffold while loading - #4222
Conversation
Signed-off-by: Chen Cui <chcui@nvidia.com>
|
Light Code Review - The fix is correct and well-scoped. The is_loading flag is already set on both load paths (lines 2629 and 2694) and is never present on the save path (line 1177), so there is no risk of accidentally including optimizer state during saves. The unit test covers the positive case (scaffold included when save_optim=False and is_loading=True). One gap: Missing negative-case test -- no test asserting that save_optim=False without is_loading still excludes optimizer state. Consider adding a companion test with optim_sd_kwargs={} and asserting optimizer not in result. No bugs, typos, or doc issues found. LGTM. Suggested test cases: No perf tests impacted. |
Signed-off-by: Chen Cui <chcui@nvidia.com>
|
/claude review |
|
LGTM — clean, well-scoped fix with a solid regression test. The logic change at The concurrent-access test fix in One minor observation: there is no negative test asserting that Suggested test cases: No perf tests impacted. |
Signed-off-by: Chen Cui <chcui@nvidia.com>
|
/ok to test 4472834 |
…NeMo#4222) Signed-off-by: Chen Cui <chcui@nvidia.com> Signed-off-by: Vasudevan Rengasamy <vrengasamy@nvidia.com>
Signed-off-by: Chen Cui <chcui@nvidia.com> (cherry picked from commit 0917258)
Summary
Blast Radius / Test Assessment
generate_state_dict.save_optim=False; no L1/L2 CI labels are added.Validation
uv run --no-sync pre-commit run --files src/megatron/bridge/training/checkpointing.py tests/unit_tests/training/test_checkpointing.pyuv run --no-sync python -m py_compile src/megatron/bridge/training/checkpointing.py tests/unit_tests/training/test_checkpointing.py