Skip to content

【训练营】学习率调度器实现#113

Open
littleotherut wants to merge 19 commits intoInfiniTensor:masterfrom
littleotherut:lr_scheduler
Open

【训练营】学习率调度器实现#113
littleotherut wants to merge 19 commits intoInfiniTensor:masterfrom
littleotherut:lr_scheduler

Conversation

@littleotherut
Copy link

No description provided.

kinorw and others added 19 commits March 3, 2026 14:42
…base class

- Change Step() to virtual with default implementation
- Add pure virtual ComputeLR() for subclasses to implement.
- Adapt test helpers (IdentityScheduler, LinearDecayScheduler) to  implement ComputeLR() instead of Step().
- All existing tests pass without behavioral changes.

BREAKING CHANGE: Subclasses must implement ComputeLR() instead of Step().
…t and update all tests to use Create<T>() factory method.
…entialLR

- enhance LRScheduler with chained and closed form learning rate methods
- adapt methods(Step, InitialStep, GetClosedFormLR, GetChainedFormLR) to match PyTorch‘s design
- add tests for consistency
- refactor LinearLR: add end_factor, and rename this class
- add SequentialLR InitialStep and UndoChildInitialSteps

BREAKING CHANGE: Subclasses must implement GetClosedFormLR instead of ComputeLR(). Should use LinearLR instead of LinearwarmupLR.
- Add LRSchedulerConfig struct with parameters for all basic schedulers(constant, linear, step)
- Add CreateLRScheduler() factory function
- Support automatic warmup wrapping via SequentialLR when warmup_steps > 0
- Adapt test files
- Add gflags: --lr_scheduler, --warmup_steps, --step_size, --gamma, --start_factor, --end_factor, --lr_total_iters, --total_steps
- Replace nullptr scheduler with factory-created scheduler
- Move scheduler.Step() after optimizer.Step() in both DP and PP paths
- Replace hardcoded FLAGS_learning_rate in log with scheduler->GetLR()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant