mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user