Skip to content

Commit

Permalink
Fixed final value of cosine decay lr (#1011)
Browse files Browse the repository at this point in the history
* Fixed final value of cosine decay lr

* Update NeoXArgs docs automatically

---------

Co-authored-by: github-actions <[email protected]>
  • Loading branch information
kshitijkg and github-actions committed Aug 12, 2023
1 parent 009018e commit eda5aae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion configs/neox_arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Logging Arguments

- **git_hash**: str

Default = d3e481c
Default = 667e648

current git hash of repository

Expand Down
3 changes: 2 additions & 1 deletion megatron/learning_rates.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ def get_lr(self):
if self.decay_style == "linear":
lr = self.start_lr * (self.end_iter - num_iters_) / self.end_iter
elif self.decay_style == "cosine":
end_iter_ = self.end_iter - self.warmup_iter
lr = self.min_lr + (
(self.start_lr-self.min_lr)
/ 2.0
* (math.cos(math.pi * num_iters_ / self.end_iter) + 1)
* (math.cos(math.pi * num_iters_ / end_iter_) + 1)
)
elif self.decay_style == "exponential":
# exp(-0.693) = 1/2
Expand Down

0 comments on commit eda5aae

Please sign in to comment.