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.

Repair four checks red on main (#14991)

Daniel Han7f9576a004ff
diff --git a/studio/backend/core/_xpu_triton_toolchain.py b/studio/backend/core/_xpu_triton_toolchain.py
index 5ffb3efa5ea..71a74db455b 100644
--- a/studio/backend/core/_xpu_triton_toolchain.py
+++ b/studio/backend/core/_xpu_triton_toolchain.py
@@ -139,9 +139,12 @@ def _vcvars_path() -> str | None:
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"-property",
"installationPath",
+ "-utf8",
],
capture_output = True,
text = True,
+ encoding = "utf-8",
+ errors = "replace",
timeout = 60,
**windows_hidden_subprocess_kwargs(),
)
diff --git a/tests/studio/test_usage_examples_model_source_contract.py b/tests/studio/test_usage_examples_model_source_contract.py
index 6633ea5d12e..0e28f9d6fb4 100644
--- a/tests/studio/test_usage_examples_model_source_contract.py
+++ b/tests/studio/test_usage_examples_model_source_contract.py
@@ -42,10 +42,17 @@ def test_examples_never_print_a_hardcoded_model_id():
assert re.search(r'"unsloth/[^"]+"', src) is None
assert "function useExampleModelName(keylessOnly: boolean): string | null" in src
assert "useState<OpenAIModel[] | null>(null)" in src
- assert "(model ? buildSnippets(base, key, toolsKey, model, os) : null)" in src
- assert "if (!snippets) return;" in src
- assert "{snippets ? (" in src
- assert 't("settings.apiKeys.usageNoModel")' in src
+ # No servable model: the snippet names an obvious placeholder (#14914) instead of a repo id,
+ # and the note under the pickers says why, so a copied curl cannot silently 404.
+ assert 'const MODEL_PLACEHOLDER = "YOUR_MODEL";' in src
+ assert "buildSnippets(base, key, toolsKey, model ?? MODEL_PLACEHOLDER, os)" in src
+ assert len(re.findall(r"\bbuildSnippets\(", src)) == 2, "one definition, one call site"
+ note = src.find('t("settings.apiKeys.usageNoModel")')
+ assert note != -1
+ gate = src.rfind("{model ? null : (", 0, note)
+ assert (
+ gate != -1 and note - gate < 200
+ ), "the no-model note must render exactly when the example shows the placeholder"
en = EN_TS.read_text(encoding = "utf-8")
assert "usageNoModel:" in en
diff --git a/tests/test_fp8_pre_sm89_byte_dequant.py b/tests/test_fp8_pre_sm89_byte_dequant.py
index c6a03cd046a..d1f71ddd932 100644
--- a/tests/test_fp8_pre_sm89_byte_dequant.py
+++ b/tests/test_fp8_pre_sm89_byte_dequant.py
@@ -268,10 +268,25 @@ def test_rocm_kill_switch_restores_old_routes(monkeypatch, arch, triton_version,
def test_kill_switch_env_is_read_at_import():
- code = "from unsloth.kernels import fp8; print(fp8._HIP_FP8_BYTES_DEQUANT)"
- env = dict(os.environ, UNSLOTH_FP8_HIP_BYTES_DEQUANT = "0")
- out = subprocess.run([sys.executable, "-c", code], env = env, capture_output = True, text = True)
- assert out.stdout.strip().splitlines()[-1] == "False", out.stderr[-2000:]
+ # A fresh interpreter has no conftest spoof, so on a CPU-only box `import unsloth` raises
+ # "cannot find any torch accelerator" before the switch is ever read; install the CI spoof.
+ tests_dir = os.path.dirname(os.path.abspath(__file__))
+ code = (
+ "import sys, torch\n"
+ f"sys.path.insert(0, {tests_dir!r})\n"
+ "if not torch.cuda.is_available():\n"
+ " import _zoo_aggressive_cuda_spoof\n"
+ " _zoo_aggressive_cuda_spoof.apply()\n"
+ "from unsloth.kernels import fp8\n"
+ "print(fp8._HIP_FP8_BYTES_DEQUANT)\n"
+ )
+ for value, expected in (("0", "False"), ("1", "True")):
+ env = dict(os.environ, UNSLOTH_FP8_HIP_BYTES_DEQUANT = value)
+ out = subprocess.run(
+ [sys.executable, "-c", code], env = env, capture_output = True, text = True, timeout = 600
+ )
+ lines = out.stdout.strip().splitlines()
+ assert lines and lines[-1] == expected, (value, out.stderr[-2000:])
@needs_cuda
diff --git a/tests/utils/test_attention_packed_fp32_routing.py b/tests/utils/test_attention_packed_fp32_routing.py
index 6b9457e4945..89063da677e 100644
--- a/tests/utils/test_attention_packed_fp32_routing.py
+++ b/tests/utils/test_attention_packed_fp32_routing.py
@@ -5,6 +5,7 @@
import pytest
import torch
+from real_accelerator import has_real_cuda # tests/_shared, on sys.path via tests/conftest.py
ad = pytest.importorskip("unsloth.utils.attention_dispatch")
@@ -190,7 +191,7 @@ def _reference(Q, K, V, lengths):
return torch.cat(out, dim = 2).transpose(1, 2)
[email protected](not torch.cuda.is_available(), reason = "needs CUDA")
[email protected](not has_real_cuda(), reason = "needs a real CUDA device")
def test_packed_fp32_cuda_parity(monkeypatch):
if not ad.HAS_XFORMERS:
pytest.skip("needs xformers")