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.

Tests: run the precision template in one namespace, keep the block-compile packing test off leaked env (#14425)

Daniel Hanb93e4dcd574f
diff --git a/tests/python/test_v100_fullft_precision.py b/tests/python/test_v100_fullft_precision.py
index 8e594750e61..a086dbcc96c 100644
--- a/tests/python/test_v100_fullft_precision.py
+++ b/tests/python/test_v100_fullft_precision.py
@@ -77,7 +77,9 @@ def _decide(dtype, *, bf16_supported, force_float32, full_finetuning, mixed_prec
)
raised = None
try:
- exec(CODE, {"torch": torch, "os": os}, {"args": args, "model": model})
+ # One namespace, as in the trainer's function scope: with separate locals, a
+ # generator or comprehension in the template cannot see `args` (NameError).
+ exec(CODE, {"torch": torch, "os": os, "args": args, "model": model})
except TypeError:
raised = "TypeError"
return args.fp16, args.bf16, os.environ.get("ACCELERATE_MIXED_PRECISION"), raised
diff --git a/tests/test_legacy_block_compile_install.py b/tests/test_legacy_block_compile_install.py
index 4bee932bf26..0e0e7d637bc 100644
--- a/tests/test_legacy_block_compile_install.py
+++ b/tests/test_legacy_block_compile_install.py
@@ -78,6 +78,10 @@ def test_packed_calls_keep_the_unsloth_layer_forward(monkeypatch):
return compiled
monkeypatch.setattr(torch, "compile", fake_compile)
+ # Other test modules set UNSLOTH_COMPILE_DISABLE=1 at import, which xdist workers collect
+ # before this runs; any of these keeps every call on the stock forward.
+ for name in ("UNSLOTH_COMPILE_DISABLE", "UNSLOTH_BLOCK_COMPILE", "UNSLOTH_FORCE_FLOAT32"):
+ monkeypatch.delenv(name, raising = False)
def forward(
self,