You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: python/paddle/distributed/fleet/meta_parallel/sharding/group_sharded_stage2.py
+32-15Lines changed: 32 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -155,6 +155,8 @@ def __init__(
155
155
# Set backward pass hooks
156
156
self._bw_hooks= []
157
157
158
+
self.scale_in_opt=False
159
+
158
160
# TODO (Baibaifan) Set tasks flow support asynchronous communicate
159
161
# self._tasks_flow = deque()
160
162
@@ -232,13 +234,20 @@ def _clear_gradients(self):
232
234
233
235
def_grad_scale(self):
234
236
"""
235
-
Before the optimization, scale the gradients before allreduce of dp_group.
237
+
this function will do 2 things:
238
+
1. Before the optimization, scale main_grad to support gradient merge if param has main_grad, or to support fused_linear_param_grad_add gradient merge.
239
+
2. Before the optimization, scale the gradients before allreduce of dp_group.
0 commit comments