diff --git a/studio/backend/core/inference/sd_cpp_backend.py b/studio/backend/core/inference/sd_cpp_backend.py index cf39441285..d4a5bd6afb 100644 --- a/studio/backend/core/inference/sd_cpp_backend.py +++ b/studio/backend/core/inference/sd_cpp_backend.py @@ -378,6 +378,7 @@ class SdCppDiffusionBackend: # diffusers-only knobs accepted (so the route calls both engines uniformly) # and ignored -- sd.cpp has no torchao quant / SDPA dispatcher / fbcache. text_encoder_quant: Optional[str] = None, + vae_quant: Optional[str] = None, transformer_quant: Optional[str] = None, transformer_quant_fast_accum: Optional[bool] = None, transformer_prequant_path: Optional[str] = None, diff --git a/studio/backend/tests/test_sd_cpp_backend.py b/studio/backend/tests/test_sd_cpp_backend.py index 1d0268effa..5f04408a35 100644 --- a/studio/backend/tests/test_sd_cpp_backend.py +++ b/studio/backend/tests/test_sd_cpp_backend.py @@ -307,6 +307,23 @@ def test_begin_load_resolves_family_from_filename_only(monkeypatch): assert b._loading is not None and b._loading.repo_id == "/models/gguf-store" +def test_begin_load_accepts_diffusers_only_vae_quant(monkeypatch): + # The image load route calls engine.begin_load(..., vae_quant=...) uniformly for both + # engines, so the native backend must accept (and ignore) vae_quant like the other + # diffusers-only knobs; otherwise a native (CPU / MPS / forced) image load raises + # TypeError on every request, since vae_quant is always passed (defaults to None). + b = SdCppDiffusionBackend(engine = _FakeEngine()) + monkeypatch.setattr(b, "_run_load", lambda **kwargs: None) # skip the download thread + b.begin_load( + "/models/gguf-store", + gguf_filename = "Z-Image-Turbo-Q4_K_M.gguf", + text_encoder_quant = "auto", + vae_quant = "auto", + transformer_quant = "fp8", + ) + assert b._loading is not None and b._loading.repo_id == "/models/gguf-store" + + def test_ensure_binary_returns_found(monkeypatch): monkeypatch.setattr(bk, "find_sd_cpp_binary", lambda: "/usr/bin/sd-cli") assert ensure_sd_cpp_binary() == "/usr/bin/sd-cli"