OpenVINO skip LoRa loading if it's already loaded

This commit is contained in:
Disty0
2023-12-03 01:31:36 +03:00
parent 7195087ac2
commit 5cf1da40ce
2 changed files with 5 additions and 1 deletions
@@ -65,7 +65,7 @@ class ExtraNetworkLora(extra_networks.ExtraNetwork):
def deactivate(self, p):
if shared.backend == shared.Backend.DIFFUSERS and hasattr(shared.sd_model, "unload_lora_weights") and hasattr(shared.sd_model, "text_encoder"):
if 'CLIP' in shared.sd_model.text_encoder.__class__.__name__:
if 'CLIP' in shared.sd_model.text_encoder.__class__.__name__ and not (shared.opts.cuda_compile and shared.opts.cuda_compile_backend == "openvino_fx"):
shared.sd_model.unload_lora_weights()
if not self.active and getattr(networks, "originals", None ) is not None:
networks.originals.undo() # remove patches
+4
View File
@@ -150,6 +150,10 @@ def load_networks(names, te_multipliers=None, unet_multipliers=None, dyn_dims=No
recompile_model = True
shared.compiled_model_state.lora_model = []
break
if not recompile_model:
if len(loaded_networks) > 0 and debug:
shared.log.debug(f'OpenVINO: Skipping LoRa loading')
return
else:
recompile_model = True
shared.compiled_model_state.lora_model = []