Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

FP8 LoRA test: expect the kernel route when unsloth_zoo drops HF output flags (#16855)

Daniel Hand36781d63c22
diff --git a/tests/test_fp8_lora.py b/tests/test_fp8_lora.py
index 2aa8f50d63d..9b61988154b 100644
--- a/tests/test_fp8_lora.py
+++ b/tests/test_fp8_lora.py
@@ -424,21 +424,25 @@ def test_fp8_loss_ignores_model_output_flags_only_on_its_head(monkeypatch, flag,
getattr(target, attribute)(hidden, labels)
return routes[-1]
- assert not run(owner)
+ # A newer unsloth_zoo drops these flags in the adapter itself, so every head keeps the kernel route.
+ zoo_drops_flags = "output_attentions" not in getattr(
+ forward_adapter, "_KERNEL_KWARGS", ("output_attentions",)
+ )
+ assert run(owner) == zoo_drops_flags
f8t.mark_fp8_lora(owner, f8t.FP8_LORA_RECIPE)
assert f8t.enable_fp8_lora(model, allow_cpu = True)
assert run(owner)
assert namespace["unsloth_fused_lm_head_loss"] is original
assert forward_adapter.unsloth_fused_lm_head_loss is original
assert getattr(ordinary, attribute).__func__ is function
- assert not run(ordinary)
+ assert run(ordinary) == zoo_drops_flags
clone = copy.deepcopy(model)
assert run(clone.get_base_model())
f8t.restore_fp8_lora_for_inference(clone)
- assert not run(clone.get_base_model())
+ assert run(clone.get_base_model()) == zoo_drops_flags
assert run(owner)
f8t.restore_fp8_lora_for_inference(model)
- assert not run(owner)
+ assert run(owner) == zoo_drops_flags
@pytest.mark.parametrize("decorated", [False, True])