optimizers.lion
get_lion_with_cosine_scheduler(steps, learning_rate=5e-05, alpha=0.0, exponent=1.0, b1=0.9, b2=0.99, gradient_accumulation_steps=1, mu_dtype=None)
Args:
learning_rate: An initial value init_v.
steps: Positive integer - the number of steps for which to apply
the decay for.
alpha: Float. The minimum value of the multiplier used to adjust the
learning rate.
exponent: Float. The default decay is 0.5 * (1 + cos(pi * t/T)), where t is
the current timestep and T is the decay_steps. The exponent modifies
this to be (0.5 * (1 + cos(pi * t/T))) ** exponent. Defaults to 1.0.
b1: Rate for combining the momentum and the current grad.
b2: Decay rate for the exponentially weighted average of grads.
mu_dtype: Optional dtype to be used for the momentum; if
None then the dtype is inferred fromparamsandupdates`.
gradient_accumulation_steps:gradient_accumulation_steps
Return:
Optimizer , Scheduler
Source code in src/fjformer/optimizers/lion.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
get_lion_with_linear_scheduler(steps, learning_rate_start=5e-05, learning_rate_end=1e-05, b1=0.9, b2=0.99, gradient_accumulation_steps=1, mu_dtype=None)
Args:
steps: total train steps (max_steps)
learning_rate_start: start learning rate for sure
learning_rate_end: end learning rate for sure : b1: Rate for combining the momentum and the current grad.
b2: Decay rate for the exponentially weighted average of grads.
mu_dtype: Optional dtype to be used for the momentum; if
None then the dtype is inferred fromparamsandupdates`.
gradient_accumulation_steps:gradient_accumulation_steps
Return:
Optimizer , Scheduler
Source code in src/fjformer/optimizers/lion.py
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 35 36 37 38 39 40 41 42 43 44 45 46 | |
get_lion_with_warm_up_cosine_scheduler(steps, learning_rate=5e-05, learning_rate_end=1e-05, exponent=1.0, b1=0.9, b2=0.99, gradient_accumulation_steps=1, warmup_steps=500, mu_dtype=None)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
steps |
int
|
|
required |
learning_rate |
|
5e-05
|
|
learning_rate_end |
|
1e-05
|
|
exponent |
float
|
|
1.0
|
b1 |
float
|
|
0.9
|
b2 |
float
|
|
0.99
|
gradient_accumulation_steps |
int
|
|
1
|
warmup_steps |
int
|
|
500
|
mu_dtype |
Optional[ArrayDType]
|
|
None
|
Returns:
| Type | Description |
|---|---|
|
|
Source code in src/fjformer/optimizers/lion.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
get_lion_with_with_warmup_linear_scheduler(steps, b1=0.9, b2=0.99, gradient_accumulation_steps=1, mu_dtype=None, learning_rate_start=5e-05, learning_rate_end=1e-05, warmup_steps=500)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
b1 |
float
|
|
0.9
|
b2 |
float
|
|
0.99
|
mu_dtype |
Optional[ArrayDType]
|
|
None
|
learning_rate_start |
float
|
|
5e-05
|
learning_rate_end |
float
|
|
1e-05
|
warmup_steps |
int
|
|
500
|
gradient_accumulation_steps |
int
|
|
1
|
steps |
int
|
|
required |
Returns:
| Type | Description |
|---|---|
|
Optimizer and Scheduler |
Source code in src/fjformer/optimizers/lion.py
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 91 | |