From ce22c8f51b087768f95add57e55718135f466493 Mon Sep 17 00:00:00 2001 From: Pierre Chapuis Date: Fri, 26 Jan 2024 17:02:28 +0100 Subject: [PATCH] fix detection of unet-only LoRAs --- src/refiners/foundationals/latent_diffusion/lora.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/refiners/foundationals/latent_diffusion/lora.py b/src/refiners/foundationals/latent_diffusion/lora.py index 884874b..eb2c491 100644 --- a/src/refiners/foundationals/latent_diffusion/lora.py +++ b/src/refiners/foundationals/latent_diffusion/lora.py @@ -44,8 +44,8 @@ class SDLoraManager: loras = {key: loras[key] for key in sorted(loras.keys(), key=SDLoraManager.sort_keys)} # if no key contains "unet" or "text", assume all keys are for the unet - if not "unet" in loras and not "text" in loras: - loras = {f"unet_{key}": loras[key] for key in loras.keys()} + if all(["unet" not in key and "text" not in key for key in loras.keys()]): + loras = {f"unet_{key}": value for key, value in loras.items()} self.add_loras_to_unet(loras) self.add_loras_to_text_encoder(loras)