fix(lora): record how the pass left the weights

The mode shown in the load and unload lines was derived at print time
from the live fuse setting, so a set applied under one setting was
reported under whatever the setting said later, and the unload line
described the pass that was about to replace it rather than the one
being removed. The pass records the mode it actually used.

last_backup_size was created on lora_common by assignment from
networks.py and read back through a getattr default; both fields are
declared where they live now.
This commit is contained in:
CalamitousFelicitousness
2026-08-30 05:01:16 +01:00
parent 4886761980
commit e8659c87ac
2 changed files with 12 additions and 6 deletions
+2
View File
@@ -19,3 +19,5 @@ module_types = [
loaded_networks: list = [] # no type due to circular import
previously_loaded_networks: list = [] # no type due to circular import
extra_network_lora = None # initialized in extra_networks.py
last_backup_size: int = 0 # bytes of weight backups the last activate pass held
last_mode: str = '' # how that pass left the weights: backup, fuse or factor
+10 -6
View File
@@ -288,6 +288,7 @@ def finish_pass(ctx, t0):
native_active = len(l.loaded_networks) > 0
refused_writes = ctx.refused
l.last_backup_size = ctx.backup_size
l.last_mode = 'backup' if ctx.backup_size > 0 else ('fuse' if ctx.fuse else 'factor')
l.timer.activate += time.time() - t0
if ctx.refused > 0:
log.error(f'Network load: type=LoRA networks={[n.name for n in l.loaded_networks]} weights={ctx.applied_weight} bias={ctx.applied_bias} refused={ctx.refused} network partially applied')
@@ -342,12 +343,15 @@ def network_activate(include=None, exclude=None):
def effective_mode():
"""Weight-state label for load logs: backup and fuse say how touched weights restore, factor means the whole load rode the svd channel and unload just drops factors."""
if getattr(l, 'last_backup_size', 0) > 0:
return 'backup'
if lora_overrides.fuse_native():
return 'fuse'
return 'factor'
"""Weight-state label for load logs: backup and fuse say how touched weights restore, factor means the whole load rode the svd channel and unload just drops factors.
Recorded by the pass rather than derived here, so the unload line
describes the pass being unloaded even when the settings it ran under
have since changed.
"""
if l.last_mode:
return l.last_mode
return 'fuse' if lora_overrides.fuse_native() else 'factor'
def network_deactivate(include=None, exclude=None):