From aeff1a4cc71dfff2a02cd9e3eb2bac0b6953dbe5 Mon Sep 17 00:00:00 2001 From: James Betker Date: Tue, 21 Jun 2022 20:26:19 -0600 Subject: [PATCH] divided by zero --- codes/trainer/injectors/gaussian_diffusion_injector.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codes/trainer/injectors/gaussian_diffusion_injector.py b/codes/trainer/injectors/gaussian_diffusion_injector.py index 7f82a821..692bbf46 100644 --- a/codes/trainer/injectors/gaussian_diffusion_injector.py +++ b/codes/trainer/injectors/gaussian_diffusion_injector.py @@ -62,9 +62,9 @@ class GaussianDiffusionInjector(Injector): def extra_metrics(self): uqt = self.latest_timesteps > self.num_timesteps * 3 / 4 - uql = (self.latest_mse_by_batch * uqt).sum() / uqt.sum() + uql = (self.latest_mse_by_batch * uqt).sum() / uqt.sum() if uqt.sum() != 0 else 0 muqt = (self.latest_timesteps > self.num_timesteps / 2) * (self.latest_timesteps < self.num_timesteps * 3 / 4) - muql = (self.latest_mse_by_batch * muqt).sum() / muqt.sum() + muql = (self.latest_mse_by_batch * muqt).sum() / muqt.sum() if muqt.sum() != 0 else 0 d = { 'upper_quantile_mse_loss': uql, 'mid_upper_quantile_mse_loss': muql,