cleanup lora overrides

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-01-28 18:47:45 -05:00
parent 50f73c9553
commit da6a1979ff
3 changed files with 24 additions and 20 deletions
+7 -4
View File
@@ -179,11 +179,14 @@ class ExtraNetworkLora(extra_networks.ExtraNetwork):
networks.previously_loaded_networks = networks.loaded_networks.copy()
debug_log(f'Load network: type=LoRA active={[n.name for n in networks.previously_loaded_networks]} deactivate')
if shared.native and len(networks.diffuser_loaded) > 0:
if hasattr(shared.sd_model, "unload_lora_weights") and hasattr(shared.sd_model, "text_encoder"):
if not (shared.compiled_model_state is not None and shared.compiled_model_state.is_compiled is True):
if not (shared.compiled_model_state is not None and shared.compiled_model_state.is_compiled is True):
if hasattr(shared.sd_model, "unfuse_lora"):
try:
shared.sd_model.unfuse_lora()
except Exception:
pass
if hasattr(shared.sd_model, "unload_lora_weights"):
try:
if shared.opts.lora_fuse_diffusers:
shared.sd_model.unfuse_lora()
shared.sd_model.unload_lora_weights() # fails for non-CLIP models
except Exception:
pass
+16 -15
View File
@@ -2,31 +2,32 @@ from modules import shared
maybe_diffusers = [ # forced if lora_maybe_diffusers is enabled
'aaebf6360f7d', # sd15-lcm
'3d18b05e4f56', # sdxl-lcm
'b71dcb732467', # sdxl-tcd
'813ea5fb1c67', # sdxl-turbo
# 'aaebf6360f7d', # sd15-lcm
# '3d18b05e4f56', # sdxl-lcm
# 'b71dcb732467', # sdxl-tcd
# '813ea5fb1c67', # sdxl-turbo
# not really needed, but just in case
'5a48ac366664', # hyper-sd15-1step
'ee0ff23dcc42', # hyper-sd15-2step
'e476eb1da5df', # hyper-sd15-4step
'ecb844c3f3b0', # hyper-sd15-8step
'1ab289133ebb', # hyper-sd15-8step-cfg
'4f494295edb1', # hyper-sdxl-8step
'ca14a8c621f8', # hyper-sdxl-8step-cfg
'1c88f7295856', # hyper-sdxl-4step
'fdd5dcd1d88a', # hyper-sdxl-2step
'8cca3706050b', # hyper-sdxl-1step
# '5a48ac366664', # hyper-sd15-1step
# 'ee0ff23dcc42', # hyper-sd15-2step
# 'e476eb1da5df', # hyper-sd15-4step
# 'ecb844c3f3b0', # hyper-sd15-8step
# '1ab289133ebb', # hyper-sd15-8step-cfg
# '4f494295edb1', # hyper-sdxl-8step
# 'ca14a8c621f8', # hyper-sdxl-8step-cfg
# '1c88f7295856', # hyper-sdxl-4step
# 'fdd5dcd1d88a', # hyper-sdxl-2step
# '8cca3706050b', # hyper-sdxl-1step
]
force_diffusers = [ # forced always
'816d0eed49fd', # flash-sdxl
'c2ec22757b46', # flash-sd15
'22c8339e7666', # spo-sdxl-10ep
]
force_models = [ # forced always
'sc',
# 'sd3',
'sc',
'kandinsky',
'hunyuandit',
'hunyuanvideo',
+1 -1
View File
@@ -213,7 +213,7 @@ def list_lora():
import sys
lora = [v for k, v in sys.modules.items() if k == 'networks' or k == 'modules.lora.networks'][0]
loras = [v.fullname for v in lora.available_networks.values()]
return ['None'] + loras
return ['None'] + sorted(loras)
def apply_lora(p, x, xs):