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: hold cudnn.benchmark off for Wan so renders are reproducible across servers (#12565)

Daniel Hanefc6d60b4ce9
diff --git a/studio/backend/core/inference/video.py b/studio/backend/core/inference/video.py
index 48da7d76205..d54e4e6ea39 100644
--- a/studio/backend/core/inference/video.py
+++ b/studio/backend/core/inference/video.py
@@ -6415,8 +6415,7 @@ class VideoBackend:
if fam.name == "ltx-2" and applied.get("compiled"):
from .video_ltx2 import install_stg_compile_adapter
install_stg_compile_adapter(getattr(view, fam.denoiser_attr, None))
- if fam.name == "ltx-2" and applied.get("cudnn_benchmark"):
- # cudnn.benchmark: no steady gain on LTX's VAE / vocoder convs, but a per-shape re-tune (first render 26 s vs 10 s).
+ if not getattr(fam, "cudnn_benchmark", True) and applied.get("cudnn_benchmark"):
from .video_ltx2 import disable_cudnn_benchmark
if disable_cudnn_benchmark():
applied = {**applied, "cudnn_benchmark": False}
diff --git a/studio/backend/core/inference/video_families.py b/studio/backend/core/inference/video_families.py
index 52e464d071a..e3393833691 100644
--- a/studio/backend/core/inference/video_families.py
+++ b/studio/backend/core/inference/video_families.py
@@ -90,6 +90,8 @@ class VideoFamily:
# Wan VAE decodes in float32 (bf16 causes banding / black frames), so the loader pins it back. Its size term is
# already fp32.
vae_force_fp32: bool = False
+ # False holds cudnn.benchmark off: its per-process conv pick makes servers decode the same latents differently.
+ cudnn_benchmark: bool = True
# Curated GGUF repo for the picker (the DiT as single-file GGUF quants).
gguf_repo: Optional[str] = None
# Hosted PRE-CAST text-encoder checkpoints as (scheme, component, repo_id); same semantics as
@@ -263,6 +265,8 @@ _FAMILIES: tuple[VideoFamily, ...] = (
te_prequant_repos = (("fp8", "text_encoder", "unsloth/LTX-2-FP8"),),
# Hosted 2.3 DISTILLED DiT, used only by the 2.3 single-file assembly. fp8 only: LTX-2.3-INT8.pt predates the int8 excludes.
prequant_variant_repos = (("lightricks/ltx-2.3", "fp8", "unsloth/LTX-2.3-FP8"),),
+ # no steady gain on LTX's VAE / vocoder convs, but a per-shape re-tune (first render 26 s vs 10 s)
+ cudnn_benchmark = False,
),
# Wan2.2-TI2V-5B (diffusers >= 0.35, verified on 0.39): ~5B single-stream DiT (UMT5 encoder), no audio. Its VAE's
# temporal compression 4 gives valid frame counts 4k+1. Defaults 20 steps / CFG 5 (ComfyUI's template).
@@ -291,6 +295,7 @@ _FAMILIES: tuple[VideoFamily, ...] = (
# (11.4); VAE fp32 (2.8).
bf16_components_gb = (10.0, 11.4, 2.8),
vae_force_fp32 = True,
+ cudnn_benchmark = False,
# UMT5 keeps its overflowing `wo` in fp32 itself; the VAE stays fp32 (vae_force_fp32).
fp16_guard = "native",
# Byte-identical mirror of QuantStack/Wan2.2-TI2V-5B-GGUF (13 quants + companion VAE).
@@ -332,6 +337,8 @@ _FAMILIES: tuple[VideoFamily, ...] = (
# 114.3 fp32 sum. UMT5 TE bf16 (11.4); VAE fp32 (0.5).
bf16_components_gb = (57.2, 11.4, 0.5),
vae_force_fp32 = True,
+ # same VAE as TI2V-5B
+ cudnn_benchmark = False,
# no gguf_repo: community GGUFs split the experts, and a single-file load covers only one
),
# HunyuanVideo-1.5 (diffusers >= 0.39): 8.3B DiT, Qwen2.5-VL + ByT5 encoders. Three quirks: no guidance kwarg (CFG
diff --git a/studio/backend/tests/test_video_backend.py b/studio/backend/tests/test_video_backend.py
index c2399aa5ffc..9f57cf2ff3e 100644
--- a/studio/backend/tests/test_video_backend.py
+++ b/studio/backend/tests/test_video_backend.py
@@ -12568,6 +12568,35 @@ def test_ltx2_load_turns_cudnn_benchmark_back_off(fake_runtime, tmp_path, monkey
assert "cudnn_benchmark" not in backend.status()["speed_optims"]
+def test_wan_load_turns_cudnn_benchmark_back_off(fake_runtime, monkeypatch):
+ # cudnn.benchmark's per-process conv pick made two servers decode the same Wan latents differently.
+ from core.inference import video as video_mod, video_ltx2
+
+ monkeypatch.setattr(
+ video_mod,
+ "apply_speed_optims",
+ lambda *a, **k: {"cudnn_benchmark": True, "compiled": False},
+ )
+ calls = []
+ monkeypatch.setattr(video_ltx2, "disable_cudnn_benchmark", lambda: calls.append(1) or True)
+ backend = VideoBackend()
+ status = backend.load_pipeline("Wan-AI/Wan2.2-TI2V-5B-Diffusers", model_kind = "pipeline")
+ assert status["family"] == "wan2.2-ti2v-5b"
+ assert calls == [1]
+ assert "cudnn_benchmark" not in backend.status()["speed_optims"]
+
+
+def test_cudnn_benchmark_opt_out_families():
+ # Every family on the Wan VAE opts out (reproducibility), LTX-2 keeps its re-tune opt-out, the rest keep the benchmark.
+ from core.inference.video_families import _FAMILIES
+
+ off = {fam.name for fam in _FAMILIES if not fam.cudnn_benchmark}
+ assert {"wan2.2-ti2v-5b", "wan2.2-t2v-a14b", "ltx-2"} <= off
+ assert all(
+ fam.vae_force_fp32 or fam.name == "ltx-2" for fam in _FAMILIES if not fam.cudnn_benchmark
+ )
+
+
@pytest.mark.parametrize(
"plan_fields, filename, direct, te_direct",
[