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
Backend CI: split the g-r pytest shard into g-l and m-r (#17187)
Daniel Han20cbf1bf6b87
diff --git a/.github/workflows/studio-backend-ci.yml b/.github/workflows/studio-backend-ci.ymlindex 88c0442fee5..9d84596ef51 100644--- a/.github/workflows/studio-backend-ci.yml+++ b/.github/workflows/studio-backend-ci.yml@@ -123,9 +123,8 @@ jobs:# 3.13 full run, plus 3.11 for the files with a pre-3.12 sys.version_info branch.## Shards root at `tests/` and differ only in ignores: `--ignore=FILE` does not filter explicit arguments.- # Shard 3 is the remainder, so new files land in exactly one shard (test_ci_backend_pytest_shards.py).- # a-f / g-r, not a-k / l-r: a-k's parallel step reached 1024-1264 s against the 1500 s backstop,- # and hit it twice on 2026-10-23, while l-r took 590-867 s (705 files each side now).+ # `rest` is the remainder, so new files land in exactly one shard (test_ci_backend_pytest_shards.py).+ # Ranges balance the 1500 s backstop: a-k hit it on 2026-10-23, g-r on 2026-11-09 (g-l ~40%, m-r ~60%).include:- python: '3.13'scope: full@@ -137,12 +136,20 @@ jobs:--ignore-glob=tests/test_[!a-f]*.py- python: '3.13'scope: full- shard: g-r+ shard: g-lselection: >-tests/--ignore-glob=tests/*/*--ignore-glob=tests/*_test.py- --ignore-glob=tests/test_[!g-r]*.py+ --ignore-glob=tests/test_[!g-l]*.py+ - python: '3.13'+ scope: full+ shard: m-r+ selection: >-+ tests/+ --ignore-glob=tests/*/*+ --ignore-glob=tests/*_test.py+ --ignore-glob=tests/test_[!m-r]*.py- python: '3.13'scope: fullshard: restdiff --git a/studio/backend/tests/test_load_download_repos_mapper.py b/studio/backend/tests/test_load_download_repos_mapper.pyindex 67116c14f82..a883ff02a78 100644--- a/studio/backend/tests/test_load_download_repos_mapper.py+++ b/studio/backend/tests/test_load_download_repos_mapper.py@@ -8,7 +8,8 @@ import pytestdef test_unmapped_lora_base_skips_the_remote_mapper(monkeypatch):# Not importorskip("unsloth"): an earlier file in the worker may have stubbed it as a plain module.- loader_utils = pytest.importorskip("unsloth.models.loader_utils")+ # exc_type: the real package raises a plain ImportError when unsloth_zoo is missing.+ loader_utils = pytest.importorskip("unsloth.models.loader_utils", exc_type = ImportError)from core.inference import workerfetches = []@@ -39,7 +40,7 @@ def test_unmapped_lora_base_skips_the_remote_mapper(monkeypatch):name = next(iter(loader_utils.FLOAT_TO_INT_MAPPER))mapped = SimpleNamespace(identifier = "owner/adapter", base_model = name)- loader = pytest.importorskip("unsloth.models.loader")+ loader = pytest.importorskip("unsloth.models.loader", exc_type = ImportError)expected = loader_utils.get_model_name(name, load_in_4bit = loader.ALLOW_BITSANDBYTES)if not loader.ALLOW_PREQUANTIZED_MODELS:@@ -51,8 +52,8 @@ def test_unmapped_lora_base_skips_the_remote_mapper(monkeypatch):def test_unmapped_prequantized_base_still_lists_the_stripped_repo(monkeypatch):- loader = pytest.importorskip("unsloth.models.loader")- loader_utils = pytest.importorskip("unsloth.models.loader_utils")+ loader = pytest.importorskip("unsloth.models.loader", exc_type = ImportError)+ loader_utils = pytest.importorskip("unsloth.models.loader_utils", exc_type = ImportError)from core.inference import workermonkeypatch.setattr(loader_utils, "_get_new_mapper", lambda: ({}, {}, {}, {}, {}))diff --git a/tests/studio/test_backend_ci_parallel_isolation.py b/tests/studio/test_backend_ci_parallel_isolation.pyindex 55465b6072c..cdf5f895f31 100644--- a/tests/studio/test_backend_ci_parallel_isolation.py+++ b/tests/studio/test_backend_ci_parallel_isolation.py@@ -342,8 +342,8 @@ def test_the_command_scan_sees_the_parallel_run_and_the_serial_steps():"""Pin the parser: a scan that matched nothing would pass both tests above."""commands = _pytest_commands()parallel = [command for command in commands if " -n " in f" {command} "]- assert len(parallel) == 13, (- f"expected thirteen parallel pytest runs, three shards of the backend matrix and ten "+ assert len(parallel) == 14, (+ f"expected fourteen parallel pytest runs, four shards of the backend matrix and ten "f"of repo-cpu-tests, got {parallel}. If a job stopped running in parallel, or a "f"shard was added or removed, say so here rather than letting this scan quietly "f"cover fewer runs."@@ -354,8 +354,8 @@ def test_the_command_scan_sees_the_parallel_run_and_the_serial_steps():f"to those, and a scan that matched none of them would pass on nothing.")backend = [command for command in parallel if _over_the_backend(command)]- assert len(backend) == 3, (- f"expected the three backend shards, got {backend}. Same reason: the backend "+ assert len(backend) == 4, (+ f"expected the four backend shards, got {backend}. Same reason: the backend "f"isolation checks apply to those.")# The two jobs' sets must be disjoint or each job's isolation rules apply to the other.@@ -370,7 +370,7 @@ def test_the_command_scan_sees_the_parallel_run_and_the_serial_steps():assert all("${{" not in command for command in root + backend)assert any("--ignore=" in command for command in root)assert {command for command in root} == set(root), "a shard selection appears twice"- assert len(set(backend)) == 3, "a backend shard selection appears twice"+ assert len(set(backend)) == 4, "a backend shard selection appears twice"# Non-vacuous for the backend side too.assert any(_collects(command, "tests/test_account_contract.py") for command in backend)# Non-vacuous for the repo root too.diff --git a/tests/test_ci_backend_pytest_shards.py b/tests/test_ci_backend_pytest_shards.pyindex 902c3716022..e6107e6921b 100644--- a/tests/test_ci_backend_pytest_shards.py+++ b/tests/test_ci_backend_pytest_shards.py@@ -1,7 +1,7 @@# SPDX-License-Identifier: AGPL-3.0-only# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0-"""Every backend test file must land in exactly one shard: two letter ranges plus a catch-all shard."""+"""Every backend test file must land in exactly one shard: three letter ranges plus a catch-all shard."""import fnmatchfrom pathlib import Path@@ -152,9 +152,11 @@ class TestEveryTestFileLandsInExactlyOneShard:[("tests/test_apple.py", "a-f"),("tests/test_fig.py", "a-f"),- ("tests/test_grape.py", "g-r"),- ("tests/test_kiwi.py", "g-r"),- ("tests/test_raisin.py", "g-r"),+ ("tests/test_grape.py", "g-l"),+ ("tests/test_kiwi.py", "g-l"),+ ("tests/test_lime.py", "g-l"),+ ("tests/test_mango.py", "m-r"),+ ("tests/test_raisin.py", "m-r"),("tests/test_squash.py", _CATCH_ALL),("tests/test_yam.py", _CATCH_ALL),],@@ -167,6 +169,11 @@ class TestEveryTestFileLandsInExactlyOneShard:expected], f"{path} must be collected by {expected} and only there; got {claiming}"+ @pytest.mark.parametrize("letter", "abcdefghijklmnopqrstuvwxyz")+ def test_every_lowercase_first_letter_has_exactly_one_shard(self, letter):+ claiming = _claiming_shards(f"tests/test_{letter}_new.py", _shards())+ assert len(claiming) == 1, f"tests/test_{letter}*.py is collected by {claiming}"+@pytest.mark.parametrize("path",[@@ -183,7 +190,7 @@ class TestEveryTestFileLandsInExactlyOneShard:by both."""claiming = _claiming_shards(path, _shards())assert claiming == [_CATCH_ALL], (- f"{path} is not described by either range, so it must land in the "+ f"{path} is not described by any range, so it must land in the "f"{_CATCH_ALL!r} shard and only there; got {claiming}")@@ -262,7 +269,7 @@ class TestTheSplitKeepsTheSelectionItInherited:assert "timeout --signal=INT --kill-after=60" in rundef test_the_serial_files_are_ignored_by_every_shard(self):- """The twelve cannot share a worker, and sharding does not change that: three+ """The twelve cannot share a worker, and sharding does not change that: fourrunners are still four workers each. They are held out by the shared --ignore liston the step, so this asks the question of the shard AND the step together."""run = _shared_pytest_step()["run"]@@ -279,7 +286,7 @@ class TestTheSplitKeepsTheSelectionItInherited:def test_the_serial_step_runs_in_one_process_in_one_shard(self):"""Splitting it would put its relative timings back on two machines, and running it- on every shard would run it three times."""+ on every shard would run it four times."""for step in _job()["steps"]:if step.get("name") != _SERIAL_STEP:continue