You need to sign in or sign up before continuing.
未验证 提交 bba88f67 编写于 作者: M minghaoBD 提交者: GitHub

fix warmup+decay LR (#4611)

上级 9f7a79d1
......@@ -56,11 +56,13 @@ class CosineDecay(object):
max_iters = self.max_epochs * int(step_per_epoch)
if boundary is not None and value is not None and self.use_warmup:
warmup_iters = len(boundary)
for i in range(int(boundary[-1]), max_iters):
boundary.append(i)
decayed_lr = base_lr * 0.5 * (
math.cos(i * math.pi / max_iters) + 1)
decayed_lr = base_lr * 0.5 * (math.cos(
(i - warmup_iters) * math.pi /
(max_iters - warmup_iters)) + 1)
value.append(decayed_lr)
return optimizer.lr.PiecewiseDecay(boundary, value)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册