Skip to content

Commit

Permalink
Correct zero division error in inverse sqrt scheduler (#28982)
Browse files Browse the repository at this point in the history
* Correct zero division error in inverse sqrt scheduler

* default timescale to 10_000
  • Loading branch information
DavidAfonsoValente authored Mar 1, 2024
1 parent 1a7c117 commit 831bc25
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/transformers/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def get_inverse_sqrt_schedule(
# https://github.com/google-research/big_vision/blob/f071ce68852d56099437004fd70057597a95f6ef/big_vision/utils.py#L930

if timescale is None:
timescale = num_warmup_steps
timescale = num_warmup_steps or 10_000

lr_lambda = partial(_get_inverse_sqrt_schedule_lr_lambda, num_warmup_steps=num_warmup_steps, timescale=timescale)
return LambdaLR(optimizer, lr_lambda, last_epoch=last_epoch)
Expand Down

0 comments on commit 831bc25

Please sign in to comment.