From 44beb54df5ea0fc79cc7faf9dbd68518a84317c9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 1 Jul 2026 11:36:04 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- studio/backend/core/inference/diffusion_attention.py | 1 - studio/backend/core/inference/diffusion_precision.py | 5 ++++- studio/backend/core/inference/diffusion_speed.py | 2 ++ studio/backend/core/inference/diffusion_transformer_quant.py | 1 + studio/backend/tests/test_diffusion_routes.py | 2 ++ 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/studio/backend/core/inference/diffusion_attention.py b/studio/backend/core/inference/diffusion_attention.py index 04f812a13e..e652b0068c 100644 --- a/studio/backend/core/inference/diffusion_attention.py +++ b/studio/backend/core/inference/diffusion_attention.py @@ -225,7 +225,6 @@ def _reset_global_backend_to_native(logger: Any) -> None: AttentionBackendName, _AttentionBackendRegistry, ) - _AttentionBackendRegistry.set_active_backend(AttentionBackendName.NATIVE) except Exception: # noqa: BLE001 — best-effort; leave the global as-is on any change pass diff --git a/studio/backend/core/inference/diffusion_precision.py b/studio/backend/core/inference/diffusion_precision.py index 68036aae8d..030b6da7f2 100644 --- a/studio/backend/core/inference/diffusion_precision.py +++ b/studio/backend/core/inference/diffusion_precision.py @@ -120,7 +120,10 @@ def _cast_fp8(encoder: Any, target: Any) -> None: # gets cast to fp8 and, sharing one tensor, drags the embedding to fp8 with it. The # embedding then emits fp8 activations that crash the first RMSNorm. Skip the tied # projection so the shared tensor stays dense (lm_head is unused for prompt encoding). - get_out, get_in = getattr(encoder, "get_output_embeddings", None), getattr(encoder, "get_input_embeddings", None) + get_out, get_in = ( + getattr(encoder, "get_output_embeddings", None), + getattr(encoder, "get_input_embeddings", None), + ) out_emb = get_out() if callable(get_out) else None in_emb = get_in() if callable(get_in) else None if out_emb is not None and in_emb is not None and out_emb.weight is in_emb.weight: diff --git a/studio/backend/core/inference/diffusion_speed.py b/studio/backend/core/inference/diffusion_speed.py index 62bab8dcba..208cb8b513 100644 --- a/studio/backend/core/inference/diffusion_speed.py +++ b/studio/backend/core/inference/diffusion_speed.py @@ -249,6 +249,8 @@ def _enable_cudnn_benchmark(logger: Any) -> bool: except Exception as exc: # noqa: BLE001 — optimisation only _warn(logger, "cudnn_benchmark", exc) return False + + # The TF32 flag values from before the first max load flipped them, so a later # non-max load / unload can put the process back exactly as it found it (rather than # forcing a hardcoded default that might clobber another component's choice). diff --git a/studio/backend/core/inference/diffusion_transformer_quant.py b/studio/backend/core/inference/diffusion_transformer_quant.py index 94be813a94..9e2e56a2a5 100644 --- a/studio/backend/core/inference/diffusion_transformer_quant.py +++ b/studio/backend/core/inference/diffusion_transformer_quant.py @@ -313,6 +313,7 @@ def _make_quant_config(scheme: str, fast_accum: Optional[bool] = None) -> Any: return Float8DynamicActivationFloat8WeightConfig() if scheme == TQ_NVFP4: from torchao.prototype.mx_formats import NVFP4DynamicActivationNVFP4WeightConfig + # Select the CUTLASS FP4 path, not the default Triton kernel: torchao defaults # use_triton_kernel=True, which needs MSLK installed. On a Blackwell box with the # CUTLASS FP4 extension but no MSLK, the default would make the smoke probe fail diff --git a/studio/backend/tests/test_diffusion_routes.py b/studio/backend/tests/test_diffusion_routes.py index c37ca3ef14..d0b6997d07 100644 --- a/studio/backend/tests/test_diffusion_routes.py +++ b/studio/backend/tests/test_diffusion_routes.py @@ -465,6 +465,8 @@ def test_invalid_attention_backend_returns_422(client): json = {"model_path": "x/z-image", "gguf_filename": "q.gguf", "attention_backend": "bogus"}, ) assert resp.status_code == 422 + + def test_prequant_path_doc_describes_allowlist_not_toggle(): # The field help must match the code: UNSLOTH_ALLOW_LOCAL_PREQUANT_PATH is a # directory allowlist, not a =1 toggle (diffusion_prequant._allowed_prequant_roots