cosinewarmupcheduler
CosineWarmupScheduler
¶
Bases: _LRScheduler
Cosine annealing with warmup learning rate scheduler.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
optimizer |
Optimizer
|
The optimizer to use during training. |
required |
warmup |
int
|
The number of warmup steps. |
required |
max_iters |
int
|
The number of maximum iterations the model is trained for. |
required |
Example
optimizer = torch.optim.SGD(model.parameters(), lr=0.1) scheduler = CosineWarmupScheduler(optimizer, warmup=10, max_iters=100) for epoch in range(100): scheduler.step() train(…)
Source code in spotpython/torch/cosinewarmupcheduler.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|