From 8f98cd7becf8fcf3f7fb9d70d1e5cc5cd218e12f Mon Sep 17 00:00:00 2001 From: Wenyu Date: Wed, 8 Dec 2021 16:31:06 +0800 Subject: [PATCH] add arg eta_min (#4815) --- ppdet/optimizer.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ppdet/optimizer.py b/ppdet/optimizer.py index 7fdcddd69..df9ade2e7 100644 --- a/ppdet/optimizer.py +++ b/ppdet/optimizer.py @@ -42,9 +42,10 @@ class CosineDecay(object): the max_iters is much larger than the warmup iter """ - def __init__(self, max_epochs=1000, use_warmup=True): + def __init__(self, max_epochs=1000, use_warmup=True, eta_min=0): self.max_epochs = max_epochs self.use_warmup = use_warmup + self.eta_min = eta_min def __call__(self, base_lr=None, @@ -66,7 +67,8 @@ class CosineDecay(object): value.append(decayed_lr) return optimizer.lr.PiecewiseDecay(boundary, value) - return optimizer.lr.CosineAnnealingDecay(base_lr, T_max=max_iters) + return optimizer.lr.CosineAnnealingDecay( + base_lr, T_max=max_iters, eta_min=self.eta_min) @serializable -- GitLab