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.

ci: make compiler-cache shim test order-independent (#5449)

Daniel Hane0e606a24a96
diff --git a/.github/workflows/consolidated-tests-ci.yml b/.github/workflows/consolidated-tests-ci.yml
index 2b0ce43a7c8..897367de0cd 100644
--- a/.github/workflows/consolidated-tests-ci.yml
+++ b/.github/workflows/consolidated-tests-ci.yml
@@ -1032,16 +1032,28 @@ jobs:
"""Spot-check on the three production-relevant families that
the compile_every sweep also covers; this case verifies the
emitted cache file has the model-specific RMSNorm class
- attribute, not just that the file parses + imports."""
+ attribute, not just that the file parses + imports.
+
+ Note on test isolation: ``unsloth_compile_transformers``
+ early-returns when ``modeling.__UNSLOTH_PATCHED__`` is set,
+ so once an earlier test in the same collection patches the
+ module the next call won't re-emit the cache file. Drop the
+ marker (and any stale cache file) before invoking so this
+ test is order-independent."""
import importlib as _il
try:
- _il.import_module(
+ modeling = _il.import_module(
f"transformers.models.{model_type}.modeling_{model_type}"
)
except ModuleNotFoundError:
pytest.skip(
f"transformers build lacks model_type={model_type}"
)
+ if hasattr(modeling, "__UNSLOTH_PATCHED__"):
+ delattr(modeling, "__UNSLOTH_PATCHED__")
+ combined = _CACHE / f"unsloth_compiled_module_{model_type}.py"
+ if combined.exists():
+ combined.unlink()
unsloth_compile_transformers(
model_type=model_type, fast_lora_forwards=False,
)
@@ -1049,7 +1061,6 @@ jobs:
f"transformers.models.{model_type}.modeling_{model_type}"
)
assert getattr(modeling, "__UNSLOTH_PATCHED__", False) is True
- combined = _CACHE / f"unsloth_compiled_module_{model_type}.py"
_verify_file(combined, must_expose=[rms_class])