未验证 提交 d82d59e6 编写于 作者: A Aurelius84 提交者: GitHub

[cherry-pick] Fix amp support fleet(#29505)

上级 4d51cd73
...@@ -66,6 +66,8 @@ class OptimizerWithMixedPrecision(object): ...@@ -66,6 +66,8 @@ class OptimizerWithMixedPrecision(object):
self._loss_scaling = None self._loss_scaling = None
self._init_loss_scaling = init_loss_scaling self._init_loss_scaling = init_loss_scaling
self._use_dynamic_loss_scaling = use_dynamic_loss_scaling self._use_dynamic_loss_scaling = use_dynamic_loss_scaling
self._learning_rate = optimizer._learning_rate
self._learning_rate_map = optimizer._learning_rate_map
if self._use_dynamic_loss_scaling: if self._use_dynamic_loss_scaling:
self._incr_every_n_steps = incr_every_n_steps self._incr_every_n_steps = incr_every_n_steps
self._decr_every_n_nan_or_inf = decr_every_n_nan_or_inf self._decr_every_n_nan_or_inf = decr_every_n_nan_or_inf
......
...@@ -3751,7 +3751,9 @@ class PipelineOptimizer(object): ...@@ -3751,7 +3751,9 @@ class PipelineOptimizer(object):
if framework.in_dygraph_mode(): if framework.in_dygraph_mode():
raise Exception("In dygraph, don't support PipelineOptimizer.") raise Exception("In dygraph, don't support PipelineOptimizer.")
if not isinstance(optimizer, Optimizer) and not isinstance( if not isinstance(optimizer, Optimizer) and not isinstance(
optimizer, paddle.optimizer.Optimizer): optimizer, paddle.optimizer.Optimizer) and not isinstance(
optimizer, paddle.fluid.contrib.mixed_precision.decorator.
OptimizerWithMixedPrecision):
raise ValueError("The 'optimizer' parameter for " raise ValueError("The 'optimizer' parameter for "
"PipelineOptimizer must be an instance of " "PipelineOptimizer must be an instance of "
"Optimizer, but the given type is {}.".format( "Optimizer, but the given type is {}.".format(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册