mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-01-06 15:15:05 +08:00
backup only for needed weights required by lora
This commit is contained in:
parent
2a1988fa67
commit
412401becb
@ -429,6 +429,18 @@ def network_backup_weights(self):
|
|||||||
current_names = getattr(self, "network_current_names", ())
|
current_names = getattr(self, "network_current_names", ())
|
||||||
wanted_names = tuple((x.name, x.te_multiplier, x.unet_multiplier, x.dyn_dim) for x in loaded_networks)
|
wanted_names = tuple((x.name, x.te_multiplier, x.unet_multiplier, x.dyn_dim) for x in loaded_networks)
|
||||||
|
|
||||||
|
need_backup = False
|
||||||
|
for net in loaded_networks:
|
||||||
|
if network_layer_name in net.modules:
|
||||||
|
need_backup = True
|
||||||
|
break
|
||||||
|
elif network_layer_name + "_q_proj" in net.modules:
|
||||||
|
need_backup = True
|
||||||
|
break
|
||||||
|
|
||||||
|
if not need_backup:
|
||||||
|
return
|
||||||
|
|
||||||
weights_backup = getattr(self, "network_weights_backup", None)
|
weights_backup = getattr(self, "network_weights_backup", None)
|
||||||
if weights_backup is None and wanted_names != ():
|
if weights_backup is None and wanted_names != ():
|
||||||
if current_names != () and not allowed_layer_without_weight(self):
|
if current_names != () and not allowed_layer_without_weight(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user