未验证 提交 c9691f6d 编写于 作者: J JZ-LIANG 提交者: GitHub

add fleet meta lars and lamb to document (#2654)

* add fleet meta lars and lamb api document

* add fleet meta lars and lamb api document
上级 eb7df1c8
......@@ -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.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册