fix(lora): let stack degradation warnings recur after a settings change

The keys that mark a degradation as reported lived for the life of the
process, so a user who saw "flip=skipped weight=offloaded", changed the
offload mode and hit the same wall again was told nothing the second
time. Tie the set to the settings the warnings speak about: the stack
signature, the offload mode, the host rank and the checkpoint. Repeating
under one context still says it once.
This commit is contained in:
CalamitousFelicitousness
2026-08-30 04:39:01 +01:00
parent 2db573d283
commit 88d263ba14
2 changed files with 46 additions and 1 deletions
+11
View File
@@ -33,6 +33,7 @@ SAMPLE_CAP = 1 << 22 # strided subsample bound for magnitude quantiles (full-siz
state: dict = {'entries': {}, 'flips': {}, 'gamma': 1.0, 'gamma_e': 1.0, 'total_steps': 0, 'finalized': False, 'reported': None}
warned: set = set()
warned_context = None
def mode():
@@ -60,7 +61,17 @@ def signature():
return 'sum'
def warn_context():
"""Settings the degradation warnings below speak about."""
return (signature(), getattr(shared.opts, 'diffusers_offload_mode', ''), int(getattr(shared.opts, 'lora_sdnq_host_rank', 0) or 0), getattr(shared.opts, 'sd_model_checkpoint', ''))
def warn_once(key, message):
global warned_context # pylint: disable=global-statement
context = warn_context()
if context != warned_context:
warned.clear() # what was reported under the old settings says nothing about the new ones
warned_context = context
if key not in warned:
warned.add(key)
log.warning(message)