From 4719a51601801adfe15f89cdf33f6b8584f0e327 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 4 Jul 2026 09:44:27 +0000 Subject: [PATCH 1/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- studio/backend/core/inference/diffusion.py | 5 ++++- .../core/inference/diffusion_auto_policy.py | 1 + studio/backend/models/inference.py | 20 ++++++++++--------- .../tests/test_diffusion_auto_policy.py | 4 +--- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/studio/backend/core/inference/diffusion.py b/studio/backend/core/inference/diffusion.py index e5bbb24dcc..0d0c65ee7d 100644 --- a/studio/backend/core/inference/diffusion.py +++ b/studio/backend/core/inference/diffusion.py @@ -981,7 +981,10 @@ class DiffusionBackend: # as-is, so auto is the DEFAULT. An explicit "none"/"off" pins # GGUF-as-is and an explicit scheme pins that scheme. The overwritten # "auto" still records source=auto in the resolved provenance. - if transformer_quant is None or str(transformer_quant).strip().lower() in ("", "auto"): + if transformer_quant is None or str(transformer_quant).strip().lower() in ( + "", + "auto", + ): transformer_quant = TQ_AUTO # Default-on fast path: load the DENSE bf16 transformer and torchao-quantise it diff --git a/studio/backend/core/inference/diffusion_auto_policy.py b/studio/backend/core/inference/diffusion_auto_policy.py index 1bdd88e5f6..0aa0a51371 100644 --- a/studio/backend/core/inference/diffusion_auto_policy.py +++ b/studio/backend/core/inference/diffusion_auto_policy.py @@ -135,6 +135,7 @@ def _hf_cache_free_mib() -> Optional[int]: """Free MiB on the filesystem holding the HF model cache (None when unprobeable).""" try: import shutil + try: from huggingface_hub.constants import HF_HUB_CACHE as cache_dir except Exception: # noqa: BLE001 -- hub missing/old: probe the conventional path diff --git a/studio/backend/models/inference.py b/studio/backend/models/inference.py index 3b5e833959..8b5f3602d6 100644 --- a/studio/backend/models/inference.py +++ b/studio/backend/models/inference.py @@ -1750,15 +1750,17 @@ class DiffusionLoadRequest(BaseModel): "memory-vs-quality tradeoff (shifts fine detail), not free; " "pairs well with balanced mode.", ) - transformer_quant: Optional[Literal["auto", "none", "off", "int8", "fp8", "nvfp4", "mxfp8"]] = Field( - None, - description = "Transformer compute dtype. UNSET or auto (the default) picks the " - "fastest precision the hardware supports: the DENSE bf16 transformer " - "is loaded instead of the GGUF and torchao-quantised onto the " - "low-precision tensor cores (data-center fp8, consumer/Ampere int8), " - "falling back to the GGUF when the device, VRAM or disk cannot take " - "it. none/off pins running the GGUF as-is; an explicit scheme forces " - "that scheme. Dense path needs CUDA + bf16.", + transformer_quant: Optional[Literal["auto", "none", "off", "int8", "fp8", "nvfp4", "mxfp8"]] = ( + Field( + None, + description = "Transformer compute dtype. UNSET or auto (the default) picks the " + "fastest precision the hardware supports: the DENSE bf16 transformer " + "is loaded instead of the GGUF and torchao-quantised onto the " + "low-precision tensor cores (data-center fp8, consumer/Ampere int8), " + "falling back to the GGUF when the device, VRAM or disk cannot take " + "it. none/off pins running the GGUF as-is; an explicit scheme forces " + "that scheme. Dense path needs CUDA + bf16.", + ) ) transformer_quant_fast_accum: Optional[bool] = Field( None, diff --git a/studio/backend/tests/test_diffusion_auto_policy.py b/studio/backend/tests/test_diffusion_auto_policy.py index d9deadac0e..7190395f5f 100644 --- a/studio/backend/tests/test_diffusion_auto_policy.py +++ b/studio/backend/tests/test_diffusion_auto_policy.py @@ -151,9 +151,7 @@ def test_candidate_disk_gate_unprobeable_disk_passes(monkeypatch): _patch_selector(monkeypatch, scheme = "int8") monkeypatch.setattr(ap, "_hf_cache_free_mib", lambda: None) - est = resolve_dense_quant_candidate( - fam = _fam("z-image"), target = object(), requested = "auto" - ) + est = resolve_dense_quant_candidate(fam = _fam("z-image"), target = object(), requested = "auto") assert isinstance(est, DenseQuantEstimate) From c38ae1cef575a07d2fc7229a7acacfb33cb64cda Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Sat, 4 Jul 2026 09:46:38 +0000 Subject: [PATCH 2/2] Widen the load request type for the explicit Dtype off value The Dtype select now sends none through instead of omitting it, so the request type must accept it (tsc caught the mismatch at the badges tip). --- studio/frontend/src/features/images/api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/studio/frontend/src/features/images/api.ts b/studio/frontend/src/features/images/api.ts index 9291c2055d..959ea714b7 100644 --- a/studio/frontend/src/features/images/api.ts +++ b/studio/frontend/src/features/images/api.ts @@ -57,7 +57,7 @@ export interface DiffusionLoadRequest { cpu_offload?: boolean; // Advanced (load-time) tuning. All optional; omit for the backend's auto defaults. speed_mode?: "off" | "eager" | "default" | "max"; - transformer_quant?: "auto" | "int8" | "fp8" | "nvfp4" | "mxfp8"; + transformer_quant?: "auto" | "none" | "off" | "int8" | "fp8" | "nvfp4" | "mxfp8"; attention_backend?: | "auto" | "native"