diff --git a/python/paddle/hapi/model.py b/python/paddle/hapi/model.py index ff962fb1c1d5cbc1cb648757b056f1657b966c96..aa99d698bc7b2b413855f14fbb5fd5d8b22e293d 100644 --- a/python/paddle/hapi/model.py +++ b/python/paddle/hapi/model.py @@ -454,7 +454,8 @@ class StaticGraphAdapter(object): rets.insert(i, feed[name]) # step learning rate scheduler on each batch end - if self.model._optimizer and \ + if self.model._optimizer and self.mode == 'train' and \ + hasattr(self.model._optimizer, '_learning_rate') and \ isinstance(self.model._optimizer._learning_rate, paddle.optimizer.lr.LRScheduler): self.model._optimizer._learning_rate.step()