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: read the hosted LTX-2.5 int8 checkpoint when the load's own plan offloads the denoiser (#17143)
Daniel Han5cafbf2b1156
diff --git a/studio/backend/core/inference/video.py b/studio/backend/core/inference/video.pyindex 8c038c63e28..9ef8587db6a 100644--- a/studio/backend/core/inference/video.py+++ b/studio/backend/core/inference/video.py@@ -4409,6 +4409,19 @@ def _auto_offload_scheme(requested: Optional[str]) -> Optional[str]:return TQ_INT8 if scheme == TQ_AUTO else scheme+# "0" disables reading the hosted native file when the load's own plan offloads a seeded denoiser.+OFFLOAD_HOSTED_READ_ENV = "UNSLOTH_VIDEO_OFFLOAD_HOSTED_READ"+++def _offload_hosted_read_enabled() -> bool:+ return (os.environ.get(OFFLOAD_HOSTED_READ_ENV) or "").strip().lower() not in (+ "0",+ "off",+ "false",+ "no",+ )++def _video_native_hosted_scheme(fam: Any, scheme: Optional[str], target: Any) -> Optional[str]:"""``int8`` when an offloaded load of ``scheme`` builds the W8A8 ConvRot native DiT that the family's hosted int8checkpoint already holds (``diffusion_native_hosted``), else None. The load re-checks the file; never raises."""@@ -9519,6 +9532,16 @@ class VideoBackend:denoiser_seed_scheme,_video_plan_label(plan),)+ if _video_native_hosted_planned is None and _offload_hosted_read_enabled():+ # The probe planned a resident seed; read the hosted native build rather than quantising dense shards.+ _video_native_hosted_planned = _video_native_hosted_scheme(+ fam, denoiser_seed_scheme, target+ )+ if _video_native_hosted_planned is not None:+ logger.info(+ "video.denoiser_prequant: the hosted %s checkpoint is read as offload-safe native Linears",+ _video_native_hosted_planned,+ )denoiser_seed_scheme = Nonedenoiser_seed_gb = Noneplan, bf16_plan, quant_replanned = _plan_for_te_scale(te_scale, log = False)diff --git a/studio/backend/tests/test_video_backend.py b/studio/backend/tests/test_video_backend.pyindex 4489ca8426b..124b50be7b0 100644--- a/studio/backend/tests/test_video_backend.py+++ b/studio/backend/tests/test_video_backend.py@@ -10689,6 +10689,44 @@ def test_seeding_is_skipped_entirely_under_offload(fake_runtime, monkeypatch):assert "moves the DiT" in status["resolved"]["transformer_quant"]["reason"][email protected]("switch", [None, "0"])+def test_a_seed_declined_by_the_loads_own_offload_plan_reads_the_hosted_native_build(+ fake_runtime, monkeypatch, switch+):+ """Probe prices the seed resident but the load's plan offloads it (LTX-2.5 sidecar encoder): read the hosted file."""+ import core.inference.video as video_mod++ if switch is not None:+ monkeypatch.setenv(video_mod.OFFLOAD_HOSTED_READ_ENV, switch)+ monkeypatch.setattr(video_mod, "dense_transformer_supported", lambda target: True)+ monkeypatch.setattr(video_mod, "quantize_transformer", lambda *a, **k: "int8")+ _stub_denoiser_seed(monkeypatch, scheme = "int8", plan_scheme = "int8")+ real_plan = video_mod.plan_diffusion_memory+ monkeypatch.setattr(+ video_mod,+ "plan_diffusion_memory",+ lambda **kwargs: dataclasses.replace(real_plan(**kwargs), offload_policy = "model"),+ )+ _stub_apply_memory_plan(monkeypatch, video_mod)+ monkeypatch.setattr(+ video_mod, "_video_native_hosted_scheme", lambda fam, scheme, target: "int8"+ )+ monkeypatch.setattr(video_mod, "_video_native_cache_spec", lambda fam, **kw: {"scheme": "int8"})+ monkeypatch.setattr(video_mod, "_read_native_quant_from_cache", lambda *a, **k: {})+ monkeypatch.setattr(video_mod, "_video_native_stream_build", lambda *a, **k: {})+ hosted_reads = []+ monkeypatch.setattr(+ video_mod, "_read_native_quant_from_hosted", lambda *a, **k: hosted_reads.append(k) or {}+ )++ # The fake target lacks a native int8 kernel, so the load refuses after the read.+ with contextlib.suppress(RuntimeError):+ VideoBackend().load_pipeline(+ "Wan-AI/Wan2.2-T2V-A14B-Diffusers", model_kind = "pipeline", transformer_quant = "int8"+ )+ assert len(hosted_reads) == (0 if switch == "0" else 1)++def _plans_for(monkeypatch, video_mod):"""Every ``model_dense_mib`` the memory planner was asked to judge, in order."""real_plan = video_mod.plan_diffusion_memory