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
Studio: Linux torch 2.10 to 2.12 take our causal-conv1d and mamba-ssm wheels (#14338)
Daniel Han16e32f38206d
diff --git a/studio/backend/tests/test_kernel_install.py b/studio/backend/tests/test_kernel_install.pyindex 4430ffe334d..fb02d189885 100644--- a/studio/backend/tests/test_kernel_install.py+++ b/studio/backend/tests/test_kernel_install.py@@ -25,6 +25,7 @@ _REAL_LOCK_PATH = kernel_install._kernel_lock_path_REPO = _BACKEND.parent.parent_PT = "https://download.pytorch.org/whl"_CC1D = "https://github.com/Dao-AILab/causal-conv1d/releases/download/v1.6.1.post4"+_OURS = "https://github.com/unslothai/unsloth/releases/download/prebuilt-wheels-cu13"def _env(@@ -92,9 +93,14 @@ def test_xformers_matches_torch_and_cuda(torch_version, cuda_version, expected):def test_causal_conv1d_reuses_torch_2_10_wheel_on_2_11():+ # cu12 still takes upstream's torch2.10 wheel; cu13 cp311-cp313 takes our own 2.11 build.+ url = kernel_install.resolve_wheel_url("causal_conv1d", _env("2.11.0+cu128", "12.8"))+ assert (+ url == f"{_CC1D}/causal_conv1d-1.6.1+cu12torch2.10cxx11abiTRUE-cp313-cp313-linux_x86_64.whl"+ )url = kernel_install.resolve_wheel_url("causal_conv1d", _env("2.11.0+cu130", "13.0"))assert (- url == f"{_CC1D}/causal_conv1d-1.6.1+cu13torch2.10cxx11abiTRUE-cp313-cp313-linux_x86_64.whl"+ url == f"{_OURS}/causal_conv1d-1.7.0+cu13torch2.11cxx11abiTRUE-cp313-cp313-linux_x86_64.whl")@@ -398,7 +404,7 @@ def test_mamba_ssm_installs_on_sm75_with_a_new_triton(uv, monkeypatch, triton):run = _Runner([False, True], capability = "7 5")assert kernel_install.install_kernel("mamba_ssm", _COLAB, run = run, exists = lambda url: True) == 0assert run.installer_calls[0][-1].endswith(- "mamba_ssm-2.3.1+cu13torch2.10cxx11abiTRUE-cp313-cp313-linux_x86_64.whl"+ "mamba_ssm-2.3.2.post1+cu13torch2.11cxx11abiTRUE-cp313-cp313-linux_x86_64.whl")@@ -483,7 +489,7 @@ def test_causal_conv1d_still_installs_below_sm80(uv):kernel_install.install_kernel("causal_conv1d", _COLAB, run = run, exists = lambda url: True)== 0)- assert run.installer_calls[0][-1].startswith(f"{_CC1D}/causal_conv1d-1.6.1+cu13torch2.10")+ assert run.installer_calls[0][-1].startswith(f"{_OURS}/causal_conv1d-1.7.0+cu13torch2.11")@pytest.mark.parametrize(@@ -561,7 +567,7 @@ def test_install_kernels_without_gpu_installs_mamba_ssm_headless(uv, monkeypatchmonkeypatch.setenv("UNSLOTH_INSTALL_KERNELS_WITHOUT_GPU", "1")assert kernel_install.main(argv) == 0assert run.installer_calls[0][-1].endswith(- "mamba_ssm-2.3.1+cu13torch2.10cxx11abiTRUE-cp313-cp313-linux_x86_64.whl"+ "mamba_ssm-2.3.2.post1+cu13torch2.11cxx11abiTRUE-cp313-cp313-linux_x86_64.whl")diff --git a/studio/backend/tests/test_wheel_utils_linux_aarch64_kernels.py b/studio/backend/tests/test_wheel_utils_linux_aarch64_kernels.pyindex ebb1f46205f..21e833ae617 100644--- a/studio/backend/tests/test_wheel_utils_linux_aarch64_kernels.py+++ b/studio/backend/tests/test_wheel_utils_linux_aarch64_kernels.py@@ -51,8 +51,8 @@ def test_all_three_resolve_to_our_builds(torch_mm):{"python_tag": "cp314", "abi_tag": "cp314t"},{"cuda_major": "12", "cuda_version": "12.8"},{"cxx11abi": "FALSE"},- {"torch_mm": "2.10"},- {"torch_mm": "2.11"},+ {"torch_mm": "2.10", "python_tag": "cp310", "abi_tag": "cp310"},+ {"torch_mm": "2.11", "cuda_major": "12", "cuda_version": "12.8"},],)def test_cells_we_do_not_build_never_name_our_release(overrides):@@ -65,6 +65,16 @@ def test_cells_we_do_not_build_never_name_our_release(overrides):assert url is None or not url.startswith(OURS), url-def test_torch_2_10_still_resolves_upstream():- e = env(torch_mm = "2.10", torch_version = "2.10.0+cu130")[email protected]("torch_mm", ["2.10", "2.11", "2.12"])+def test_older_torches_take_our_causal_conv1d_and_mamba_ssm_but_upstream_flash_attn(torch_mm):+ e = env(torch_mm = torch_mm, torch_version = f"{torch_mm}.0+cu130")+ tail = f"+cu13torch{torch_mm}cxx11abiTRUE-cp313-cp313-linux_aarch64.whl"+ assert kernel_install.CAUSAL_CONV1D.wheel_url(e) == f"{OURS}causal_conv1d-1.7.0{tail}"+ assert kernel_install.MAMBA_SSM.wheel_url(e) == f"{OURS}mamba_ssm-2.3.2.post1{tail}"+ flash = wheel_utils.flash_attn_wheel_url(e)+ assert flash is None or not flash.startswith(OURS), flash+++def test_torch_2_10_cu12_still_resolves_upstream():+ e = env(torch_mm = "2.10", torch_version = "2.10.0+cu128", cuda_major = "12", cuda_version = "12.8")assert "Dao-AILab/causal-conv1d" in kernel_install.CAUSAL_CONV1D.wheel_url(e)diff --git a/studio/backend/utils/wheel_utils.py b/studio/backend/utils/wheel_utils.pyindex f922760a43c..444e6dfed75 100644--- a/studio/backend/utils/wheel_utils.py+++ b/studio/backend/utils/wheel_utils.py@@ -162,6 +162,20 @@ _UNSLOTH_PREBUILT_EXTRA_CELLS: dict[tuple[str, str], frozenset[str]] = {("win_amd64", "2.10"): frozenset({"cp311", "cp312", "cp313"}),("win_amd64", "2.11"): frozenset({"cp311", "cp312", "cp313"}),("win_amd64", "2.12"): frozenset({"cp311", "cp312", "cp313"}),+ ("linux_x86_64", "2.10"): frozenset({"cp311", "cp312", "cp313"}),+ ("linux_x86_64", "2.11"): frozenset({"cp311", "cp312", "cp313"}),+ ("linux_x86_64", "2.12"): frozenset({"cp311", "cp312", "cp313"}),+ ("linux_aarch64", "2.10"): frozenset({"cp311", "cp312", "cp313"}),+ ("linux_aarch64", "2.11"): frozenset({"cp311", "cp312", "cp313"}),+ ("linux_aarch64", "2.12"): frozenset({"cp311", "cp312", "cp313"}),+}++# Extra cells that carry only some packages. On Linux torch 2.10 to 2.12 ours replace upstream's+# causal-conv1d / mamba-ssm (205 / 351 MB, every arch and -lineinfo); upstream flash-attn 2.8.1 is+# already smaller there than ours, so it keeps resolving upstream.+_UNSLOTH_PREBUILT_EXTRA_CELL_PREFIXES: dict[str, frozenset[str]] = {+ "linux_x86_64": frozenset({"causal_conv1d", "mamba_ssm"}),+ "linux_aarch64": frozenset({"causal_conv1d", "mamba_ssm"}),}# Windows on ARM has one CUDA torch, NVIDIA's 2.14.0+cu134 (CUDA 13.4, the first with a Windows ARM64 nvcc), and NVIDIA publishes flash-attn for it, so only these two are ours there.@@ -237,6 +251,9 @@ def unsloth_prebuilt_wheel_url(*, filename_prefix: str, env: dict[str, str] | Noreturn Nonecxx11abi, published_pythons = platform_specif extra_pythons is not None:+ extra_prefixes = _UNSLOTH_PREBUILT_EXTRA_CELL_PREFIXES.get(platform_tag)+ if extra_prefixes is not None and filename_prefix not in extra_prefixes:+ return Nonepublished_pythons = extra_pythonsif env.get("platform_tag") == "win_arm64" and (filename_prefix not in _UNSLOTH_WIN_ARM64_PREFIXESdiff --git a/tests/python/test_flash_attn_install_python_stack.py b/tests/python/test_flash_attn_install_python_stack.pyindex f99768495cb..5515db744f4 100644--- a/tests/python/test_flash_attn_install_python_stack.py+++ b/tests/python/test_flash_attn_install_python_stack.py@@ -81,13 +81,14 @@ class TestPrebuiltWheelTorchMapping:env = {"python_tag": "cp313","torch_mm": "2.11",- "cuda_major": "13",+ # cu12: cu13 cp311-cp313 resolves to our own build instead.+ "cuda_major": "12","cxx11abi": "TRUE","platform_tag": "linux_x86_64",},)assert url is not None- assert "causal_conv1d-1.6.1+cu13torch2.10cxx11abiTRUE-cp313-cp313-linux_x86_64.whl" in url+ assert "causal_conv1d-1.6.1+cu12torch2.10cxx11abiTRUE-cp313-cp313-linux_x86_64.whl" in urldef test_direct_wheel_url_reuses_torch210_on_212(self):url = wheel_utils.direct_wheel_url(@@ -98,13 +99,14 @@ class TestPrebuiltWheelTorchMapping:env = {"python_tag": "cp312","torch_mm": "2.12",- "cuda_major": "13",+ # cu12: cu13 cp311-cp313 resolves to our own build instead.+ "cuda_major": "12","cxx11abi": "TRUE","platform_tag": "linux_x86_64",},)assert url is not None- assert "mamba_ssm-2.3.1+cu13torch2.10cxx11abiTRUE-cp312-cp312-linux_x86_64.whl" in url+ assert "mamba_ssm-2.3.1+cu12torch2.10cxx11abiTRUE-cp312-cp312-linux_x86_64.whl" in urlclass TestFlashAttnWheelSelection:diff --git a/tests/python/test_prebuilt_cuda_wheels.py b/tests/python/test_prebuilt_cuda_wheels.pyindex 4e39c9c7056..6c1633f4bfd 100644--- a/tests/python/test_prebuilt_cuda_wheels.py+++ b/tests/python/test_prebuilt_cuda_wheels.py@@ -97,10 +97,8 @@ class TestWorkflowAndResolverAgree:fallback."""published = set()for platform in prebuilt_wheels.PLATFORMS:- packages = prebuilt_wheels._platform(platform, "packages") or tuple(- prebuilt_wheels.SPECS- )for torch_version in prebuilt_wheels._platform_torches(platform):+ packages = prebuilt_wheels._platform_packages(platform, torch_version)torch_mm = prebuilt_wheels.torch_minor(torch_version)extra = wheel_utils._UNSLOTH_PREBUILT_EXTRA_CELLS.get((platform, torch_mm))pythons = (@@ -189,21 +187,28 @@ class TestWorkflowAndResolverAgree:)is None)- # torch 2.12 keeps its upstream (2.10 reuse) URL.- assert wheel_utils.direct_wheel_url(+ # torch 2.12: cu12 keeps its upstream (2.10 reuse) URL, cu13 takes ours.+ url = wheel_utils.direct_wheel_url(filename_prefix = "mamba_ssm",package_version = "2.3.1",release_tag = "v2.3.1",release_base_url = "https://github.com/state-spaces/mamba/releases/download",env = env(torch_mm = "2.12", cuda_major = cuda_major, python_tag = "cp312"),- ).endswith("torch2.10cxx11abiTRUE-cp312-cp312-linux_x86_64.whl")+ )+ if cuda_major == "13":+ assert url == (+ f"{OUR_BASE}mamba_ssm-2.3.2.post1+cu13torch2.12cxx11abiTRUE-cp312-cp312-linux_x86_64.whl"+ )+ else:+ assert url.endswith("torch2.10cxx11abiTRUE-cp312-cp312-linux_x86_64.whl")def test_the_versions_published_are_the_versions_resolved(self):for package, spec in prebuilt_wheels.SPECS.items():assert wheel_utils._UNSLOTH_PREBUILT_VERSIONS[spec["dist"]] == spec["version"], packagedef test_every_extra_cell_the_workflow_builds_is_what_the_resolver_asks_for(self):- """win_amd64 torch 2.10 to 2.12: outside TORCH_VERSIONS, so the class above does not see them."""+ """torch 2.10 to 2.12 (every package on win_amd64, causal-conv1d and mamba-ssm on Linux):+ outside TORCH_VERSIONS, so the class above does not see them."""checked = 0for (platform, torch_mm), pythons in wheel_utils._UNSLOTH_PREBUILT_EXTRA_CELLS.items():built_torches = prebuilt_wheels._platform_torches(platform)@@ -220,15 +225,17 @@ class TestWorkflowAndResolverAgree:platform_tag = platform,),)- if tag not in pythons:- assert url is None+ built_here = prebuilt_wheels._platform_packages(platform, torch_version)+ if tag not in pythons or package not in built_here:+ assert url is None, (platform, torch_mm, tag, package)continuebuilt = prebuilt_wheels.wheel_name(package, torch_version, python_version, platform)assert url == f"{OUR_BASE}{built}"checked += 1- assert checked == 27+ # win_amd64: 3 torches x 3 interpreters x 3 packages; Linux x86_64 and aarch64: 3 x 3 x 2.+ assert checked == 27 + 36extra = {(platform, prebuilt_wheels.torch_minor(v))for platform in prebuilt_wheels.PLATFORMS@@ -239,6 +246,36 @@ class TestWorkflowAndResolverAgree:# before the resolver asks for it, so users never get a 404 in between.assert set(wheel_utils._UNSLOTH_PREBUILT_EXTRA_CELLS) <= extra+ def test_linux_older_torches_keep_upstream_flash_attn(self):+ """Upstream flash-attn 2.8.1 for torch 2.10 (125 MB, no PTX) is smaller than ours there."""+ for platform in ("linux_x86_64", "linux_aarch64"):+ for torch_mm in ("2.10", "2.11", "2.12"):+ probe = env(torch_mm = torch_mm, python_tag = "cp312", platform_tag = platform)+ assert (+ wheel_utils.unsloth_prebuilt_wheel_url(filename_prefix = "flash_attn", env = probe)+ is None+ )+ for prefix in ("causal_conv1d", "mamba_ssm"):+ url = wheel_utils.unsloth_prebuilt_wheel_url(filename_prefix = prefix, env = probe)+ assert url is not None and url.startswith(OUR_BASE)+ assert url.endswith(f"torch{torch_mm}cxx11abiTRUE-cp312-cp312-{platform}.whl")+ # cu12 torch and unpublished interpreters keep upstream's wheels.+ for other in (+ env(+ torch_mm = torch_mm,+ python_tag = "cp312",+ platform_tag = platform,+ cuda_major = "12",+ ),+ env(torch_mm = torch_mm, python_tag = "cp310", platform_tag = platform),+ ):+ assert (+ wheel_utils.unsloth_prebuilt_wheel_url(+ filename_prefix = "mamba_ssm", env = other+ )+ is None+ )+def test_the_two_torch_tables_are_the_same_set(self):built = {prebuilt_wheels.torch_minor(version) for version in prebuilt_wheels.TORCH_VERSIONS}assert built == set(wheel_utils._UNSLOTH_PREBUILT_TORCH_MM)@@ -342,7 +379,22 @@ class TestBackwardsCompatible:assert "Dao-AILab/flash-attention/releases/download/v2.8.3/" in urlassert "torch2.9" in url- def test_upstream_causal_conv1d_url_is_unchanged_on_212(self):+ def test_upstream_causal_conv1d_url_is_unchanged_on_212_cu12_and_cp310(self):+ for cuda_major, python_tag in (("12", "cp313"), ("13", "cp310")):+ url = wheel_utils.direct_wheel_url(+ filename_prefix = "causal_conv1d",+ package_version = "1.6.1",+ release_tag = "v1.6.1.post4",+ release_base_url = "https://github.com/Dao-AILab/causal-conv1d/releases/download",+ env = env(torch_mm = "2.12", cuda_major = cuda_major, python_tag = python_tag),+ )+ assert url == (+ "https://github.com/Dao-AILab/causal-conv1d/releases/download/v1.6.1.post4/"+ f"causal_conv1d-1.6.1+cu{cuda_major}torch2.10cxx11abiTRUE-{python_tag}-{python_tag}"+ "-linux_x86_64.whl"+ )++ def test_212_cu13_takes_our_causal_conv1d(self):url = wheel_utils.direct_wheel_url(filename_prefix = "causal_conv1d",package_version = "1.6.1",@@ -350,9 +402,9 @@ class TestBackwardsCompatible:release_base_url = "https://github.com/Dao-AILab/causal-conv1d/releases/download",env = env(torch_mm = "2.12"),)- assert url == (- "https://github.com/Dao-AILab/causal-conv1d/releases/download/v1.6.1.post4/"- "causal_conv1d-1.6.1+cu13torch2.10cxx11abiTRUE-cp313-cp313-linux_x86_64.whl"+ assert (+ url+ == f"{OUR_BASE}causal_conv1d-1.7.0+cu13torch2.12cxx11abiTRUE-cp313-cp313-linux_x86_64.whl")def test_213_takes_over_the_same_call(self):@@ -1046,5 +1098,13 @@ def test_every_upstream_url_the_resolver_can_emit_is_published():assert url.startswith(f"{base}/{tag}/"), urlemitted.add(url.rsplit("/", 1)[1])assert emitted <= published, sorted(emitted - published)- # And nothing published is lost (torch 2.11 / 2.12 reuse the 2.10 wheels).- assert emitted == published+ # And nothing published is lost (torch 2.11 / 2.12 reuse the 2.10 wheels), except the cu13+ # torch 2.10 to 2.12 cells on cp311-cp313, which resolve to our own wheels instead.+ ours = {+ name+ for name in published+ if "+cu13torch2.10cxx11abiTRUE-" in name+ and any(f"-{py}-{py}-" in name for py in ("cp311", "cp312", "cp313"))+ }+ assert ours+ assert emitted == published - ours