declearn.optimizer.schedulers.CosineAnnealing
Bases: Scheduler
Cosine Annealing scheduler.
This scheduler implements a cosine annealing that results in the scheduled rate decreasing at each training step or round until a given index, beyond which it is constant.
It can be considered as a specific kind of decay rule that is parameterized to reach a given constant value after a given duration.
Source code in declearn/optimizer/schedulers/_cosine.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
|
__init__(base, max_lr, duration, step_level=True)
Instantiate the cosine annealing scheduler.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base |
float
|
Minimum learning rate towards which to decrease. |
required |
max_lr |
float
|
Maximum learning rate, from which to start. |
required |
duration |
int
|
Number of steps or rounds during which to carry the cosine
annealing. Beyond that, constantly use the |
required |
step_level |
bool
|
Whether to decay after each step rather than after each round. |
True
|
Source code in declearn/optimizer/schedulers/_cosine.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|