Skip to content

Commit

Permalink
add update (#36017)
Browse files Browse the repository at this point in the history
  • Loading branch information
ForFishes authored Sep 24, 2021
1 parent 82f255d commit 1691dc7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ def _broadcast_final_loss(self):
def _optimizer_step(self):
if self.scaler:
self.scaler.step(self.optimizer)
self.scaler.update()
else:
self.optimizer.step()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def train_batch(self, batch, model, optimizer, is_mp):
scaled.backward() # do backward

scaler.step(optimizer) # update parameters
scaler.update()
optimizer.clear_grad()
return scaled

Expand Down

0 comments on commit 1691dc7

Please sign in to comment.