未验证 提交 03511689 编写于 作者: L LielinJiang 提交者: GitHub

Fix lr scheduler step error in hapi when use static mode (#28297)

* fix lr scheduler

* fix code style
上级 89530384
......@@ -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()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册