Skip to content

Commit aa7dc0f

Browse files
authored
Merge pull request #571 from dyhuachi/dyhuachi-patch-1
[fix] Refactor get_lr function to include min_lr calculation
2 parents ecd1ae1 + bf3878a commit aa7dc0f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

trainer/trainer_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ def Logger(content):
2323

2424

2525
def get_lr(current_step, total_steps, lr):
26-
return lr / 10 + 0.5 * lr * (1 + math.cos(math.pi * current_step / total_steps))
26+
min_lr = lr / 10
27+
return min_lr + 0.5 * (lr - min_lr) * (1 + math.cos(math.pi * current_step / total_steps))
2728

2829

2930
def init_distributed_mode():

0 commit comments

Comments
 (0)