From 12ff37d8e3eb942f62d1107c46b20d843d878346 Mon Sep 17 00:00:00 2001 From: asagi4 <130366179+asagi4@users.noreply.github.com> Date: Mon, 2 Sep 2024 19:08:31 +0300 Subject: [PATCH] Don't fail when self.guidance is None --- py/sonar.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/py/sonar.py b/py/sonar.py index c1a1631..c05b7d6 100644 --- a/py/sonar.py +++ b/py/sonar.py @@ -157,8 +157,7 @@ class SonarGuidanceMixin: return ((latent - avg_s) / std_s).to(latent.dtype) def guidance_step(self, step_index: int, x: Tensor, denoised: Tensor): - step_matched = self.guidance.start_step <= step_index <= self.guidance.end_step - if self.guidance is None or self.guidance.factor == 0.0 or not step_matched: + if self.guidance is None or self.guidance.factor == 0.0 or not self.guidance.start_step <= step_index <= self.guidance.end_step: return x if self.ref_latent.device != x.device: self.ref_latent = self.ref_latent.to(device=x.device)