Repository navigation
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1fbcf669b5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| import pytest | ||
|
|
||
|
|
||
| class TestZeROCheckpointTag(DistributedTest): |
There was a problem hiding this comment.
Add the required Signed-off-by trailer
This non-merge commit has no Signed-off-by trailer, so it does not satisfy the repository's commit requirements. Please add the trailer using the configured Git name and email before merging.
AGENTS.md reference: AGENTS.md:L8-L8
Useful? React with 👍 / 👎.
| allowed_missing_keys = None | ||
| if self.zero_optimization_partition_weights() and not load_optimizer_states and not self.has_moe_layers: | ||
| checkpoint['module'] = get_fp32_state_dict_from_zero_checkpoint(load_dir) | ||
| checkpoint['module'] = get_fp32_state_dict_from_zero_checkpoint(load_dir, tag=tag) |
There was a problem hiding this comment.
Normalize the checkpoint tag before reconstruction
When a checkpoint was saved with a numeric tag and the caller later uses the same numeric value in load_checkpoint, this ZeRO-3 path now passes the integer directly to get_fp32_state_dict_from_zero_checkpoint, whose os.path.join(checkpoint_dir, tag) raises TypeError. This previously worked with the default save_latest=True because reconstruction re-read the stringified tag from latest, and save_checkpoint explicitly supports such values by applying str(tag); normalize the resolved load tag similarly before forwarding it.
Useful? React with 👍 / 👎.
|
The current head |
|
Current master ( The |
|
Thanks for pointing out #8891. I agree that the production edit is superseded. A test-only revision has been prepared locally on official master The retained cases check every restored parameter as well as client metadata, covering explicit earlier string/integer tags, present/absent The remote branch has not been replaced yet: the current contribution policy requires the human submitter to review the final diff and run the relevant tests before DCO attestation. I will not carry the old sign-off forward as evidence of that review. The next branch update will remove the superseded production edit and update the title and validation scope together. |
Signed-off-by: Rui <1685901819@qq.com>
9e52b5d to
20d7fc2
Compare
|
The test-only revision is now pushed as Fresh validation passed 11 parameter combinations on CPU/Gloo and 11 on CUDA/NCCL, each at world sizes 1 and 2 (up to two RTX 3090s), plus all applicable pre-commit checks. A wrong-partition-tag mutation fails the restored-parameter assertions. I reviewed the final diff and ran the relevant tests before signing off. The title and description now reflect only this test coverage; current CI selection returns no |
Summary
Add regression coverage for ZeRO-3 checkpoint tag selection after #8891 fixed the runtime path. This revision changes only
tests/unit/checkpoint/test_zero_optimizer.py; it drops the superseded production edit.Related: #8499. The existing single-checkpoint tests cannot detect older metadata paired with newer weights. An open-PR search on 2026-11-13 found no other PR covering this two-checkpoint selection matrix; #9071 addresses publication of the latest marker after saves, not loading a requested older tag.
Coverage
The test trains a small real model, saves two observably different checkpoints, restores into a fresh engine, and checks client metadata and every gathered parameter against the pre-save snapshot.
latest,load_optimizer_states=False, and bothload_module_onlyvalues.tag=Noneselecting the newer checkpoint.Validation
Fresh runs on official master
f94aa5c52aadf02096c17df422b90b581e9b86c6plus only the test addition:CPU: 2 × Intel Xeon Gold 6133; GPU: up to 2 × NVIDIA RTX 3090 (24 GiB), driver 580.178.04. Python 3.11.15, PyTorch 2.12.1+cu126, CUDA runtime 12.6; CPU/Gloo and CUDA/NCCL. Each 11-case result includes both world sizes, totaling 22 distributed scenarios per backend.
Negative control: temporarily forcing only the ZeRO partition loader to select
laterwhile retaining the requested earlier model metadata makes the first older-tag case fail on restored parameter values (8/8 weight elements differ). The production file was restored byte-for-byte afterward. This is a mutation check of the new test, not an unmodified historical release run.An earlier sandboxed invocation failed before checkpoint execution because process creation was prohibited; the unrestricted runs above passed without code changes.
Validated: ZeRO-3, fp32, no offload, same-size legacy checkpoints, DP 1/2. Not validated: fp16/bf16, CPU/NVMe offload, universal checkpoints, DP resizing, TP/PP/MoE, multi-node or other accelerators. No production numerics, performance, or memory changes are claimed.
OpenAI Codex assisted with preparing and validating this revision.
I reviewed the final diff and ran the relevant tests before signing off. The current CI test selector reports no
tests/unit/v1targets for this legacy checkpoint test; the CPU/GPU commands above were run directly.