diff --git a/paddleseg/cvlibs/config.py b/paddleseg/cvlibs/config.py index 0cefb55701..4f924f324a 100644 --- a/paddleseg/cvlibs/config.py +++ b/paddleseg/cvlibs/config.py @@ -158,12 +158,14 @@ def lr_scheduler(self) -> paddle.optimizer.lr.LRScheduler: if 'warmup_iters' in params: use_warmup = True warmup_iters = params.pop('warmup_iters') + assert 'warmup_start_lr' in params, "Please set warmup_start_lr in lr_scheduler" warmup_start_lr = params.pop('warmup_start_lr') end_lr = params['learning_rate'] lr_type = params.pop('type') if lr_type == 'PolynomialDecay': - params.setdefault('decay_steps', self.iters) + iters = self.iters - warmup_iters if use_warmup else self.iters + params.setdefault('decay_steps', iters) params.setdefault('end_lr', 0) params.setdefault('power', 0.9) lr_sche = getattr(paddle.optimizer.lr, lr_type)(**params)