Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jul 1, 2023
1 parent 07b0f27 commit 388b12f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nemo/core/optim/distributed_adam.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def __init__(self, params, disable_distributed_parameters=False, **kwargs):

def _fp32_register_post_backward_hooks(self):
"""Attach hooks for FP32 gradients"""

def make_post_backward_hook(param):
def post_backward_hook(*unused):
self._fp32_optim_grad_sync_needed = True
Expand All @@ -129,6 +130,7 @@ def post_backward_hook(*unused):
if param.grad is not None:
param.main_grad += param.grad.detach()
param.grad = None

self._fp32_grad_accs = []
for param in self._fp32_optim_main_params.keys():
param_tmp = param.expand_as(param)
Expand Down

0 comments on commit 388b12f

Please sign in to comment.