Merge pull request #578 from devin-open-source/devin/1733728337-fix-warmup-lr
fix: ensure non-zero learning rate during warmup at iteration 0
This commit is contained in:
1 file changed
+1
-1
@@ -231,7 +231,7 @@ def estimate_loss():
|
|||||||
def get_lr(it):
|
def get_lr(it):
|
||||||
# 1) linear warmup for warmup_iters steps
|
# 1) linear warmup for warmup_iters steps
|
||||||
if it < warmup_iters:
|
if it < warmup_iters:
|
||||||
return learning_rate * it / warmup_iters
|
return learning_rate * (it + 1) / (warmup_iters + 1)
|
||||||
# 2) if it > lr_decay_iters, return min learning rate
|
# 2) if it > lr_decay_iters, return min learning rate
|
||||||
if it > lr_decay_iters:
|
if it > lr_decay_iters:
|
||||||
return min_lr
|
return min_lr
|
||||||
|
|||||||
Reference in new issue
Block a user