Skip to content

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.

Studio video: log an automatic text-encoder pick after the load retries its hosted encoder (#17093)

Daniel Hane56e1e439353
diff --git a/studio/backend/core/inference/video.py b/studio/backend/core/inference/video.py
index bac8384e0c2..8c038c63e28 100644
--- a/studio/backend/core/inference/video.py
+++ b/studio/backend/core/inference/video.py
@@ -395,6 +395,22 @@ def auto_te_fetch_failure(
return None
+def auto_te_outcome_log(scheme: str, family: str, failure: Optional[str], injected: bool) -> tuple:
+ if failure and not injected:
+ return (
+ "video.text_encoder_quant: the automatic '%s' for %s is not available (hosted pre-cast encoder "
+ "unreachable: %s); the dense bf16 text encoder loads",
+ scheme,
+ family,
+ failure,
+ )
+ return (
+ "video.text_encoder_quant: '%s' selected automatically for %s (unset request)",
+ scheme,
+ family,
+ )
+
+
def video_te_quant_request(
fam: Any,
text_encoder_quant: Optional[str],
@@ -9053,20 +9069,12 @@ class VideoBackend:
from . import diffusion_precision as _precision
if not _precision.te_quant_supported(target, text_encoder_quant):
text_encoder_quant = None
- elif te_auto_unavailable:
- logger.info(
- "video.text_encoder_quant: the automatic '%s' for %s is not available (hosted pre-cast encoder "
- "unreachable: %s); the dense bf16 text encoder loads",
- text_encoder_quant,
- fam.name,
- te_auto_unavailable,
- )
- else:
- logger.info(
- "video.text_encoder_quant: '%s' selected automatically for %s (unset request)",
- text_encoder_quant,
- fam.name,
- )
+ elif not te_auto_unavailable:
+ logger.info(*auto_te_outcome_log(text_encoder_quant, fam.name, None, True))
+ # A failed prefetch is retried by the load below: its outcome is logged after that.
+ te_auto_retry = (
+ text_encoder_quant if text_encoder_quant_auto and te_auto_unavailable else None
+ )
# FlashInfer only serves hosted pre-quantised denoisers. Modular H3 installs below; a conventional load installs
# after its live-memory plan keeps the seed (a capacity-settled seed can still be dropped).
_nvfp4_install_wanted = (
@@ -9655,6 +9663,12 @@ class VideoBackend:
local_files_only = local_files_only,
)
pipe_kwargs.update(te_injected)
+ if te_auto_retry:
+ logger.info(
+ *auto_te_outcome_log(
+ te_auto_retry, fam.name, te_auto_unavailable, bool(te_injected)
+ )
+ )
if text_encoder_quant_auto and not te_injected:
# Nobody asked for a runtime cast: without its hosted file the automatic pick keeps the released encoder.
text_encoder_quant = None
diff --git a/studio/backend/tests/test_video_backend.py b/studio/backend/tests/test_video_backend.py
index db673a5ffcb..4489ca8426b 100644
--- a/studio/backend/tests/test_video_backend.py
+++ b/studio/backend/tests/test_video_backend.py
@@ -9158,6 +9158,47 @@ def _allow_te_prequant(monkeypatch, *, injects = True):
return tpq.TE_PREQUANT_BUDGET_SCALE
+def _capture_te_quant_lines(monkeypatch):
+ import core.inference.video as video_mod
+
+ lines: list = []
+ real = video_mod.logger
+
+ class _Recorder:
+ def info(self, fmt, *a, **k):
+ message = fmt % a if a else fmt
+ if message.startswith("video.text_encoder_quant:"):
+ lines.append(message)
+ return real.info(fmt, *a, **k)
+
+ def __getattr__(self, name):
+ return getattr(real, name)
+
+ monkeypatch.setattr(video_mod, "logger", _Recorder())
+ return lines
+
+
[email protected]("injects", [True, False])
+def test_a_failed_te_prefetch_is_logged_by_the_retried_outcome(
+ fake_runtime, monkeypatch, tmp_path, injects
+):
+ _allow_te_prequant(monkeypatch, injects = injects)
+ lines = _capture_te_quant_lines(monkeypatch)
+ (tmp_path / "model.gguf").write_bytes(b"weights")
+ VideoBackend().load_pipeline(
+ str(tmp_path),
+ gguf_filename = "model.gguf",
+ base_repo = "Lightricks/LTX-2",
+ family_override = "ltx-2",
+ _te_prequant_failed = {"text_encoder": "unsloth/LTX-2-FP8: HTTP 503"},
+ )
+ assert len(lines) == 1
+ if injects:
+ assert "'fp8' selected automatically for ltx-2" in lines[0]
+ else:
+ assert "is not available" in lines[0] and "HTTP 503" in lines[0]
+
+
def test_gguf_plan_budgets_a_pre_cast_text_encoder_at_its_real_size(
fake_runtime, monkeypatch, tmp_path
):