From ce060f3644e71c852d96a0dc73a64cf49eee6e3e Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Sun, 28 Jun 2026 06:20:41 +0000 Subject: [PATCH] Studio diffusion (Phase 14): guard the int8 exclusion filter against a None fqn The filter callback can be invoked without a module name, so fqn.lower() would raise AttributeError on None. Fall back to an empty name (nothing matches the exclusion tokens, so the linear is kept) instead of crashing the quantise pass. --- studio/backend/core/inference/diffusion_transformer_quant.py | 2 +- studio/backend/tests/test_diffusion_transformer_quant.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/studio/backend/core/inference/diffusion_transformer_quant.py b/studio/backend/core/inference/diffusion_transformer_quant.py index 173d0aaa86..fcaf66f6d3 100644 --- a/studio/backend/core/inference/diffusion_transformer_quant.py +++ b/studio/backend/core/inference/diffusion_transformer_quant.py @@ -324,7 +324,7 @@ def make_filter_fn(min_features: int, exclude_name_tokens: tuple[str, ...] = ()) if in_features < min_features or out_features < min_features: return False if exclude_name_tokens: - name = fqn.lower() + name = fqn.lower() if fqn else "" if any(tok in name for tok in exclude_name_tokens): return False return True diff --git a/studio/backend/tests/test_diffusion_transformer_quant.py b/studio/backend/tests/test_diffusion_transformer_quant.py index 9ee0af7649..8f6ef6594d 100644 --- a/studio/backend/tests/test_diffusion_transformer_quant.py +++ b/studio/backend/tests/test_diffusion_transformer_quant.py @@ -351,6 +351,10 @@ def test_make_filter_fn_int8_excludes_modulation_and_embedders(monkeypatch): assert keep(big(), fqn) is True, fqn # Without the exclusion (fp8 path), the modulation layer is kept. assert make_filter_fn(512)(big(), "transformer_blocks.0.norm1.linear") is True + # A None / empty fqn must not crash the exclusion check (defensive against the callback + # passing no name); with no name nothing matches the exclusion tokens -> kept. + assert keep(big(), None) is True + assert keep(big(), "") is True # ── apply ───────────────────────────────────────────────────────────────────────