File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -184,15 +184,12 @@ def _get_cosine_schedule_with_warmup_lr_lambda(
184
184
num_cycles : float ,
185
185
min_lr_rate : float = 0.0 ,
186
186
):
187
- if (
188
- warmup_outerstep is not None
189
- and current_step > num_warmup_steps
190
- and current_step % num_inner_steps < warmup_outerstep
191
- ):
192
- return 0
193
-
194
187
if current_step < num_warmup_steps :
195
188
return float (current_step ) / float (max (1 , num_warmup_steps ))
189
+
190
+ if warmup_outerstep is not None and current_step % num_inner_steps < warmup_outerstep :
191
+ return 0
192
+
196
193
progress = float (current_step - num_warmup_steps ) / float (max (1 , num_training_steps - num_warmup_steps ))
197
194
factor = 0.5 * (1.0 + math .cos (math .pi * float (num_cycles ) * 2.0 * progress ))
198
195
factor = factor * (1 - min_lr_rate ) + min_lr_rate
You can’t perform that action at this time.
0 commit comments