diff --git a/doc/paddle/api/paddle/distributed/fleet/DistributedStrategy_cn.rst b/doc/paddle/api/paddle/distributed/fleet/DistributedStrategy_cn.rst old mode 100644 new mode 100755 index 7d90083513d071f6f6565690e700241fc88bd335..0092fb5b1cdbb0c5cc32d41e491b118cbb63657d --- a/doc/paddle/api/paddle/distributed/fleet/DistributedStrategy_cn.rst +++ b/doc/paddle/api/paddle/distributed/fleet/DistributedStrategy_cn.rst @@ -55,4 +55,50 @@ DistributedStrategy **avg(bool):** 梯度的融合方式,有两种选择: - **sum**: 梯度求和 -- **avg**: 梯度求平均 \ No newline at end of file +- **avg**: 梯度求平均 + +.. py:attribute:: lars +是否使用LARS optimizer,默认值:False + +**示例代码** + +.. code-block:: python + import paddle.distributed.fleet as fleet + strategy = fleet.DistributedStrategy() + strategy.lars = True + strategy.lars_configs = { + "lars_coeff": 0.001, + "lars_weight_decay": 0.0005, + "epsilon": 0, + "exclude_from_weight_decay": ["batch_norm", ".b"], + } +.. py:attribute:: lars_configs +设置LARS优化器的参数。用户可以配置 lars_coeff,lars_weight_decay,epsilon,exclude_from_weight_decay 参数。 + +**lars_coeff(float):** lars 系数,[原论文](https://arxiv.org/abs/1708.03888) 中的 trust coefficient。 默认值是 0.001. + +**lars_weight_decay(float):** lars 公式中 weight decay 系数。 默认值是 0.0005. + +**exclude_from_weight_decay(list[str]):** 不应用 weight decay 的 layers 的名字列表,某一layer 的name 如果在列表中,这一layer 的 lars_weight_decay将被置为 0. 默认值是 None. + +**epsilon(float):** 一个小的浮点值,目的是维持数值稳定性,避免 lars 公式中的分母为零。 默认值是 0. + +.. py:attribute:: lamb +是否使用LAMB optimizer,默认值:False + +**示例代码** + +.. code-block:: python + import paddle.distributed.fleet as fleet + strategy = fleet.DistributedStrategy() + strategy.lamb = True + strategy.lamb_configs = { + 'lamb_weight_decay': 0.01, + 'exclude_from_weight_decay': [], + } +.. py:attribute:: lamb_configs +设置LAMB优化器的参数。用户可以配置 lamb_weight_decay,exclude_from_weight_decay 参数。 + +**lamb_weight_decay(float):** lars 公式中 weight decay 系数。 默认值是 0.01. + +**exclude_from_weight_decay(list[str]):** 不应用 weight decay 的 layers 的名字列表,某一layer 的name 如果在列表中,这一layer 的 lamb_weight_decay将被置为 0. 默认值是 None.