WarmupSchedule#
- class empulse.optimizers.WarmupSchedule(warmup_steps, after_schedule)[source]#
Linear warm-up for warmup_steps epochs, then delegates to after_schedule.
Let
target = after_schedule(0). During warm-up (epochs0towarmup_steps - 1), the value increases linearly fromtarget / warmup_stepsat epoch 0 to the full target at epochwarmup_steps - 1. From epochwarmup_stepsonward, after_schedule is called with the shifted epoch (epoch - warmup_steps), so epochwarmup_stepsitself also maps toafter_schedule(0)- the same value the warm-up just reached, so the schedule holds steady across the boundary rather than jumping.- Parameters:
- warmup_stepsint
Number of epochs for the linear warm-up phase. Must be at least 1.
- after_scheduleSchedule
Schedule to use after the warm-up. Its 0-based epoch counter restarts at the end of the warm-up.
Examples
from empulse.optimizers import WarmupSchedule, CosineAnnealingSchedule cosine = CosineAnnealingSchedule(max_value=1e-2, min_value=1e-5, t_max=400) schedule = WarmupSchedule(warmup_steps=50, after_schedule=cosine) # For epochs 0..49: linearly warm up to 1e-2; then cosine-anneal.