Skip to content

Commit ce6f82b

Browse files
committed
do not update lr scheduler during warmup
1 parent ac54218 commit ce6f82b

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

open_diloco/train_fsdp.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,12 @@ def _get_cosine_schedule_with_warmup_lr_lambda(
185185
num_cycles: float,
186186
min_lr_rate: float = 0.0,
187187
):
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-
195188
if current_step < num_warmup_steps:
196189
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+
197194
progress = float(current_step - num_warmup_steps) / float(max(1, num_training_steps - num_warmup_steps))
198195
factor = 0.5 * (1.0 + math.cos(math.pi * float(num_cycles) * 2.0 * progress))
199196
factor = factor * (1 - min_lr_rate) + min_lr_rate

0 commit comments

Comments
 (0)