From fec66a53926e98d9639e2c6637cfe104f20294c7 Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Sun, 5 Jul 2026 00:06:38 +0000 Subject: [PATCH] Pass normalized speed mode to fp16 accumulation gate The raw speed_mode string was forwarded to _enable_fp16_accumulation, so a case-variant like MAX failed the speed_mode != SPEED_MAX check and wrongly disabled fp16 accumulation on float16 pipelines. Forward the normalized mode and cover the case-insensitive path in the test. --- studio/backend/core/inference/diffusion_speed.py | 2 +- studio/backend/tests/test_diffusion_speed.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/studio/backend/core/inference/diffusion_speed.py b/studio/backend/core/inference/diffusion_speed.py index cb9101d03d..8c2524dfda 100644 --- a/studio/backend/core/inference/diffusion_speed.py +++ b/studio/backend/core/inference/diffusion_speed.py @@ -218,7 +218,7 @@ def apply_speed_optims( # and the UNSLOTH_DISABLE_FP16_ACCUM kill switch. if on_cuda: applied["fp16_accum"] = _enable_fp16_accumulation( - family, logger, dtype = getattr(target, "dtype", None), speed_mode = speed_mode + family, logger, dtype = getattr(target, "dtype", None), speed_mode = mode ) # --- the compile lever, remapped per tier ---------------------------------------- diff --git a/studio/backend/tests/test_diffusion_speed.py b/studio/backend/tests/test_diffusion_speed.py index 5b645022e1..9a18090e36 100644 --- a/studio/backend/tests/test_diffusion_speed.py +++ b/studio/backend/tests/test_diffusion_speed.py @@ -485,7 +485,7 @@ def test_fp16_accum_allowed_on_fp16_dtype_under_max(monkeypatch): _target(dtype = "float16"), is_gguf = True, family = _family(), - speed_mode = "max", + speed_mode = "MAX", ) assert applied["fp16_accum"] is True assert torch.backends.cuda.matmul.allow_fp16_accumulation is True