Repository navigation
Conversation
Fixes deepspeedai#8951. Human-reviewed AI-assisted fix; validation is documented in the pull request. Signed-off-by: Rui <1685901819@qq.com>
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. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8951.
A fresh
OneCyclestarts at minimum LR but previously applied minimum momentum to the optimizer, even though its computed schedule starts at maximum momentum. The first Adam moment update was wrong and subsequent parameter updates diverged from the inverse-cycle schedule.Change
max_momsforlast_batch_iteration == -1.cycle_momentum=Falsepath.No public API, configuration key, checkpoint format, beta2, post-cycle decay, or LR-step indexing change. First-update numerics deliberately change to match the documented inverse cycle.
Validation
Base:
8d4f29c75f4a4b30d4db00a94b4aebfdff5107f3.Python 3.11.15; torch 2.12.1+cu126; NVIDIA RTX 3090 (one GPU used), CUDA runtime 12.6, driver 580.178.04; Linux x86_64. CPU uses Gloo; GPU uses NCCL. PyTorch Adam, FP32, stage 0, no offload.
TestOneCycleintegration classThe GPU selections overlap in the four new Adam cases; these counts must not be added as unique cases.
All applicable pre-commit hooks pass on the three changed files:
The independent CPU float64 two-update reproducer fails before the fix (weight 0.7387770530174719 versus reference 0.7878449067299509) and matches exactly afterward. A separate GPU
torchrunengine smoke changes from a 0.04906785488128662 error to 5.960464477539063e-08 (rtol=1e-6, atol=1e-7).No full DeepSpeed suite, full-model convergence, throughput, or peak-memory benchmark is claimed. Multi-node, ZeRO optimizer wrappers, offload, mixed precision and non-CUDA accelerators were not exercised for this scheduler change. Initial parallel scheduler attempts timed out; the completed isolated runs above are the final validation. After committing,
python ci/tests_fetcher.py --base origin/masterselected 44 test files in itstests/unit/v1scope. This is a selection preview, not executed upstream CI; the targeted regression commands above provide the local validation.Sibling paths and related work
All engine-created/client-created OneCycle schedulers use this implementation. Pipeline training advances the same engine optimizer-step path; wrapper support is centralized in
get_torch_optimizer. Other scheduler classes do not cycle momentum. Their code and checkpoint formats are unchanged; these are source-inspection statements, not coverage claims.Duplicate searches and relevant open diffs were checked. #8495/#8751 address beta2, #8589 momentum decay, #8472 CLI forwarding, #8528 LR tensor aliasing, and #8753 initial
get_last_lr(). None repairs the initial beta1 endpoint. The beta2 PRs touch adjacent initialization code and should retain this maximum-endpoint selection if merged first.AI assistance was used for investigation, implementation.