fix exclusions for Downsample and Upsample

(also simplify list comprehension for exclusion list)
This commit is contained in:
Pierre Chapuis 2024-01-29 10:49:39 +01:00
parent 83c95fcf44
commit deb5e930ae

View file

@ -67,11 +67,8 @@ class SDLoraManager:
def add_loras_to_unet(self, loras: dict[str, Lora], /) -> None: def add_loras_to_unet(self, loras: dict[str, Lora], /) -> None:
unet_loras = {key: loras[key] for key in loras.keys() if "unet" in key} unet_loras = {key: loras[key] for key in loras.keys() if "unet" in key}
exclude: list[str] = []
exclude = [ exclude = [
self.unet_exclusions[exclusion] block for s, block in self.unet_exclusions.items() if all([s not in key for key in unet_loras.keys()])
for exclusion in self.unet_exclusions
if all([exclusion not in key for key in unet_loras.keys()])
] ]
SDLoraManager.auto_attach(unet_loras, self.unet, exclude=exclude) SDLoraManager.auto_attach(unet_loras, self.unet, exclude=exclude)
@ -121,8 +118,8 @@ class SDLoraManager:
return { return {
"time": "TimestepEncoder", "time": "TimestepEncoder",
"res": "ResidualBlock", "res": "ResidualBlock",
"downsample": "DownsampleBlock", "downsample": "Downsample",
"upsample": "UpsampleBlock", "upsample": "Upsample",
} }
@property @property