From 387cfd268b1289d2ad8fde618d1fdc89691ed429 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 10:47:50 +0000 Subject: [PATCH 01/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- studio/backend/core/inference/diffusion_precision.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/studio/backend/core/inference/diffusion_precision.py b/studio/backend/core/inference/diffusion_precision.py index 38a3434490..9b8dba28e3 100644 --- a/studio/backend/core/inference/diffusion_precision.py +++ b/studio/backend/core/inference/diffusion_precision.py @@ -121,7 +121,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: From 91780a250ef73b3a5f88d4e2f0c0343a0828dd5f 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:26:10 +0000 Subject: [PATCH 02/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- studio/backend/core/inference/diffusion_precision.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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: From 7410f8fa1ce0fdda7890a25ddb61d4e02d1d6c5b 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:28:55 +0000 Subject: [PATCH 03/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- studio/backend/core/inference/diffusion_speed.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/studio/backend/core/inference/diffusion_speed.py b/studio/backend/core/inference/diffusion_speed.py index b774370519..9184f29f88 100644 --- a/studio/backend/core/inference/diffusion_speed.py +++ b/studio/backend/core/inference/diffusion_speed.py @@ -240,6 +240,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). From 394f7985df0f7b0e7b42bd7e249bf95df0647dce 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:30:37 +0000 Subject: [PATCH 04/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- studio/backend/core/inference/diffusion_precision.py | 5 ++++- studio/backend/core/inference/diffusion_transformer_quant.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) 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_transformer_quant.py b/studio/backend/core/inference/diffusion_transformer_quant.py index 6e1341983f..7cb1074425 100644 --- a/studio/backend/core/inference/diffusion_transformer_quant.py +++ b/studio/backend/core/inference/diffusion_transformer_quant.py @@ -257,6 +257,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 From ab27ea85203ce9d1a968ac753262e903c0131896 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:31:14 +0000 Subject: [PATCH 05/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- 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 + 3 files changed, 7 insertions(+), 1 deletion(-) 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 b774370519..9184f29f88 100644 --- a/studio/backend/core/inference/diffusion_speed.py +++ b/studio/backend/core/inference/diffusion_speed.py @@ -240,6 +240,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 6e1341983f..7cb1074425 100644 --- a/studio/backend/core/inference/diffusion_transformer_quant.py +++ b/studio/backend/core/inference/diffusion_transformer_quant.py @@ -257,6 +257,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 From 1ab9db02ffbcb07a71b85aa077faee97137612f0 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:32:10 +0000 Subject: [PATCH 06/13] [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 b774370519..9184f29f88 100644 --- a/studio/backend/core/inference/diffusion_speed.py +++ b/studio/backend/core/inference/diffusion_speed.py @@ -240,6 +240,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 6e1341983f..7cb1074425 100644 --- a/studio/backend/core/inference/diffusion_transformer_quant.py +++ b/studio/backend/core/inference/diffusion_transformer_quant.py @@ -257,6 +257,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 eb497a46d2..dc34e60cef 100644 --- a/studio/backend/tests/test_diffusion_routes.py +++ b/studio/backend/tests/test_diffusion_routes.py @@ -445,6 +445,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 From c1b4ed1233526c1e581361f83168f9b3d4c3bd63 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:32:41 +0000 Subject: [PATCH 07/13] [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 b774370519..9184f29f88 100644 --- a/studio/backend/core/inference/diffusion_speed.py +++ b/studio/backend/core/inference/diffusion_speed.py @@ -240,6 +240,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 1afdd4200d..cb6873a661 100644 --- a/studio/backend/core/inference/diffusion_transformer_quant.py +++ b/studio/backend/core/inference/diffusion_transformer_quant.py @@ -284,6 +284,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 eb497a46d2..dc34e60cef 100644 --- a/studio/backend/tests/test_diffusion_routes.py +++ b/studio/backend/tests/test_diffusion_routes.py @@ -445,6 +445,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 From a8e87ac77ba30e19cdb5f6af072d9bdb5160218c 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:33:16 +0000 Subject: [PATCH 08/13] [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 1afdd4200d..cb6873a661 100644 --- a/studio/backend/core/inference/diffusion_transformer_quant.py +++ b/studio/backend/core/inference/diffusion_transformer_quant.py @@ -284,6 +284,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 baaa8696f9..d03c48b477 100644 --- a/studio/backend/tests/test_diffusion_routes.py +++ b/studio/backend/tests/test_diffusion_routes.py @@ -445,6 +445,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 From ffe5b697732e1018a1708c28847d6c3ebae74935 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:33:47 +0000 Subject: [PATCH 09/13] [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 baaa8696f9..d03c48b477 100644 --- a/studio/backend/tests/test_diffusion_routes.py +++ b/studio/backend/tests/test_diffusion_routes.py @@ -445,6 +445,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 From db081d67deaa8c67a41dc15b6c022d16806a4d53 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:34:18 +0000 Subject: [PATCH 10/13] [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 baaa8696f9..d03c48b477 100644 --- a/studio/backend/tests/test_diffusion_routes.py +++ b/studio/backend/tests/test_diffusion_routes.py @@ -445,6 +445,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 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 11/13] [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 From 5728670f6e441d0cf82522ecba36696e8b34909e 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:57:18 +0000 Subject: [PATCH 12/13] [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 662fff74dd..2738691e58 100644 --- a/studio/backend/core/inference/diffusion_speed.py +++ b/studio/backend/core/inference/diffusion_speed.py @@ -282,6 +282,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 b00af9cfd6..b7fbb3f50c 100644 --- a/studio/backend/tests/test_diffusion_routes.py +++ b/studio/backend/tests/test_diffusion_routes.py @@ -487,6 +487,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 From a927f4dc1e2343c02b34e96a902d5080505adc5e 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 13:58:10 +0000 Subject: [PATCH 13/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- studio/backend/core/inference/diffusion.py | 4 +++- .../core/inference/diffusion_attention.py | 1 - .../core/inference/diffusion_precision.py | 5 ++++- .../backend/core/inference/diffusion_speed.py | 2 ++ .../inference/diffusion_transformer_quant.py | 1 + .../backend/tests/test_diffusion_backend.py | 4 +--- studio/backend/tests/test_diffusion_routes.py | 2 ++ studio/backend/tests/test_diffusion_sdxl.py | 22 +++++++++---------- 8 files changed, 24 insertions(+), 17 deletions(-) diff --git a/studio/backend/core/inference/diffusion.py b/studio/backend/core/inference/diffusion.py index 816e3a0e01..eaaa93dede 100644 --- a/studio/backend/core/inference/diffusion.py +++ b/studio/backend/core/inference/diffusion.py @@ -1538,7 +1538,9 @@ class DiffusionBackend: mask_pil = mask_pil.resize(init_pil.size, _PILImage.NEAREST) if init_pil is not None: # Keep the VAE encode dtype consistent with the input image. - self._align_vae_dtype(pipe, getattr(state.family, "denoiser_attr", "transformer")) + self._align_vae_dtype( + pipe, getattr(state.family, "denoiser_attr", "transformer") + ) # Pipelines vary in which kwargs they accept (img2img derives size from the # input image and may reject width/height; a distilled pipe may take no 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 662fff74dd..2738691e58 100644 --- a/studio/backend/core/inference/diffusion_speed.py +++ b/studio/backend/core/inference/diffusion_speed.py @@ -282,6 +282,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_backend.py b/studio/backend/tests/test_diffusion_backend.py index 0b0e1e11cb..b05d6a3940 100644 --- a/studio/backend/tests/test_diffusion_backend.py +++ b/studio/backend/tests/test_diffusion_backend.py @@ -889,9 +889,7 @@ def test_load_sdxl_single_file_uses_pipeline_from_single_file(fake_runtime, tmp_ assert status["loaded"] is True assert status["family"] == "sdxl" # The whole-pipeline single-file path was taken with the base repo as config. - assert _FakePipeline.last_single_file["path"] == str( - (tmp_path / "sdxl.safetensors").resolve() - ) + assert _FakePipeline.last_single_file["path"] == str((tmp_path / "sdxl.safetensors").resolve()) assert _FakePipeline.last_single_file["config"] == "stabilityai/stable-diffusion-xl-base-1.0" # The transformer-only single-file build was NOT taken. assert _FakeTransformer.last == {} diff --git a/studio/backend/tests/test_diffusion_routes.py b/studio/backend/tests/test_diffusion_routes.py index b00af9cfd6..b7fbb3f50c 100644 --- a/studio/backend/tests/test_diffusion_routes.py +++ b/studio/backend/tests/test_diffusion_routes.py @@ -487,6 +487,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 diff --git a/studio/backend/tests/test_diffusion_sdxl.py b/studio/backend/tests/test_diffusion_sdxl.py index a0b3044952..41ee904b94 100644 --- a/studio/backend/tests/test_diffusion_sdxl.py +++ b/studio/backend/tests/test_diffusion_sdxl.py @@ -46,7 +46,7 @@ def test_sdxl_detection_by_repo_and_override(): assert detect_family("stabilityai/sdxl-turbo").name == "sdxl" assert detect_family("some-org/My-Cool-SDXL-Merge").name == "sdxl" assert detect_family("some-org/stable-diffusion-xl-anime").name == "sdxl" - assert detect_family("x", override="sdxl").name == "sdxl" + assert detect_family("x", override = "sdxl").name == "sdxl" # A GGUF DiT family must NOT be swallowed by the SDXL match. assert detect_family("unsloth/FLUX.1-schnell-GGUF").name == "flux.1" @@ -91,9 +91,9 @@ class _FakeVae: self.moved_to = None def parameters(self): - yield types.SimpleNamespace(dtype=self._dtype) + yield types.SimpleNamespace(dtype = self._dtype) - def to(self, dtype=None): + def to(self, dtype = None): self.moved_to = dtype self._dtype = dtype @@ -101,29 +101,29 @@ class _FakeVae: def test_align_vae_dtype_uses_unet_denoiser(): # For SDXL the denoiser lives at pipe.unet; _align_vae_dtype must read it (a pipe # with only .unet and no .transformer) and cast the VAE to the U-Net's dtype. - vae = _FakeVae(dtype="float32") - pipe = types.SimpleNamespace(unet=types.SimpleNamespace(dtype="bfloat16"), vae=vae) + vae = _FakeVae(dtype = "float32") + pipe = types.SimpleNamespace(unet = types.SimpleNamespace(dtype = "bfloat16"), vae = vae) DiffusionBackend._align_vae_dtype(pipe, "unet") assert vae.moved_to == "bfloat16" def test_align_vae_dtype_transformer_default_unchanged(): # DiT default: reads pipe.transformer; a pipe with no transformer is a safe no-op. - vae = _FakeVae(dtype="float32") - pipe = types.SimpleNamespace(transformer=types.SimpleNamespace(dtype="bfloat16"), vae=vae) + vae = _FakeVae(dtype = "float32") + pipe = types.SimpleNamespace(transformer = types.SimpleNamespace(dtype = "bfloat16"), vae = vae) DiffusionBackend._align_vae_dtype(pipe) assert vae.moved_to == "bfloat16" # No denoiser attribute -> no-op (does not raise, does not move the VAE). - vae2 = _FakeVae(dtype="float32") - DiffusionBackend._align_vae_dtype(types.SimpleNamespace(vae=vae2), "unet") + vae2 = _FakeVae(dtype = "float32") + DiffusionBackend._align_vae_dtype(types.SimpleNamespace(vae = vae2), "unet") assert vae2.moved_to is None def test_sdxl_lora_supported_on_diffusers(): # SDXL is bf16/bnb-4bit on diffusers -> LoRA is allowed (unlike GGUF-via-diffusers). assert diffusion_lora.supports_lora( - engine="diffusers", family="sdxl", model_kind="pipeline", transformer_quant=None + engine = "diffusers", family = "sdxl", model_kind = "pipeline", transformer_quant = None ) assert diffusion_lora.supports_lora( - engine="diffusers", family="sdxl", model_kind="single_file", transformer_quant=None + engine = "diffusers", family = "sdxl", model_kind = "single_file", transformer_quant = None )