Bugfix/fix warmup scheduler setting error#9
Merged
Conversation
Contributor
Coverage Report
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
✨ Summary
This PR introduces a polynomial LR scheduler with warmup and enhances the warmup scheduler infrastructure with better modularity, validation, and test coverage.
✅ Major Changes
1. Refactored
PolynomialLRWarmupMigrated to inherit from
torch.optim.lr_scheduler.LRScheduler(modern PyTorch API).Rewritten with:
get_closed_form()warmup_iters,total_iters, andpowerstep(epoch)) and modern chainable APIBehavior:
warmup_iterstotal_iters - warmup_iterstotal_iters2. Introduced
WrappedLRSchedulerA general-purpose warmup wrapper:
multiplierafter_scheduler) after warmupWorks with any
LRScheduler(e.g.ReduceLROnPlateau,MultiStepLR, etc.)Compatible with
step()API (including metric-based schedulers)Includes strong argument checks and lifecycle safety (e.g. base LR re-init once)
3. Added
MultiStepLRWarmUpfactory functionCombines:
WrappedLRSchedulerMultiStepLRClean and reusable for config-based instantiation
4. Registry Integration
PolynomialLRWarmup,WrappedLRScheduler,MultiStepLRWarmUp) toOPTIMIZERSregistry__init__.pyto reflect the new module inclusion🧪 Tests
tests/base/optim/test_polynomial_lr_warmup.pyValidates:
total_iters.step()chainable APItests/base/optim/test_warm_up.pyCovers:
WrappedLRSchedulerwarmup-only behaviorafter_scheduler(e.g.MultiStepLR)MultiStepLRWarmUpAll tests pass.
🧩 Motivation
_LRSchedulerin favor ofLRScheduler.🔄 API Summary
📎 Miscellaneous
✅ Checklist
.step()API