Skip to content

Commit

Permalink
Make FLAGS_force_align_vpp_grad_sum_order default to false (#54937)
Browse files Browse the repository at this point in the history
* make FLAGS_force_align_vpp_grad_sum_order default to false

* polish code
  • Loading branch information
sneaxiy authored Jun 28, 2023
1 parent 7c76406 commit ac7f09a
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self, clip, hcg):
self.not_sharding_stage1 = True
self._vpp_chunk_num = None
self._force_align_vpp_grad_sum_order = distutils.util.strtobool(
os.getenv('FLAGS_force_align_vpp_grad_sum_order', '1')
os.getenv('FLAGS_force_align_vpp_grad_sum_order', '0')
)

def _get_vpp_chunk_num(self, params_grads):
Expand Down Expand Up @@ -168,9 +168,10 @@ def _add_sum_squares(self, sum_squares):

@no_grad()
def _dygraph_clip(self, params_grads):
chunk_num = self._get_vpp_chunk_num(params_grads)
if chunk_num > 0 and self._force_align_vpp_grad_sum_order:
return self._vpp_dygraph_clip(params_grads, chunk_num)
if self._force_align_vpp_grad_sum_order:
chunk_num = self._get_vpp_chunk_num(params_grads)
if chunk_num > 0:
return self._vpp_dygraph_clip(params_grads, chunk_num)

sum_square_dist_fp16 = []
sum_square_dist_bf16 = []
Expand Down

0 comments on commit ac7f09a

Please sign in to comment.