Skip to content

Commit c36e0a2

Browse files
Your Nameclaude
andcommitted
feat(mm): log activation multiplier in DENOISE_MEM for self-contained calibration
Each DENOISE_MEM record now carries the 'mult' that produced its estimate, so the implied per-arch multiplier can be back-solved from a single line without external state. This matters during iterative calibration, where the multiplier changes between runs that may share one log file. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 1d9c066 commit c36e0a2

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

invokeai/backend/util/denoise_working_memory.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@ def end_denoise_measure(
242242
"px_w": int(pixel_width),
243243
"batch": int(batch_size),
244244
"elt": int(element_size),
245+
"mult": ACTIVATION_MULTIPLIER["unet"] if is_unet else ACTIVATION_MULTIPLIER["dit"],
245246
"estimate_mb": round(estimate_bytes / MB, 1),
246247
"measured_peak_mb": round(measured / MB, 1),
247248
"resident_before_mb": round(token / MB, 1),

tests/backend/util/test_denoise_working_memory.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Tests for the architecture-scaled denoise working-memory estimator."""
22

3+
import json
34
import types
45

56
import torch
@@ -189,6 +190,11 @@ def debug(self, msg: str) -> None:
189190
if torch.cuda.is_available():
190191
assert token is not None
191192
assert len(log.records) == 1 and log.records[0].startswith("DENOISE_MEM ")
193+
payload = json.loads(log.records[0][len("DENOISE_MEM ") :])
194+
# The record must be self-describing for calibration: it carries the multiplier that produced
195+
# the estimate (flux2 -> "dit" family), so back-solving M needs no external state.
196+
assert payload["mult"] == ACTIVATION_MULTIPLIER["dit"]
197+
assert payload["label"] == "flux2" and "measured_peak_mb" in payload
192198
else:
193199
assert token is None
194200
assert log.records == []

0 commit comments

Comments
 (0)