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 @@ -185,15 +185,12 @@ def _get_cosine_schedule_with_warmup_lr_lambda(
185
185
num_cycles : float ,
186
186
min_lr_rate : float = 0.0 ,
187
187
):
188
- if (
189
- warmup_outerstep is not None
190
- and current_step > num_warmup_steps
191
- and current_step % num_inner_steps < warmup_outerstep
192
- ):
193
- return 0
194
-
195
188
if current_step < num_warmup_steps :
196
189
return float (current_step ) / float (max (1 , num_warmup_steps ))
190
+
191
+ if warmup_outerstep is not None and current_step % num_inner_steps < warmup_outerstep :
192
+ return 0
193
+
197
194
progress = float (current_step - num_warmup_steps ) / float (max (1 , num_training_steps - num_warmup_steps ))
198
195
factor = 0.5 * (1.0 + math .cos (math .pi * float (num_cycles ) * 2.0 * progress ))
199
196
factor = factor * (1 - min_lr_rate ) + min_lr_rate
You can’t perform that action at this time.
0 commit comments