diff --git a/CHANGELOG.md b/CHANGELOG.md index d78d96980..8428ad8ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,7 @@ - Fix process batch double image save - Fix unapply texture tiling - Fix nunchaku batch support + - Fix LoRA change detection on pipeline type change - Suppress torch empty logging - Improve TAESD live preview downscale handling diff --git a/TODO.md b/TODO.md index 17963a7af..abf0c8d5a 100644 --- a/TODO.md +++ b/TODO.md @@ -8,9 +8,8 @@ Main ToDo list can be found at [GitHub projects](https://github.com/users/vladma - Refactor: Move `model_*` stuff into subfolder - Refactor: sampler options -- Fix LoRA unload for HiRes - Simplify Control tab -- Common repo for T5 and CLiP +- Common repo for `T5` and `CLiP` - Upgrade: unblock `numpy`: see `gradio` - Upgrade: unblock `pydantic`: see @@ -24,6 +23,7 @@ Main ToDo list can be found at [GitHub projects](https://github.com/users/vladma - [IPAdapter negative guidance](https://github.com/huggingface/diffusers/discussions/7167) - [IPAdapter composition](https://huggingface.co/ostris/ip-composition-adapter) +- [Refactor attention](https://github.com/huggingface/diffusers/pull/11311) - [STG](https://github.com/huggingface/diffusers/blob/main/examples/community/README.md#spatiotemporal-skip-guidance) - [LBM](https://github.com/gojasper/LBM) - [SmoothCache](https://github.com/huggingface/diffusers/issues/11135) diff --git a/modules/lora/extra_networks_lora.py b/modules/lora/extra_networks_lora.py index 40982caac..6f5e1b42a 100644 --- a/modules/lora/extra_networks_lora.py +++ b/modules/lora/extra_networks_lora.py @@ -141,10 +141,14 @@ class ExtraNetworkLora(extra_networks.ExtraNetwork): def changed(self, requested: List[str], include: List[str], exclude: List[str]): if shared.opts.lora_force_reload: return True - sd_model = getattr(shared.sd_model, "pipe", shared.sd_model) + sd_model = shared.sd_model.pipe if hasattr(shared.sd_model, 'pipe') else shared.sd_model if not hasattr(sd_model, 'loaded_loras'): sd_model.loaded_loras = {} - key = f'{",".join(include)}:{",".join(exclude)}' + if include is None or len(include) == 0: + include = ['all'] + if exclude is None or len(exclude) == 0: + exclude = ['none'] + key = f'include={",".join(include)}:exclude={",".join(exclude)}' loaded = sd_model.loaded_loras.get(key, []) debug_log(f'Network load: type=LoRA key="{key}" requested={requested} loaded={loaded}') if len(requested) != len(loaded): diff --git a/modules/sd_models.py b/modules/sd_models.py index 8bd122a72..e998abefd 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -858,6 +858,7 @@ def set_diffuser_pipe(pipe, new_pipe_type): sd_checkpoint_info = getattr(pipe, "sd_checkpoint_info", None) sd_model_checkpoint = getattr(pipe, "sd_model_checkpoint", None) embedding_db = getattr(pipe, "embedding_db", None) + loaded_loras = getattr(pipe, "loaded_loras", None) sd_model_hash = getattr(pipe, "sd_model_hash", None) has_accelerate = getattr(pipe, "has_accelerate", None) current_attn_name = getattr(pipe, "current_attn_name", None) @@ -910,6 +911,7 @@ def set_diffuser_pipe(pipe, new_pipe_type): new_pipe.has_accelerate = has_accelerate new_pipe.current_attn_name = current_attn_name new_pipe.default_scheduler = default_scheduler + new_pipe.loaded_loras = loaded_loras if loaded_loras is not None else {} if image_encoder is not None: new_pipe.image_encoder = image_encoder if feature_extractor is not None: