From 70e4d0e52445b6e27554777435a84d423bcf3501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eren=20G=C3=B6lge?= Date: Thu, 21 Oct 2021 16:16:50 +0000 Subject: [PATCH] Fix grad_norm handling --- TTS/trainer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TTS/trainer.py b/TTS/trainer.py index 40d1ab6f..9fcd77a7 100644 --- a/TTS/trainer.py +++ b/TTS/trainer.py @@ -647,7 +647,7 @@ class Trainer: optimizer.step() # pytorch skips the step when the norm is 0. So ignore the norm value when it is NaN - if isinstance(grad_norm ,torch.Tensor) and (torch.isnan(grad_norm) or torch.isinf(grad_norm)): + if isinstance(grad_norm, torch.Tensor) and (torch.isnan(grad_norm) or torch.isinf(grad_norm)): grad_norm = 0 step_time = time.time() - step_start_time