fix LoRA change detection on pipeline type change

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-06-29 12:52:37 -04:00
parent 1b4e1ff0ef
commit ff103bc849
4 changed files with 11 additions and 4 deletions
+1
View File
@@ -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
+2 -2
View File
@@ -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 <https://github.com/Cschlaefli/automatic>
@@ -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)
+6 -2
View File
@@ -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):
+2
View File
@@ -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: