Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Miltos Allamanis committed Oct 21, 2021
1 parent ef13a9f commit 53af808
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ptgnn/baseneuralmodel/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ def _run_training(
parallelize=parallelize,
)
):
optimizer.zero_grad()
optimizer.zero_grad(
set_to_none=True
) # https://pytorch.org/docs/stable/generated/torch.optim.Optimizer.zero_grad.html#torch.optim.Optimizer.zero_grad)
with catch_cuda_oom(self._catch_cuda_ooms):
with torch.cuda.amp.autocast(enabled=self._enable_amp):
mb_loss = self.neural_module(**mb_data)
Expand Down

0 comments on commit 53af808

Please sign in to comment.