Implement cosine_with_warmup(step, warmup_steps, total_steps, base_lr) that returns the learning rate at step step as a Python float.
The schedule has two phases:
step in [0, warmup_steps]: lr increases linearly from at step to base_lr at step warmup_steps.step in [warmup_steps, total_steps]: lr decays from base_lr to following half a cosine cycle.For step > total_steps, return . For step < 0, return .
step / warmup_steps, scaled by base_lr.0.5 * (1 + cos(pi * progress)) where progress goes from 0 to 1 across the decay phase. It starts at 1 and ends at 0.warmup_steps = 0 means start at base_lr; step == warmup_steps should land exactly on base_lr.