Skip to content

Commit

Permalink
Merge pull request #706 from mv1388/add_optimizer_zerograd_to_TestIMD…
Browse files Browse the repository at this point in the history
…BBERT_AMP

Add optmizer zero grad to the AMP BERT GPU test
  • Loading branch information
mv1388 committed Jul 16, 2022
2 parents 09a687b + e3300df commit d904e34
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests_gpu/test_single_gpu/test_amp/test_imdb_bert.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ def train_eval_core_pytorch(self, train_data, test_data, num_epochs):
scaler.step(optimizer)
scaler.update()

optimizer.zero_grad()

# Imitate what happens in auto_execute_end_of_epoch() in TrainLoop
for _ in train_loader:
pass
Expand Down

0 comments on commit d904e34

Please sign in to comment.