File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -208,13 +208,14 @@ def _get_lr_outer(
208
208
* ,
209
209
num_warmup_steps : int ,
210
210
num_training_steps : int ,
211
+ num_cycles : float ,
211
212
min_lr_rate : float = 0.0 ,
212
213
):
213
214
if current_step < num_warmup_steps :
214
215
return 1
215
216
216
217
progress = float (current_step - num_warmup_steps ) / float (max (1 , num_training_steps - num_warmup_steps ))
217
- factor = 0.5 * (1.0 + math .cos (math .pi * 2.0 * progress ))
218
+ factor = 0.5 * (1.0 + math .cos (math .pi * float ( num_cycles ) * 2.0 * progress ))
218
219
factor = factor * (1 - min_lr_rate ) + min_lr_rate
219
220
return max (0 , factor )
220
221
@@ -225,6 +226,7 @@ def get_lr_outer(optimizer, config: Config):
225
226
num_warmup_steps = config .warmup_steps ,
226
227
# num_training_steps=config.total_steps,
227
228
num_training_steps = config .total_steps / 4 ,
229
+ num_cycles = 0.5 ,
228
230
)
229
231
return LambdaLR (optimizer , lambda_lr , - 1 )
230
232
You can’t perform that action at this time.
0 commit comments