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.

install-kernels: tidy the sm75 mamba_ssm follow-ups (#12948)

Daniel Han8e0f3b507798
diff --git a/studio/backend/tests/test_kernel_install.py b/studio/backend/tests/test_kernel_install.py
index 333a58df955..5d75d947c7c 100644
--- a/studio/backend/tests/test_kernel_install.py
+++ b/studio/backend/tests/test_kernel_install.py
@@ -46,6 +46,8 @@ def _env(
@pytest.fixture(autouse = True)
def _no_mirror(monkeypatch):
monkeypatch.delenv("UNSLOTH_PYTORCH_MIRROR", raising = False)
+ # Forces the mamba_ssm decision below sm80; an inherited value would override the mocked Triton.
+ monkeypatch.delenv("UNSLOTH_MAMBA_PRE_AMPERE_FAST", raising = False)
@pytest.mark.parametrize(
@@ -421,6 +423,16 @@ def test_mamba_ssm_follows_the_unsloth_zoo_override(uv, monkeypatch, forced, cap
assert bool(run.installer_calls) is installs
+def test_the_override_skip_message_reads_as_a_sentence(monkeypatch, capsys):
+ monkeypatch.setenv("UNSLOTH_MAMBA_PRE_AMPERE_FAST", "0")
+ run = _Runner([], capability = "7 5")
+ kernel_install.install_kernel("mamba_ssm", _COLAB, run = run, exists = lambda url: True)
+ assert (
+ "Unsloth: skipping mamba_ssm, which UNSLOTH_MAMBA_PRE_AMPERE_FAST=0 turns off "
+ "(the best GPU is sm75)." in capsys.readouterr().out
+ )
+
+
def test_flash_attn_stays_sm80_only_with_a_new_triton(monkeypatch):
monkeypatch.setenv("UNSLOTH_MAMBA_PRE_AMPERE_FAST", "1")
monkeypatch.setattr(kernel_install, "_triton_version", lambda run: (3, 6))
diff --git a/studio/backend/utils/kernel_install.py b/studio/backend/utils/kernel_install.py
index 4ff8020e6b5..0d397941cc5 100644
--- a/studio/backend/utils/kernel_install.py
+++ b/studio/backend/utils/kernel_install.py
@@ -220,7 +220,7 @@ def resolve_wheel_url(name: str, env: dict[str, str] | None) -> str | None:
# FlashAttention 2 needs sm80. mamba_ssm's Triton kernels also run on sm75 with Triton 3.4+
# (torch 2.8+), the same rule unsloth_zoo's patch_mamba_ssm_pre_ampere_fallback applies, which
# turns the fast path off anywhere else, so the wheel would go unused there.
-_NEEDS_SM80 = ("flash_attn", "mamba_ssm")
+_GPU_GATED = ("flash_attn", "mamba_ssm")
_MAMBA_SM75_MIN_TRITON = (3, 4)
_CAPABILITY: dict = {}
@@ -260,7 +260,7 @@ def _pre_ampere_skip_reason(
return "needs sm80 or newer"
forced = os.environ.get("UNSLOTH_MAMBA_PRE_AMPERE_FAST", "").strip()
if forced in ("0", "1"):
- return None if forced == "1" else "UNSLOTH_MAMBA_PRE_AMPERE_FAST=0 is set"
+ return None if forced == "1" else "UNSLOTH_MAMBA_PRE_AMPERE_FAST=0 turns off"
if capability < (7, 5):
return "needs sm80, or sm75 with Triton 3.4+"
triton = _triton_version(run)
@@ -332,7 +332,7 @@ def install_kernel(
) -> int:
distribution, check = KERNELS[name]
url = resolve_wheel_url(name, env)
- if name in _NEEDS_SM80 and url is not None:
+ if name in _GPU_GATED and url is not None:
capability = _gpu_capability(run)
if capability is None:
print(f"Unsloth: skipping {name}, which needs sm80 or newer (no CUDA GPU is visible).")