From 7f430aae4e41f9ba0ea053585291d03f928dc8e5 Mon Sep 17 00:00:00 2001 From: CalamitousFelicitousness Date: Sun, 30 Aug 2026 04:41:36 +0100 Subject: [PATCH] refactor(lora): drop the unused timer fields and accumulate deactivate time The restore field had no writer and add() had no caller. Deactivate assigned its elapsed time where activate accumulates, so a generation that unloaded more than once reported only the last pass; both are zeroed together when the generation ends. --- modules/lora/lora_timers.py | 5 ----- modules/lora/networks.py | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/modules/lora/lora_timers.py b/modules/lora/lora_timers.py index 6f3e48c33..34a77b03b 100644 --- a/modules/lora/lora_timers.py +++ b/modules/lora/lora_timers.py @@ -5,7 +5,6 @@ class Timer: calc: float = 0 apply: float = 0 move: float = 0 - restore: float = 0 activate: float = 0 deactivate: float = 0 @@ -26,13 +25,9 @@ class Timer: self.calc = 0 self.apply = 0 self.move = 0 - self.restore = 0 if complete: self.activate = 0 self.deactivate = 0 - def add(self, name, t): - self.__dict__[name] += t - def __str__(self): return f'{self.__class__.__name__}({self.summary})' diff --git a/modules/lora/networks.py b/modules/lora/networks.py index 45afb8480..d75a6e795 100644 --- a/modules/lora/networks.py +++ b/modules/lora/networks.py @@ -330,7 +330,7 @@ def network_deactivate(include=None, exclude=None): module.network_current_names = () if task is not None: pbar.update(task, advance=1, description=f'networks={len(l.previously_loaded_networks)} modules={active_components} layers={total} unapply={len(applied_layers)}') - l.timer.deactivate = time.time() - t0 + l.timer.deactivate += time.time() - t0 if refused > 0: log.error(f'Network unload: type=LoRA networks={[n.name for n in l.previously_loaded_networks]} unapply={len(applied_layers)} refused={refused} network partially removed') if l.debug and len(l.previously_loaded_networks) > 0: