Skip to content

Commit 720d929

Browse files
committed
do not update lr scheduler during warmup
1 parent dcac673 commit 720d929

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
@@ -184,15 +184,12 @@ def _get_cosine_schedule_with_warmup_lr_lambda(
184184
num_cycles: float,
185185
min_lr_rate: float = 0.0,
186186
):
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-
194187
if current_step < num_warmup_steps:
195188
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+
196193
progress = float(current_step - num_warmup_steps) / float(max(1, num_training_steps - num_warmup_steps))
197194
factor = 0.5 * (1.0 + math.cos(math.pi * float(num_cycles) * 2.0 * progress))
198195
factor = factor * (1 - min_lr_rate) + min_lr_rate

0 commit comments

Comments
 (0)