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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Fix the tests left red on main by #12408, #12382 and #12436 (#12447)
Daniel Han1242643006af
diff --git a/.github/workflows/version-compat-ci.yml b/.github/workflows/version-compat-ci.ymlindex 32dbf2890c4..1b3b626d099 100644--- a/.github/workflows/version-compat-ci.yml+++ b/.github/workflows/version-compat-ci.yml@@ -36,6 +36,9 @@ on:- 'unsloth/**'- 'tests/vllm_compat/**'- 'tests/version_compat/**'+ # zoo-imports-under-spoof is the only job that runs the modules.json trust gate (the CPU+ # repo-test shards have no sentence-transformers and skip it), so an edit to it must run here.+ - 'tests/test_st_modules_json_trust_gate.py'- 'pyproject.toml'- '.github/workflows/version-compat-ci.yml'# Every pytest run here loads tests/conftest.py and the tests/_shared helpers it@@ -229,9 +232,12 @@ jobs:# table population + FastModel API surface under spoof# (~30 tests). Catches transformers / peft / bnb symbol pin# drift at module-top BEFORE any runtime call.+ # tests/test_st_modules_json_trust_gate.py: the modules.json trust gate, which needs+ # sentence-transformers installed, as this job is and the CPU repo-test shards are not.PYTHONPATH=. python -m pytest \tests/vllm_compat/test_unsloth_zoo_imports.py \tests/vllm_compat/test_extended_module_imports.py \+ tests/test_st_modules_json_trust_gate.py \-v --tb=short- name: Save the pip cachediff --git a/studio/backend/tests/test_diffusion_offload_seed_balanced.py b/studio/backend/tests/test_diffusion_offload_seed_balanced.pyindex 0b657a1a1f7..38d09cd513b 100644--- a/studio/backend/tests/test_diffusion_offload_seed_balanced.py+++ b/studio/backend/tests/test_diffusion_offload_seed_balanced.py@@ -143,7 +143,17 @@ def test_seed_device_scheme_and_kill_switch(monkeypatch):def test_denoiser_seed_forwards_the_placement(monkeypatch):import core.inference.diffusion_denoiser_prequant as dpimport core.inference.diffusion_prequant as prequant- import diffusers+ import sys+ import types++ # Only the class lookup by name is exercised; the CPU runners have no diffusers, so an empty+ # module stands in when it is absent, as in test_diffusion_memory.py's _top_group_module.+ if "diffusers" not in sys.modules:+ try:+ import diffusers # noqa: F401+ except ImportError:+ monkeypatch.setitem(sys.modules, "diffusers", types.ModuleType("diffusers"))+ diffusers = sys.modules["diffusers"]seen = {}@@ -173,13 +183,13 @@ def test_denoiser_seed_forwards_the_placement(monkeypatch):def test_loader_materialises_on_the_placement_device():- src = (BACKEND / "core/inference/diffusion_prequant.py").read_text()+ src = (BACKEND / "core/inference/diffusion_prequant.py").read_text(encoding = "utf-8")assert "transformer = transformer.to(placement_device or device)" in srcassert "transformer = transformer.to(device)\n" not in srcdef test_pipeline_seed_call_passes_the_plan_placement():- tree = ast.parse((BACKEND / "core/inference/diffusion.py").read_text())+ tree = ast.parse((BACKEND / "core/inference/diffusion.py").read_text(encoding = "utf-8"))calls = [nfor n in ast.walk(tree)@@ -259,7 +269,7 @@ def test_balanced_kill_switch_and_scope(monkeypatch):def test_balanced_refinement_is_wired_before_component_refinement():- src = (BACKEND / "core/inference/diffusion.py").read_text()+ src = (BACKEND / "core/inference/diffusion.py").read_text(encoding = "utf-8")assert ("refine_memory_plan_for_components(\n pipe, refine_balanced_plan_for_components(pipe, plan)\n"in srcdiff --git a/studio/backend/tests/test_diffusion_offload_seed_balanced_behaviour.py b/studio/backend/tests/test_diffusion_offload_seed_balanced_behaviour.pyindex b4cea88761c..a37a46f3634 100644--- a/studio/backend/tests/test_diffusion_offload_seed_balanced_behaviour.py+++ b/studio/backend/tests/test_diffusion_offload_seed_balanced_behaviour.py@@ -32,7 +32,7 @@ from core.inference.diffusion_memory import ()BACKEND = Path(__file__).resolve().parents[1]-DIFFUSION_SRC = (BACKEND / "core/inference/diffusion.py").read_text()+DIFFUSION_SRC = (BACKEND / "core/inference/diffusion.py").read_text(encoding = "utf-8")MIB = 1024 * 1024SIZES_AUTO = dict(model_dense_mib = 19630, companion_dense_mib = 12182, text_encoder_dense_mib = 10847)SIZES_EXPLICIT_INT8 = dict(diff --git a/studio/backend/tests/test_sf_client_tools_passthrough.py b/studio/backend/tests/test_sf_client_tools_passthrough.pyindex ef04704f8c4..0ab6bdeba6a 100644--- a/studio/backend/tests/test_sf_client_tools_passthrough.py+++ b/studio/backend/tests/test_sf_client_tools_passthrough.py@@ -11,6 +11,7 @@ rides the same orchestrator path, so a single scripted backend covers both.import asyncioimport json+import refrom types import SimpleNamespaceimport pytest@@ -20,6 +21,15 @@ from routes.inference import openai_chat_completionsfrom core.inference.api_monitor import ApiMonitor+# #12382: with the date setting on and no system prompt, the chat's first message opens with+# this note. It is the only rewrite of the user's text these assertions allow.+_DATE_NOTE = re.compile(r"\A\[Current date: \d{4}-\d{2}-\d{2}\]\n\n")+++def _without_date_note(text):+ return _DATE_NOTE.sub("", text, count = 1) if isinstance(text, str) else text++LOOKUP_TOOL = {"type": "function","function": {@@ -1242,7 +1252,7 @@ def test_multimodal_content_parts_flattened_for_local_template(monkeypatch):body = _json_body(_call(payload, monkeypatch, backend))templated = backend.calls[0]["messages"]assert all(isinstance(m.get("content"), str) for m in templated)- assert any(m["content"] == "what is this?" for m in templated)+ assert any(_without_date_note(m["content"]) == "what is this?" for m in templated)assert body["choices"][0]["finish_reason"] == "tool_calls"diff --git a/studio/backend/tests/test_vision_client_tools.py b/studio/backend/tests/test_vision_client_tools.pyindex 23d9be18d0a..d467abb2ad7 100644--- a/studio/backend/tests/test_vision_client_tools.py+++ b/studio/backend/tests/test_vision_client_tools.py@@ -10,6 +10,7 @@ Route-level tests stub ``generate_chat_response`` entirely, so these callimport importlibimport importlib.machineryimport json+import reimport sysimport threadingimport types@@ -18,6 +19,15 @@ from unittest.mock import MagicMockimport pytest+# #12382: with the date setting on and no system prompt, the chat's first message opens with+# this note. It is the only rewrite of the user's text these assertions allow.+_DATE_NOTE = re.compile(r"\A\[Current date: \d{4}-\d{2}-\d{2}\]\n\n")+++def _without_date_note(text):+ return _DATE_NOTE.sub("", text, count = 1) if isinstance(text, str) else text++def _shared_setup_1(__file__):import osimport sys@@ -1011,7 +1021,7 @@ def test_a_historical_image_stays_on_the_turn_that_sent_it_without_tools():earlier, owning, later = [m for m in sent if m.get("role") == "user"]assert [p.get("type") for p in owning["content"]] == ["image", "text"]assert owning["content"][1]["text"] == "IMAGE_QUESTION about the picture"- assert earlier["content"] == "EARLIER_QUESTION with no picture"+ assert _without_date_note(earlier["content"]) == "EARLIER_QUESTION with no picture"assert later["content"] == "LATER_QUESTION unrelated to it"diff --git a/tests/studio/test_version_compat_bundle.py b/tests/studio/test_version_compat_bundle.pyindex 28be1622d4d..854ed0e3fa0 100644--- a/tests/studio/test_version_compat_bundle.py+++ b/tests/studio/test_version_compat_bundle.py@@ -179,3 +179,22 @@ def test_the_install_bearing_jobs_were_not_folded_in() -> None:f"sibling's pins, so it cannot have been merged into anything -- check it was "f"not folded into {BUNDLE_JOB}, which has no torch at all.")+++def test_every_test_file_a_job_runs_triggers_the_workflow() -> None:+ """A file only this workflow executes must be in its pull_request paths, or a PR that only+ edits (or weakens) that file never runs it. The modules.json trust gate is the case that+ prompted this: the CPU repo-test shards skip it, so this workflow is its only runner."""+ from fnmatch import fnmatch++ doc = _doc()+ # PyYAML reads the bare `on:` key as the boolean True.+ triggers = doc.get("on", doc.get(True)) or {}+ patterns = (triggers.get("pull_request") or {}).get("paths") or []+ assert patterns, "version-compat-ci.yml lost its pull_request paths filter"+ named = set()+ for job in _jobs().values():+ named |= {p for p in _named_paths(job) if not p.endswith("/") and (REPO / p).is_file()}+ assert named, "no test file found in any run step"+ missing = sorted(p for p in named if not any(fnmatch(p, pattern) for pattern in patterns))+ assert not missing, f"run by version-compat-ci.yml but not in its pull_request paths: {missing}"diff --git a/tests/test_st_modules_json_trust_gate.py b/tests/test_st_modules_json_trust_gate.pyindex 002e42cd11e..233d78fb433 100644--- a/tests/test_st_modules_json_trust_gate.py+++ b/tests/test_st_modules_json_trust_gate.py@@ -27,7 +27,11 @@ import sysimport pytest-from unsloth import FastSentenceTransformer+# The gate runs inside sentence-transformers' module loading. The CPU repo-test shards do not+# install it; version-compat-ci's zoo-imports-under-spoof job does, and runs this file.+pytest.importorskip("sentence_transformers")++from unsloth import FastSentenceTransformer # noqa: E402MARKER = "unsloth_st_gate_marker"