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 video: fit per-request residency on the streaming tier and for HunyuanVideo-1.5 (#14865)
Daniel Han9a07082e4588
diff --git a/studio/backend/core/inference/video_stream_residency.py b/studio/backend/core/inference/video_stream_residency.pyindex e8353c255cc..1edbace75f2 100644--- a/studio/backend/core/inference/video_stream_residency.py+++ b/studio/backend/core/inference/video_stream_residency.py@@ -1,7 +1,8 @@# SPDX-License-Identifier: AGPL-3.0-only# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0-"""Keep the top-level group and a block prefix of a group-offloaded Wan denoiser resident, re-fitted per request.+"""Keep the top-level group and a block prefix of a block-streamed Wan or HunyuanVideo-1.5 denoiser resident, re-fitted+per request.Room = free + unused cache + already resident - need. Need is the streamed floor + base overhead + the runtime estimate,or, for a request no larger (pixels x frames) than a completed one, that request's measured peak x 1.15 + 1 GiB; the@@ -22,6 +23,9 @@ from typing import Any, OptionalVIDEO_DIT_RESIDENT_ENV = "UNSLOTH_VIDEO_DIT_RESIDENT"VIDEO_DIT_RESIDENT_BLOCKS_ENV = "UNSLOTH_VIDEO_DIT_RESIDENT_BLOCKS"VIDEO_DIT_RESIDENT_MEASURED_ENV = "UNSLOTH_VIDEO_DIT_RESIDENT_MEASURED"+RESIDENT_POLICIES = ("group", "streaming")+# Single-DiT families measured under the fit (MiniMax-H3 has its own controller, video_minimax_h3_residency).+RESIDENT_FAMILY_PREFIXES = ("wan", "hunyuanvideo-1.5")# A measured peak is scaled by this and a fixed slack is kept on top (allocator fragmentation, cuDNN workspaces).MEASURED_PEAK_MARGIN = 1.15MEASURED_SLACK_MIB = 1024@@ -69,8 +73,8 @@ def applies(residency_enabled()and not modularand not is_moe- and str(family_name or "").startswith("wan")- and offload_policy == "group"+ and str(family_name or "").startswith(RESIDENT_FAMILY_PREFIXES)+ and offload_policy in RESIDENT_POLICIESand str(device or "").startswith("cuda"))diff --git a/studio/backend/tests/test_video_stream_residency.py b/studio/backend/tests/test_video_stream_residency.pyindex c9f636b9b76..1832e15f708 100644--- a/studio/backend/tests/test_video_stream_residency.py+++ b/studio/backend/tests/test_video_stream_residency.py@@ -30,15 +30,17 @@ def _applies(**kw):return vr.applies(family, **args)-def test_applies_only_to_group_streamed_single_dit_wan_on_cuda(monkeypatch):+def test_applies_only_to_block_streamed_single_dit_wan_and_hunyuanvideo_on_cuda(monkeypatch):assert _applies()+ assert _applies(offload_policy = "streaming")assert _applies(device = "cuda")assert not _applies(family = "wan2.2-t2v-a14b", is_moe = True)assert not _applies(family = "ltx-2")- assert not _applies(family = "hunyuanvideo-1.5")+ assert _applies(family = "hunyuanvideo-1.5")+ assert _applies(family = "hunyuanvideo-1.5-720p", offload_policy = "streaming")+ assert not _applies(family = "minimax-h3")assert not _applies(offload_policy = "none")assert not _applies(offload_policy = "model")- assert not _applies(offload_policy = "streaming")assert not _applies(device = "cpu")assert not _applies(device = "mps")assert not _applies(modular = True)