make self attention guidance idempotent

Follow up of d3365d6
This commit is contained in:
Cédric Deltheil 2023-10-11 10:42:21 +02:00 committed by Cédric Deltheil
parent 0024191c58
commit ac631bfb2e
2 changed files with 2 additions and 4 deletions

View file

@ -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()

View file

@ -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()