Linear warmup + cosine annealing
Medium TrainingImplement a cosine learning rate schedule with linear warmup.
where progress = (step - warmup) / (total - warmup)
Implement the function below. Use only basic PyTorch operations.
Use this code to debug before submitting.
Try solving it yourself first! Click below to reveal the solution.
For interactive practice with auto-grading, run TorchCode locally:pip install torch-judge then use check("cosine_lr")
Linear warmup + cosine annealing