Skip to content

Commit

Permalink
Update learning_rate.py
Browse files Browse the repository at this point in the history
  • Loading branch information
iProzd committed Mar 13, 2024
1 parent 9d76a24 commit 0c3c8d7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions deepmd/pt/utils/learning_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,11 @@ def __init__(
)
if decay_rate is not None:
self.decay_rate = decay_rate
self.min_lr = stop_lr
else:
self.min_lr = None
self.min_lr = stop_lr

def value(self, step):
"""Get the learning rate at the given step."""
step_lr = self.start_lr * np.power(self.decay_rate, step // self.decay_steps)
if self.min_lr is not None and step_lr < self.min_lr:
if step_lr < self.min_lr:
step_lr = self.min_lr
return step_lr

0 comments on commit 0c3c8d7

Please sign in to comment.