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: LTX-2.5 dense text-encoder fallback room check prices the load dtype (#14664)

Daniel Han17f689619dfa
diff --git a/studio/backend/core/inference/video_ltx25_te_worker.py b/studio/backend/core/inference/video_ltx25_te_worker.py
index c96df5590e6..83d1370eec6 100644
--- a/studio/backend/core/inference/video_ltx25_te_worker.py
+++ b/studio/backend/core/inference/video_ltx25_te_worker.py
@@ -196,10 +196,24 @@ def _available_host_bytes() -> Optional[int]:
return None
+_DTYPE_SCALE_VS_BF16 = {"float32": 2.0, "float": 2.0, "float64": 4.0, "double": 4.0}
+
+
+def _dense_scale_vs_bf16(dtype: Any) -> float:
+ return _DTYPE_SCALE_VS_BF16.get(
+ str(dtype or "bfloat16").replace("torch.", "").strip().lower(), 1.0
+ )
+
+
def _require_room_for_dense(config: dict, exc: Exception) -> None:
"""The load was planned at the hosted file's size: refuse the dense fallback when free memory cannot hold the
- dense encoder, rather than let the OS kill the process mid-read (on Apple Silicon the same pool as the DiT)."""
- need = float(config.get("dense_te_gb") or 0.0) * 1000**3
+ dense encoder, rather than let the OS kill the process mid-read (on Apple Silicon the same pool as the DiT).
+ ``dense_te_gb`` is bf16; a float32 load (fp16 promoted without bf16) needs twice that."""
+ need = (
+ float(config.get("dense_te_gb") or 0.0)
+ * 1000**3
+ * _dense_scale_vs_bf16(config.get("dtype"))
+ )
free = _available_host_bytes()
if need and free is not None and free < need:
raise RuntimeError(
diff --git a/studio/backend/tests/test_video_ltx25_te_hosted.py b/studio/backend/tests/test_video_ltx25_te_hosted.py
index 8eb46ab2cbd..d9eba4aea93 100644
--- a/studio/backend/tests/test_video_ltx25_te_hosted.py
+++ b/studio/backend/tests/test_video_ltx25_te_hosted.py
@@ -289,6 +289,25 @@ def test_a_rejected_hosted_file_refuses_the_dense_fallback_without_room(tmp_path
assert config["_te_source"] == "quantized_at_load"
+ "dtype, free_gb, refused",
+ [
+ ("float32", 30, True),
+ ("float32", 50, False),
+ ("bfloat16", 30, False),
+ ("float16", 30, False),
+ ],
+)
+def test_the_dense_fallback_room_check_prices_the_load_dtype(dtype, free_gb, refused, monkeypatch):
+ monkeypatch.setattr(worker, "_available_host_bytes", lambda: free_gb * 1000**3)
+ config = {"dtype": dtype, "dense_te_gb": v25.LTX25_TE_BF16_GB}
+ if refused:
+ with pytest.raises(RuntimeError, match = "needs about 48 GB"):
+ worker._require_room_for_dense(config, OSError("hosted file absent"))
+ else:
+ worker._require_room_for_dense(config, OSError("hosted file absent"))
+
+
def test_offline_dense_fallback_still_tries_the_cached_hub_id(tmp_path, monkeypatch):
_write_tiny_encoder(tmp_path / "hub")
_fake_transformers(monkeypatch, tmp_path / "hub")