From ac631bfb2e40d31f85e22f2435530b1e181584f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Deltheil?= Date: Wed, 11 Oct 2023 10:42:21 +0200 Subject: [PATCH] make self attention guidance idempotent Follow up of d3365d6 --- .../foundationals/latent_diffusion/stable_diffusion_1/model.py | 3 +-- .../latent_diffusion/stable_diffusion_xl/model.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/refiners/foundationals/latent_diffusion/stable_diffusion_1/model.py b/src/refiners/foundationals/latent_diffusion/stable_diffusion_1/model.py index 1604f64..402e0cd 100644 --- a/src/refiners/foundationals/latent_diffusion/stable_diffusion_1/model.py +++ b/src/refiners/foundationals/latent_diffusion/stable_diffusion_1/model.py @@ -60,8 +60,7 @@ class StableDiffusion_1(LatentDiffusionModel): if sag := self._find_sag_adapter(): sag.scale = scale else: - sag = SD1SAGAdapter(target=self.unet, scale=scale) - sag.inject() + SD1SAGAdapter(target=self.unet, scale=scale).inject() else: if sag := self._find_sag_adapter(): sag.eject() diff --git a/src/refiners/foundationals/latent_diffusion/stable_diffusion_xl/model.py b/src/refiners/foundationals/latent_diffusion/stable_diffusion_xl/model.py index 819ff8a..b8b52e6 100644 --- a/src/refiners/foundationals/latent_diffusion/stable_diffusion_xl/model.py +++ b/src/refiners/foundationals/latent_diffusion/stable_diffusion_xl/model.py @@ -101,8 +101,7 @@ class StableDiffusion_XL(LatentDiffusionModel): if sag := self._find_sag_adapter(): sag.scale = scale else: - sag = SDXLSAGAdapter(target=self.unet, scale=scale) - sag.inject() + SDXLSAGAdapter(target=self.unet, scale=scale).inject() else: if sag := self._find_sag_adapter(): sag.eject()