Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio diffusion: place bf16 and GGUF / int8 packed denoisers from their learned peak (#13860)
Daniel Hanbf2725e4166a
diff --git a/studio/backend/core/inference/diffusion.py b/studio/backend/core/inference/diffusion.pyindex 10cf6379d5b..20728730021 100644--- a/studio/backend/core/inference/diffusion.py+++ b/studio/backend/core/inference/diffusion.py@@ -197,6 +197,9 @@ from .diffusion_memory import (refine_memory_plan_for_components,refine_plan_from_loaded_weights,learned_peak_label,+ CFG_OFF_PART,+ cfg_off_peaks_enabled,+ without_cfg_off,live_vae_saver_tag,planned_vae_saver_tag,stream_window_pad_mib,@@ -2501,7 +2504,7 @@ def _start_peak_probe(state: Any) -> Any:# cache (same count): a later peak above that start omits memory a fresh process allocates on its first# renderreturn None- if _live_peak_identity(state) != tuple(identity):+ if not _peak_identity_matches(state, identity):# this render runs a configuration the key does not name (a speed tier or step cache that toggled, a VAE# saver the guard engaged for it, another attention backend): its peak belongs to no keyreturn None@@ -2555,16 +2558,28 @@ def _live_peak_identity(state: Any) -> tuple:speed = None # a background compile is still pending: this render runs eager under a compiled tierexcept Exception: # noqa: BLE001speed = None- # a family that can run classifier-free guidance records only renders that do (the doubled denoiser batch)+ # Unknown guidance, or CFG on a family that never runs it, records nothing.family_obj = getattr(state, "family", None)expects_cfg = bool(getattr(family_obj, "uses_negative_prompt", False))- if bool(getattr(pipe, "_unsloth_peak_cfg", expects_cfg)) != expects_cfg:+ cfg = getattr(pipe, "_unsloth_peak_cfg", expects_cfg)+ if cfg is None:speed = None+ elif bool(cfg) != expects_cfg:+ if expects_cfg and cfg_off_peaks_enabled():+ label = f"{label}|{CFG_OFF_PART}"+ else:+ speed = Noneif getattr(pipe, "_unsloth_loras", None):speed = None # LoRA adapters add rank-dependent activations no key namesreturn (family, label, speed)+def _peak_identity_matches(state: Any, identity: Any) -> bool:+ """The render runs the configuration the load's identity names (``cfg:off`` aside)."""+ family, label, speed = _live_peak_identity(state)+ return (family, without_cfg_off(label), speed) == tuple(identity)++def _live_graph_mode(state: Any) -> str:"""``step`` / ``blocks`` (``_engaged_graph_mode``) while the load's CUDA graphs are armed and not dropped(``live_status``), else ``off``."""@@ -2715,7 +2730,7 @@ def _record_peak_probe(peak = probe.finish()if peak is None or not isinstance(identity, tuple) or len(identity) != 3:return- if _live_peak_identity(state) != tuple(identity):+ if not _peak_identity_matches(state, identity):# the configuration moved during the render (a compile fallback, a toggled cache): no key names itreturnif cuda_graph.failed_capture_count() != getattr(probe, "failed_captures", 0):@@ -2730,7 +2745,9 @@ def _record_peak_probe(# the SDPA probe could not tell math from a fused kernel: a quadratic peak stored as linear would# under-size every larger requestreturn- family, quant, speed_mode = identity+ family, quant, speed_mode = _live_peak_identity(+ state+ ) # the key this render ran (``cfg:off`` included)pipe = state.pipeindex = getattr(probe.device, "index", None)graphs = cuda_graph.live_graph_count(index)@@ -9543,6 +9560,10 @@ class DiffusionBackend:try:# the phase-table seed holds only where it was measuredpipe._unsloth_phase_seeds = _calibrated_activation(fam, target) is not None+ # a CFG-capable family may place from a peak recorded without CFG (``cfg:off``)+ pipe._unsloth_peak_expects_cfg = bool(+ getattr(fam, "uses_negative_prompt", False)+ )except Exception: # noqa: BLE001passpeak_vae = planned_vae_saver_tag(pipe, plan)@@ -9602,6 +9623,8 @@ class DiffusionBackend:plan.estimates.get("measured_learned_peak_mib"),plan.estimates.get("measured_learned_peak_pixels"),plan.estimates.get("measured_learned_peak_quadratic"),+ plan.estimates.get("measured_static_seed", True),+ plan.estimates.get("measured_learned_cfg_off", False),)from .diffusion_qwenimage21_vision import configure_vision_attention@@ -12545,12 +12568,17 @@ class DiffusionBackend:# layers + 1 extra canvas-sized frames beside the output-sized one.guard_condition_pixels += (layer_count + 1) * guard_width * guard_height# past what the measured placement reserved: stream resident groups again for this call+ try:+ guard_cfg = _negative_prompt_engaged(fam, guidance)+ except Exception: # noqa: BLE001 - unknown: sized as a CFG request+ guard_cfg = Noneextra_mib = measured_request_extra_mib(state.pipe,width = guard_width,height = guard_height,batch_size = guard_batch,condition_pixels = guard_condition_pixels,+ cfg = guard_cfg,)if extra_mib > 0:releasable_mib = resident_group_mib(state.pipe)diff --git a/studio/backend/core/inference/diffusion_memory.py b/studio/backend/core/inference/diffusion_memory.pyindex 6f0e491b05a..88c8595e50f 100644--- a/studio/backend/core/inference/diffusion_memory.py+++ b/studio/backend/core/inference/diffusion_memory.py@@ -2593,6 +2593,7 @@ def measured_image_runtime_mib(compute_bytes: int = 2,quant: Optional[str] = None,phase_seeds: bool = False,+ static_seed: bool = True,) -> Optional[int]:"""Measured runtime headroom for ``family`` at this size, or None (unmeasured: use the flat estimate).``dense_transformer_mib`` selects the dense eager table; ``compute_bytes`` scales it (fp32 Qwen-Image: 8480 vs 4248).@@ -2601,13 +2602,15 @@ def measured_image_runtime_mib(quantity per phase) for a quantised family the peak table lacks, only with ``phase_seeds`` (the target is wherethose were measured: NVIDIA with a sub-quadratic attention kernel, ``_calibrated_activation``). ``quant`` (``denoiser_quant_label``) adds thepeak this machine recorded for (family, quant, speed tier, resolution bucket) at an earlier render- (diffusion_measured_peaks): it raises a seed and stands in for a missing one, never lowers a seed."""+ (diffusion_measured_peaks): it raises a seed and stands in for a missing one, never lowers a seed.+ ``static_seed=False`` (a denoiser no static table was measured on: bf16 or GGUF / int8 packed dense weights)+ answers from the learned peak alone."""if _env_off(MEASURED_ACTIVATION_ENV):return Noneseed: Optional[int] = None- if dense_transformer_mib is not None:- if _env_off(MEASURED_ACTIVATION_DENSE_ENV):- return None+ if dense_transformer_mib is not None and _env_off(MEASURED_ACTIVATION_DENSE_ENV):+ return None+ if static_seed and dense_transformer_mib is not None:entry = _MEASURED_DENSE_EAGER_PEAK_MIB.get(str(family or "").lower())if entry is not None and str(speed_mode or "") in _MEASURED_DENSE_SPEED_MODES:peak, max_dit = entry@@ -2615,7 +2618,7 @@ def measured_image_runtime_mib(peak, max_dit = peak * widen // 2, max_dit * widen // 2if 0 < int(dense_transformer_mib) <= max_dit:seed = peak- elif str(speed_mode or "") in _MEASURED_PEAK_SPEED_MODES:+ elif static_seed and str(speed_mode or "") in _MEASURED_PEAK_SPEED_MODES:seed = _MEASURED_IMAGE_PEAK_MIB.get(str(family or "").lower())if seed is None and phase_seeds:phases = _MEASURED_IMAGE_ACTIVATION_MIB.get(str(family or "").lower())@@ -2666,6 +2669,37 @@ def learned_peak_label(return label+# Renders without guidance on a CFG-capable family; read only when no CFG peak exists.+CFG_OFF_PART = "cfg:off"+LEARNED_PEAKS_CFG_OFF_ENV = "UNSLOTH_DIFFUSION_LEARNED_PEAKS_CFG_OFF"+++def cfg_off_peaks_enabled() -> bool:+ return not _env_off(LEARNED_PEAKS_CFG_OFF_ENV)+++def without_cfg_off(label: str) -> str:+ return "|".join(part for part in str(label).split("|") if part != CFG_OFF_PART)+++def _learned_read_label(+ pipe: Any, family: Optional[str], quant: str, speed_mode: Optional[str]+) -> tuple[str, bool]:+ """``(label, cfg_off_only)``: True means CFG requests must be sized from the flat estimate."""+ from .diffusion_measured_peaks import lookup_bucket++ if (+ not getattr(pipe, "_unsloth_peak_expects_cfg", False)+ or not cfg_off_peaks_enabled()+ or lookup_bucket(family = family, quant = quant, speed_mode = speed_mode) is not None+ ):+ return quant, False+ off = f"{quant}|{CFG_OFF_PART}"+ if lookup_bucket(family = family, quant = off, speed_mode = speed_mode) is None:+ return quant, False+ return off, True++def with_label_part(label: str, name: str, value: str) -> str:"""``label`` with its ``name:`` part replaced by ``value`` (unchanged when it has no such part)."""return "|".join(@@ -3047,7 +3081,8 @@ def refine_plan_from_loaded_weights(Keeps the flat plan's offload hooks and makes whole groups resident (denoiser first, then encoders) within thesafe budget left after the measured peak x margin and the base overhead. No-op for explicit modes, non-CUDA / unified memory, unmeasured families (dense denoisers: the eager-tier table)- or speed tiers, non-torchao denoisers and ``model`` plans."""+ or speed tiers and ``model`` plans. A bf16 or GGUF / int8 packed dense denoiser (no static table measured it)+ places only from a learned peak recorded for its exact build."""try:if getattr(plan, "requested_mode", None) != MEMORY_MODE_AUTO:return plan@@ -3071,28 +3106,31 @@ def refine_plan_from_loaded_weights(return plandense_mib = None if _pipe_denoisers_hold_torchao(pipe) else ditcompute_bytes = _denoiser_compute_bytes(pipe)- if dense_mib is not None and (compute_bytes is None or _pipe_denoisers_hold_packed(pipe)):- # measured on fp16 / fp32 cards only; bf16 cards can compile later- return plan+ # The dense table covers fp16 / fp32 unpacked weights only: bf16 and packed denoisers use a learned peak alone.+ static_seed = not (+ dense_mib is not None and (compute_bytes is None or _pipe_denoisers_hold_packed(pipe))+ )quant = learned_peak_label(pipe, attention, model, vae, te, cache, graphs)try:pipe._unsloth_peak_identity = (family, quant, speed_mode)except Exception: # noqa: BLE001 - a pipe refusing attributes only skips recordingpass+ read_quant, cfg_off_only = _learned_read_label(pipe, family, quant, speed_mode)headroom = measured_image_runtime_mib(family,speed_mode,dense_transformer_mib = dense_mib,compute_bytes = compute_bytes or 2,- quant = quant,+ quant = read_quant,phase_seeds = bool(getattr(pipe, "_unsloth_phase_seeds", False)),+ static_seed = static_seed,)if headroom is None:return planfrom .diffusion_measured_peaks import lookup_bucketlearned, learned_pixels, learned_quadratic = lookup_bucket(- family = family, quant = quant, speed_mode = speed_mode+ family = family, quant = read_quant, speed_mode = speed_mode) or (None, None, False)overhead = int(plan.estimates.get("base_overhead_mib") or DEFAULT_BASE_OVERHEAD_MIB)floor = headroom + overhead + other@@ -3104,6 +3142,8 @@ def refine_plan_from_loaded_weights(measured_learned_peak_quadratic = learned_quadratic,measured_dense_transformer_mib = dense_mib,measured_compute_bytes = compute_bytes,+ measured_static_seed = static_seed,+ measured_learned_cfg_off = bool(cfg_off_only and learned),loaded_transformer_mib = dit,loaded_text_encoder_mib = encoders,loaded_other_mib = other,@@ -3810,8 +3850,10 @@ def measured_request_extra_mib(height: Optional[int],batch_size: int = 1,condition_pixels: int = 0,+ cfg: Optional[bool] = None,) -> int:- """MiB a request needs beyond what the measured placement reserved (0 when it fits or none was made)."""+ """MiB a request needs beyond what the measured placement reserved (0 when it fits or none was made). ``cfg``:+ whether the request runs classifier-free guidance (None: unknown, treated as running it)."""reserve = getattr(pipe, "_unsloth_measured_reserve", None)if not reserve:return 0@@ -3830,10 +3872,15 @@ def measured_request_extra_mib(# after the load only places the NEXT load, it must not stream resident groups for a request the same size as one# that just completed. An unseeded family was placed from its learned peak, which is all there is to check against.sized["phase_seeds"] = bool(getattr(pipe, "_unsloth_phase_seeds", False))+ sized["static_seed"] = bool(reserve[8]) if len(reserve) > 8 and reserve[8] is not None else Trueneed = measured_image_runtime_mib(family, speed_mode, **sized)learned = reserve[5] if len(reserve) > 5 else None+ # placed from a peak recorded without CFG: a request that runs it doubles the denoiser batch no measurement covers+ cfg_unmeasured = bool(len(reserve) > 9 and reserve[9]) and cfg is not Falseif (learned or need is None) and (- getattr(pipe, "_unsloth_peak_static", False) or getattr(pipe, "_unsloth_loras", None)+ getattr(pipe, "_unsloth_peak_static", False)+ or getattr(pipe, "_unsloth_loras", None)+ or cfg_unmeasured):# the learned peak no longer describes this pipeline (runtime LoRA adapters, a planned VAE saver that did not# engage): requests size from the flat estimatediff --git a/studio/backend/tests/test_diffusion_learned_peaks.py b/studio/backend/tests/test_diffusion_learned_peaks.pyindex a4016fede98..bb7146ad825 100644--- a/studio/backend/tests/test_diffusion_learned_peaks.py+++ b/studio/backend/tests/test_diffusion_learned_peaks.py@@ -1646,18 +1646,108 @@ def test_live_graph_count_is_per_device_and_drops_reset_graphs():bg._LIVE_BLOCKS.discard(blocks)-def test_render_without_the_familys_cfg_is_not_probed(monkeypatch):+def test_render_without_the_familys_cfg_records_under_its_cfg_off_key(monkeypatch):diffusion, state = _probe_state(monkeypatch, "q|vae:full|attn:native")monkeypatch.setattr(diffusion, "stream_window_pad_mib", lambda pipe: 0)+ monkeypatch.delenv(dm.LEARNED_PEAKS_CFG_OFF_ENV, raising = False)state.family = types.SimpleNamespace(uses_negative_prompt = True)state.pipe._unsloth_peak_cfg = Trueassert diffusion._start_peak_probe(state) is not None- state.pipe._unsloth_peak_cfg = False # guidance off: half the denoiser batch+ assert "cfg:off" not in diffusion._live_peak_identity(state)[1]+ # guidance off (Z-Image-Turbo's default): half the denoiser batch, recorded under its own key, not skipped+ state.pipe._unsloth_peak_cfg = False+ assert diffusion._start_peak_probe(state) is not None+ assert diffusion._live_peak_identity(state)[1].endswith("|cfg:off")+ # an unknown guidance mode and CFG on a family that never runs it still record nothing+ state.pipe._unsloth_peak_cfg = None+ assert diffusion._start_peak_probe(state) is None+ state.family = types.SimpleNamespace(uses_negative_prompt = False)+ state.pipe._unsloth_peak_cfg = Trueassert diffusion._start_peak_probe(state) is None+ # kill switch: the old behaviour (a render without CFG records nothing)+ state.family = types.SimpleNamespace(uses_negative_prompt = True)+ state.pipe._unsloth_peak_cfg = False+ monkeypatch.setenv(dm.LEARNED_PEAKS_CFG_OFF_ENV, "0")+ assert diffusion._start_peak_probe(state) is None+++def test_cfg_family_places_from_its_cfg_off_peak_and_cfg_requests_take_the_flat_estimate(+ klein_pipe, monkeypatch+):+ monkeypatch.delenv(dm.LEARNED_PEAKS_CFG_OFF_ENV, raising = False)+ klein_pipe._unsloth_peak_expects_cfg = True+ plan = _klein_flat_plan()+ kw = dict(family = "some-new-dit", speed_mode = "default", attention = "native")+ assert dm.refine_plan_from_loaded_weights(klein_pipe, plan, **kw) is plan+ mp.record(+ family = "some-new-dit",+ quant = "torchao:Int8Tensor|attn:native|cfg:off",+ speed_mode = "default",+ width = 1024,+ height = 1024,+ peak_mib = 2600,+ )+ new = dm.refine_plan_from_loaded_weights(klein_pipe, plan, **kw)+ assert new is not plan and new.estimates["measured_learned_cfg_off"] is True+ assert new.estimates["measured_runtime_headroom_mib"] == 3072+ klein_pipe._unsloth_peak_identity = (+ "some-new-dit",+ "torchao:Int8Tensor|attn:native",+ "default",+ )+ klein_pipe._unsloth_measured_reserve = (+ 3072,+ "some-new-dit",+ "default",+ None,+ None,+ 2600,+ 1024 * 1024,+ False,+ True,+ True,+ )+ # a request without CFG is covered by the peak the load reserved+ assert dm.measured_request_extra_mib(klein_pipe, width = 1024, height = 1024, cfg = False) == 0+ # a CFG request (or unknown) is sized from the flat estimate: the doubled batch was never measured+ flat = dm.estimate_image_runtime_mib(+ width = 1024, height = 1024, batch_size = 1, family = "some-new-dit"+ )+ assert (+ dm.measured_request_extra_mib(klein_pipe, width = 1024, height = 1024, cfg = True)+ == flat - 3072+ > 0+ )+ assert dm.measured_request_extra_mib(klein_pipe, width = 1024, height = 1024) == flat - 3072+ # once a CFG render is recorded, the CFG key wins+ mp.record(+ family = "some-new-dit",+ quant = "torchao:Int8Tensor|attn:native",+ speed_mode = "default",+ width = 1024,+ height = 1024,+ peak_mib = 3400,+ )+ cfg_new = dm.refine_plan_from_loaded_weights(klein_pipe, plan, **kw)+ assert cfg_new.estimates["measured_learned_cfg_off"] is False+ assert cfg_new.estimates["measured_runtime_headroom_mib"] == 4096+ # a family that never runs CFG never reads a cfg:off key+ klein_pipe._unsloth_peak_expects_cfg = False+ mp._cache.update(path = None, mtime = None, data = None)+++def test_cfg_off_keys_are_wired_into_the_load_and_guard():src = (__import__("pathlib").Path(dm.__file__).parent / "diffusion.py").read_text(encoding = "utf-8")- assert "state.pipe._unsloth_peak_cfg = _negative_prompt_engaged(state.family, guidance)" in src+ src = "".join(src.split()) # whitespace-free: the formatter may wrap these lines+ for needle in (+ 'pipe._unsloth_peak_expects_cfg = bool(getattr(fam, "uses_negative_prompt", False))',+ "cfg = guard_cfg,",+ 'plan.estimates.get("measured_learned_cfg_off", False),',+ "state.pipe._unsloth_peak_cfg = _negative_prompt_engaged(state.family, guidance)",+ ):+ assert "".join(needle.split()) in src, needledef test_render_forced_eager_while_the_compile_is_pending_is_not_probed(monkeypatch):diff --git a/studio/backend/tests/test_diffusion_measured_placement_dense.py b/studio/backend/tests/test_diffusion_measured_placement_dense.pyindex 0c2a3320aa3..0a6fbf5a413 100644--- a/studio/backend/tests/test_diffusion_measured_placement_dense.py+++ b/studio/backend/tests/test_diffusion_measured_placement_dense.py@@ -209,3 +209,116 @@ def test_small_host_int8_denoiser_keeps_the_flat_plan(klein_pipe):klein_pipe.transformer = types.SimpleNamespace(dtype = torch.float16, parameters = dit.parameters)plan = _flat_plan(12758)assert _refine(klein_pipe, plan) is plan+++# ------------------------------------------------------------------- learned-only placement (bf16 / packed denoisers)+# The dense eager table was measured on fp16 / fp32 unpacked weights, so a bf16 denoiser (every Ampere+ card) and a+# GGUF / int8 packed one used to return before the learned-peak lookup: their renders recorded peaks no load ever read.+# They now place from the learned peak alone (no static seed); without one the flat plan stands.+++def learned_store(tmp_path, monkeypatch):+ import core.inference.diffusion_measured_peaks as mp++ monkeypatch.setenv(mp.LEARNED_PEAKS_FILE_ENV, str(tmp_path / "peaks.json"))+ monkeypatch.delenv(mp.LEARNED_PEAKS_ENV, raising = False)+ mp._cache.update(path = None, mtime = None, data = None)+ monkeypatch.setattr(mp, "current_device_name", lambda: "NVIDIA L4", raising = False)+ return mp+++def _gguf_dit():+ import torch++ class GGUFParameter(torch.nn.Parameter):+ pass++ dit = torch.nn.Linear(4, 4)+ dit.weight = GGUFParameter(dit.weight.data, requires_grad = False)+ return dit++[email protected]("build", ["bf16", "gguf"])+def test_unseeded_dense_denoiser_places_from_its_learned_peak(+ klein_pipe, learned_store, monkeypatch, build+):+ import torch++ label = "dense:bfloat16" if build == "bf16" else "gguf"+ monkeypatch.setattr(dm, "denoiser_quant_label", lambda pipe: label)+ if build == "bf16":+ klein_pipe.transformer = types.SimpleNamespace(dtype = torch.bfloat16)+ else:+ klein_pipe.transformer = types.SimpleNamespace(+ dtype = torch.float16, parameters = _gguf_dit().parameters+ )+ plan = _flat_plan(12758)+ # nothing learned yet: the flat plan (no fp16 table seed for a build it never measured)+ assert _refine(klein_pipe, plan) is plan+ learned_store.record(+ family = "flux.2-klein", quant = label, speed_mode = "off", width = 1024, height = 1024, peak_mib = 2000+ )+ new = _refine(klein_pipe, plan)+ assert new is not plan+ # 2000 x 1.15 = 2300 -> 2304 (the learned peak alone, not the 3072 fp16 table seed)+ assert new.estimates["measured_runtime_headroom_mib"] == 2304+ assert new.estimates["measured_static_seed"] is False+ assert new.resident_transformer_mib and new.resident_transformer_mib > 0+ # every kill switch still restores the flat plan+ for env in ("UNSLOTH_DIFFUSION_LEARNED_PEAKS", *ENVS):+ monkeypatch.setenv(env, "0")+ assert _refine(klein_pipe, plan) is plan, env+ monkeypatch.delenv(env)+++def test_fp16_dense_keeps_its_static_seed_over_a_lower_learned_peak(+ klein_pipe, learned_store, monkeypatch+):+ monkeypatch.setattr(dm, "denoiser_quant_label", lambda pipe: "dense:float16")+ learned_store.record(+ family = "flux.2-klein",+ quant = "dense:float16",+ speed_mode = "off",+ width = 1024,+ height = 1024,+ peak_mib = 1000,+ )+ new = _refine(klein_pipe, _flat_plan(12758))+ # learned only raises a seed: the fp16 table's 3072 stands+ assert new.estimates["measured_runtime_headroom_mib"] == KLEIN_HEADROOM+ assert new.estimates["measured_static_seed"] is True+++def test_request_guard_of_a_learned_only_load_never_reads_the_fp16_table(learned_store):+ # a bf16 klein load placed from a 1000 MiB learned peak (1000 x 1.15 -> 1280 reserved)+ pipe = types.SimpleNamespace(+ _unsloth_peak_identity = ("flux.2-klein", "dense:bfloat16", "off"),+ _unsloth_measured_reserve = (+ 1280,+ "flux.2-klein",+ "off",+ 7393,+ None,+ 1000,+ 1024 * 1024,+ False,+ False,+ ),+ )+ assert dm.measured_request_extra_mib(pipe, width = 1024, height = 1024) == 0+ # 4 MP: the learned peak scales linearly (4 x 1000 x 1.15 = 4600 -> 4608)+ assert dm.measured_request_extra_mib(pipe, width = 2048, height = 2048) == 4608 - 1280+ # an older 8-field reserve keeps reading the static table as before+ old = types.SimpleNamespace(+ _unsloth_peak_identity = ("flux.2-klein", "dense:float16", "off"),+ _unsloth_measured_reserve = (KLEIN_HEADROOM, "flux.2-klein", "off", 7393, 2),+ )+ assert dm.measured_request_extra_mib(old, width = 1024, height = 1024) == 0+++def test_load_stores_the_static_seed_flag_in_the_reserve():+ src = (__import__("pathlib").Path(dm.__file__).parent / "diffusion.py").read_text(+ encoding = "utf-8"+ )+ assert 'plan.estimates.get("measured_static_seed", True),' in src