entrenar/optim/scheduler/mod.rs
1//! Learning rate schedulers
2//!
3//! Provides learning rate scheduling strategies for training:
4//! - `CosineAnnealingLR` - Smooth cosine decay
5//! - `LinearWarmupLR` - Linear warmup from 0 to target
6//! - `StepDecayLR` - Step decay by factor every N epochs
7//! - `WarmupCosineDecayLR` - Combined warmup + cosine decay
8
9mod cosine_annealing;
10mod linear_warmup;
11mod step_decay;
12mod warmup_cosine_decay;
13
14#[cfg(test)]
15mod tests;
16
17pub use cosine_annealing::CosineAnnealingLR;
18pub use linear_warmup::LinearWarmupLR;
19pub use step_decay::StepDecayLR;
20pub use warmup_cosine_decay::WarmupCosineDecayLR;
21
22/// Learning rate scheduler trait
23pub trait LRScheduler {
24 /// Get the current learning rate
25 fn get_lr(&self) -> f32;
26
27 /// Step the scheduler (typically called after each epoch or batch)
28 fn step(&mut self);
29}