From ead32daddf4dcab4731ae922c4f2e3140e7fe04f Mon Sep 17 00:00:00 2001 From: CalamitousFelicitousness Date: Wed, 16 Sep 2026 08:53:08 +0100 Subject: [PATCH] chore(lora): trace pdd head fusion under SD_LORA_DEBUG One line per fused block shows which heads a generation runs on. --- modules/lora/network_pdd.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/lora/network_pdd.py b/modules/lora/network_pdd.py index 86b1744b2..f84dcf098 100644 --- a/modules/lora/network_pdd.py +++ b/modules/lora/network_pdd.py @@ -6,12 +6,16 @@ walk the trajectory. Heads ride on ``Network.extras['pdd']``: ``reconcile`` inst the loaded set, ``pin`` holds the step count and schedule the file was distilled for. """ +import os import copy import weakref import torch from modules.logger import log +debug_log = log.trace if os.environ.get('SD_LORA_DEBUG', None) is not None else lambda *args, **kwargs: None + + METADATA_STEPS = 'pdd_num_steps' METADATA_BLOCK = 'pdd_block_size' EXTRAS_KEY = 'pdd' @@ -179,6 +183,7 @@ class ParallelHead(torch.nn.Module): base_bias = self.base_bias.to(device=bias.device) bias = base_bias + self.strength * (bias - base_bias) self.fused_index, self.fused_weight, self.fused_bias = index, weight, bias + debug_log(f'Network: type=PDD fuse block={index} heads={start}:{stop} out={self.out_features} strength={self.strength}') def forward(self, hidden_states): index = self.step_index()