提交 949be3bc 编写于 作者: L luyuxiang 提交者: Meiyim

fix amp init_loss_scaling

上级 3b9d92fc
...@@ -73,7 +73,7 @@ def optimization( ...@@ -73,7 +73,7 @@ def optimization(
#amp_list = P.fluid.contrib.mixed_precision.AutoMixedPrecisionLists( #amp_list = P.fluid.contrib.mixed_precision.AutoMixedPrecisionLists(
# custom_white_list=['softmax', 'layer_norm', 'gelu']) # custom_white_list=['softmax', 'layer_norm', 'gelu'])
optimizer = P.fluid.contrib.mixed_precision.decorate( optimizer = P.fluid.contrib.mixed_precision.decorate(
optimizer, init_loss_scaling=3**15, use_dynamic_loss_scaling=True) optimizer, init_loss_scaling=2**15, use_dynamic_loss_scaling=True)
_, param_grads = optimizer.minimize(loss) _, param_grads = optimizer.minimize(loss)
loss_scaling = P.static.default_main_program().global_block().var( loss_scaling = P.static.default_main_program().global_block().var(
'loss_scaling_0') 'loss_scaling_0')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册