(step)
| 100 | return None |
| 101 | elif schedule == "cosine": |
| 102 | def lr_lambda(step): |
| 103 | if step < warmup_steps: |
| 104 | return step / max(warmup_steps, 1) |
| 105 | progress = (step - warmup_steps) / max(total_steps - warmup_steps, 1) |
| 106 | return 0.5 * (1.0 + math.cos(math.pi * progress)) |
| 107 | return torch.optim.lr_scheduler.LambdaLR(optimizer, lr_lambda) |
| 108 | elif schedule == "linear": |
| 109 | def lr_lambda(step): |
nothing calls this directly
no outgoing calls
no test coverage detected