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 MiniMax-H3 Sol VAE: free expired Q/K/V slots before building the next, at most two live (#17085)
Daniel Hanbb838004b949
diff --git a/studio/backend/core/inference/video_minimax_h3_sol_vae.py b/studio/backend/core/inference/video_minimax_h3_sol_vae.pyindex d529482ed2d..ab2cd85a03a 100644--- a/studio/backend/core/inference/video_minimax_h3_sol_vae.py+++ b/studio/backend/core/inference/video_minimax_h3_sol_vae.py@@ -350,12 +350,12 @@ def _build_module_classes():lo = max(0, j * tb - st)hi = min(T - 1, (j + 1) * tb - st - 1)b0, b1 = lo // tb, hi // tb+ for b in [b for b in slots if b < b0]:+ del slots[b] # release expired blocks before allocating the next Q/K/V slotfor b in range(b0, b1 + 1):if b not in slots:slots[b] = self._slot(blk, x, b, s, st)og[b] = self._global_attn(qg[b], kg[b], vg[b], slots[b][1], slots[b][2])- for b in [b for b in slots if b < b0]:- del slots[b] # the ring: at most the two blocks a window can overlap stay liveparts = []for b in range(b0, b1 + 1):a0, a1 = max(lo, b * tb) - b * tb, min(hi + 1, (b + 1) * tb) - b * tbdiff --git a/studio/backend/tests/test_video_minimax_h3_sol_vae.py b/studio/backend/tests/test_video_minimax_h3_sol_vae.pyindex b0faab3ef04..4e17af71bf8 100644--- a/studio/backend/tests/test_video_minimax_h3_sol_vae.py+++ b/studio/backend/tests/test_video_minimax_h3_sol_vae.py@@ -124,26 +124,44 @@ def test_the_streamed_decode_holds_at_most_two_block_slots():held: list = []orig = model._slot+ peak = {"n": 0}+def slot(blk, x, b, s, st):held.append(b)+ live = __import__("inspect").currentframe().f_back.f_locals["slots"]+ peak["n"] = max(peak["n"], len(live) + 1)return orig(blk, x, b, s, st)model._slot = slot- peak = {"n": 0}- orig_window = model._window_attn-- def window_attn(*args, **kwargs):- frame = __import__("inspect").currentframe().f_back- peak["n"] = max(peak["n"], len(frame.f_locals["slots"]))- return orig_window(*args, **kwargs)-- model._window_attn = window_attnmodel.decode_raw(torch.randn(1, 24, 17, 3, 3))assert peak["n"] == 2# every block is projected once per layerassert len(held) == LAYERS * 4+def test_window_attention_compiles_fullgraph_on_full_and_padded_windows():+ model = _tiny()+ seen: list = []+ orig = model._window_attn++ def window_attn(*args):+ seen.append(args)+ return orig(*args)++ model._window_attn = window_attn+ model.decode_raw(torch.randn(1, 24, 2 * model.block, model.window, model.window))+ model.decode_raw(torch.randn(1, 24, 7, 6, 9))+ model._window_attn = orig+ full = next(a for a in seen if a[-2] == 0 and a[0].shape[0] == model.block and a[-1] == 0)+ padded = next(a for a in seen if a[-1] != 0)+ for args in (full, padded):+ torch._dynamo.reset()+ explain = torch._dynamo.explain(orig)(*args)+ assert explain.graph_break_count == 0+ assert torch.equal(torch.compile(orig, fullgraph = True, backend = "eager")(*args), orig(*args))+ torch._dynamo.reset()++def test_a_still_decodes_as_a_block_of_copies_keeping_the_first_frame():model = _tiny()z = torch.randn(1, 24, 1, 5, 6)