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: Windows torch 2.11 kernels from our prebuilt wheels (#13564)
Daniel Hanaf9d97837e97
diff --git a/studio/backend/tests/test_kernel_install.py b/studio/backend/tests/test_kernel_install.pyindex 88af6d8cf6c..3c5cfd21544 100644--- a/studio/backend/tests/test_kernel_install.py+++ b/studio/backend/tests/test_kernel_install.py@@ -99,7 +99,7 @@ def test_causal_conv1d_reuses_torch_2_10_wheel_on_2_11():[None,_env("2.11.0+cpu", ""),- _env("2.11.0+cu130", "13.0", platform_tag = "win_amd64"),+ _env("2.12.0+cu130", "13.0", platform_tag = "win_amd64"),],)def test_causal_conv1d_has_no_wheel_off_linux_cuda(env):@@ -336,7 +336,12 @@ def test_console_entry_drops_an_unwritable_ssl_keylog_file(tmp_path):"https://github.com/unslothai/unsloth/releases/download/prebuilt-wheels-cu13/""flash_attn-2.8.4+cu13torch2.13cxx11abiTRUE-cp313-cp313-linux_x86_64.whl",),- (_env("2.11.0+cu130", "13.0", platform_tag = "win_amd64"), None),+ (+ _env("2.11.0+cu130", "13.0", platform_tag = "win_amd64"),+ "https://github.com/unslothai/unsloth/releases/download/prebuilt-wheels-cu13/"+ "flash_attn-2.8.4+cu13torch2.11cxx11abiTRUE-cp313-cp313-win_amd64.whl",+ ),+ (_env("2.12.0+cu130", "13.0", platform_tag = "win_amd64"), None),(_env("2.11.0+cpu", ""), None),],)diff --git a/studio/backend/tests/test_wheel_utils_windows_kernels.py b/studio/backend/tests/test_wheel_utils_windows_kernels.pyindex 4458874aeed..64242587b62 100644--- a/studio/backend/tests/test_wheel_utils_windows_kernels.py+++ b/studio/backend/tests/test_wheel_utils_windows_kernels.py@@ -47,13 +47,27 @@ def test_win_amd64_resolves_every_kernel_to_our_release(torch_mm):assert kernel_install.MAMBA_SSM.wheel_url(e) == f"{OURS}mamba_ssm-2.3.2.post1{suffix}"[email protected]("python_tag", ["cp311", "cp312", "cp313"])+def test_win_amd64_torch_211_resolves_to_our_release(python_tag):+ # Existing installs keep torch 2.11 on their own minor; upstream's torch2.10 reuse has no Windows asset.+ e = env(torch_mm = "2.11", python_tag = python_tag, abi_tag = python_tag)+ suffix = f"+cu13torch2.11cxx11abiTRUE-{python_tag}-{python_tag}-win_amd64.whl"+ assert wheel_utils.flash_attn_wheel_url(e) == f"{OURS}flash_attn-2.8.4{suffix}"+ assert kernel_install.CAUSAL_CONV1D.wheel_url(e) == f"{OURS}causal_conv1d-1.7.0{suffix}"+ assert kernel_install.MAMBA_SSM.wheel_url(e) == f"{OURS}mamba_ssm-2.3.2.post1{suffix}"+ # torch 2.11 is win_amd64 only.+ assert wheel_utils.flash_attn_wheel_url(env(torch_mm = "2.11", platform_tag = "win_arm64")) is None++@pytest.mark.parametrize("overrides",[- {"python_tag": "cp312", "abi_tag": "cp312"}, # only cp313 is published for Windows+ {"python_tag": "cp312", "abi_tag": "cp312"}, # 2.13 / 2.14 publish cp313 only{"abi_tag": "cp313t"}, # a free-threaded build cannot load the GIL wheel{"cxx11abi": "FALSE"}, # not what the Windows cu130 torch reports- {"torch_mm": "2.11"}, # Windows default today; no wheel, and no upstream fallback+ {"torch_mm": "2.12"}, # no wheel, and no upstream fallback+ {"torch_mm": "2.11", "python_tag": "cp314", "abi_tag": "cp314"},+ {"torch_mm": "2.11", "abi_tag": "cp313t"},{"torch_mm": "2.10"},{"cuda_major": "12"},{"cuda_major": ""},@@ -271,7 +285,7 @@ def test_cli_resolves_windows_kernels():"-cp313-cp313-win_amd64.whl")assert kernel_install.resolve_wheel_url("mamba_ssm", e).endswith("-cp313-cp313-win_amd64.whl")- assert kernel_install.resolve_wheel_url("flash_attn", env(torch_mm = "2.11")) is None+ assert kernel_install.resolve_wheel_url("flash_attn", env(torch_mm = "2.12")) is Noneassert (kernel_install.resolve_wheel_url("flash_attn", env(platform_tag = "macosx_14_0_arm64"))is Nonediff --git a/studio/backend/utils/wheel_utils.py b/studio/backend/utils/wheel_utils.pyindex 3adf4a96699..c5161cb0926 100644--- a/studio/backend/utils/wheel_utils.py+++ b/studio/backend/utils/wheel_utils.py@@ -139,6 +139,11 @@ _UNSLOTH_PREBUILT_PLATFORMS: dict[str, tuple[str, frozenset[str] | None]] = {"win_arm64": ("TRUE", frozenset({"cp311", "cp312", "cp313"})),}+# (platform, torch minor) cells outside _UNSLOTH_PREBUILT_TORCH_MM, with their interpreters. The torch2.10 reuse above has no Windows asset, so win_amd64 torch 2.11 is ours; an existing install keeps its minor (a fresh one takes 2.13 on cp313), hence three interpreters.+_UNSLOTH_PREBUILT_EXTRA_CELLS: dict[tuple[str, str], frozenset[str]] = {+ ("win_amd64", "2.11"): frozenset({"cp311", "cp312", "cp313"}),+}+# 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._UNSLOTH_WIN_ARM64_PREFIXES = frozenset({"causal_conv1d", "mamba_ssm"})_WIN_ARM64_TORCH_MM = "2.14"@@ -200,15 +205,19 @@ def unsloth_prebuilt_wheel_url(*, filename_prefix: str, env: dict[str, str] | No"""if env is None:return None- if env.get("torch_mm") not in _UNSLOTH_PREBUILT_TORCH_MM:+ platform_tag = str(env.get("platform_tag") or "")+ extra_pythons = _UNSLOTH_PREBUILT_EXTRA_CELLS.get((platform_tag, str(env.get("torch_mm"))))+ if env.get("torch_mm") not in _UNSLOTH_PREBUILT_TORCH_MM and extra_pythons is None:return None# cu13 only. The workflow builds against the CUDA 13 toolkit and nothing else.if env.get("cuda_major") != "13":return None- platform_spec = _UNSLOTH_PREBUILT_PLATFORMS.get(str(env.get("platform_tag") or ""))+ platform_spec = _UNSLOTH_PREBUILT_PLATFORMS.get(platform_tag)if platform_spec is None:return Nonecxx11abi, published_pythons = platform_spec+ if extra_pythons is not None:+ published_pythons = extra_pythonsif env.get("platform_tag") == "win_arm64" and (filename_prefix not in _UNSLOTH_WIN_ARM64_PREFIXESor env.get("torch_mm") != _WIN_ARM64_TORCH_MMdiff --git a/tests/python/test_prebuilt_cuda_wheels.py b/tests/python/test_prebuilt_cuda_wheels.pyindex 45487252e50..1a074106642 100644--- a/tests/python/test_prebuilt_cuda_wheels.py+++ b/tests/python/test_prebuilt_cuda_wheels.py@@ -120,6 +120,41 @@ class TestWorkflowAndResolverAgree:for package, spec in prebuilt_wheels.SPECS.items():assert wheel_utils._UNSLOTH_PREBUILT_VERSIONS[spec["dist"]] == spec["version"], package+ def test_every_extra_cell_the_workflow_builds_is_what_the_resolver_asks_for(self):+ """win_amd64 torch 2.11: outside TORCH_VERSIONS, so the class above does not see it."""+ checked = 0+ for (platform, torch_mm), pythons in wheel_utils._UNSLOTH_PREBUILT_EXTRA_CELLS.items():+ built_torches = prebuilt_wheels._platform_torches(platform)+ torch_version = next(v for v in built_torches if v.startswith(f"{torch_mm}."))+ assert torch_version not in prebuilt_wheels.TORCH_VERSIONS+ for python_version in prebuilt_wheels.PYTHON_VERSIONS:+ tag = prebuilt_wheels.python_tag(python_version)+ for package, spec in prebuilt_wheels.SPECS.items():+ url = wheel_utils.unsloth_prebuilt_wheel_url(+ filename_prefix = spec["dist"],+ env = env(+ torch_mm = torch_mm,+ python_tag = tag,+ platform_tag = platform,+ ),+ )+ if tag not in pythons:+ assert url is None+ continue+ built = prebuilt_wheels.wheel_name(+ package, torch_version, python_version, platform+ )+ assert url == f"{OUR_BASE}{built}"+ checked += 1+ assert checked == 9+ extra = {+ (platform, prebuilt_wheels.torch_minor(v))+ for platform in prebuilt_wheels.PLATFORMS+ for v in prebuilt_wheels._platform_torches(platform)+ if v not in prebuilt_wheels.TORCH_VERSIONS+ }+ assert extra == set(wheel_utils._UNSLOTH_PREBUILT_EXTRA_CELLS)+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)