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.

Studio (Windows): pair a kept torch 2.12 with triton-windows 3.7 (#14684)

Daniel Han8281152241f2
diff --git a/studio/backend/core/_msvc_env.py b/studio/backend/core/_msvc_env.py
index 7b2d375fb09..abbdb76d09a 100644
--- a/studio/backend/core/_msvc_env.py
+++ b/studio/backend/core/_msvc_env.py
@@ -256,8 +256,9 @@ def _crt_headers_reachable() -> bool:
def _triton_windows_spec() -> str:
"""The triton-windows range for the resident torch, as studio/setup.ps1 installs it.
- Read from package metadata, not `import torch`: this runs before torch is imported. torch 2.13
- pins triton 3.7 and 2.14 pins 3.8; anything older (or unreadable) keeps the long-standing <3.7.
+ Read from package metadata, not `import torch`: this runs before torch is imported. torch 2.12 and
+ 2.13 pin triton 3.7 (2.12.0 exactly 3.7.0) and 2.14 pins 3.8; anything older (or unreadable)
+ keeps the long-standing <3.7.
A native ARM64 interpreter gets setup.ps1's Windows-on-ARM floor: no win_arm64 wheel predates it.
"""
import platform # noqa: PLC0415
@@ -265,11 +266,18 @@ def _triton_windows_spec() -> str:
if platform.machine().lower() == "arm64":
return "triton-windows>=3.8.0.post28"
try:
+ import re # noqa: PLC0415
from importlib.metadata import version # noqa: PLC0415
- major, minor = (int(part) for part in version("torch").split("+", 1)[0].split(".")[:2])
+
+ # A dev build's patch ("2.13.0a0+git...") still has the major and minor.
+ match = re.match(r"(\d+)\.(\d+)(?:\.(\d+))?", version("torch"))
+ major, minor = int(match.group(1)), int(match.group(2))
+ patch = int(match.group(3)) if match.group(3) is not None else None
except Exception: # noqa: BLE001 -- a hint must never raise
return "triton-windows<3.7"
- if (major, minor) == (2, 13):
+ if (major, minor, patch) == (2, 12, 0):
+ return "triton-windows>=3.7,<3.7.1"
+ if (major, minor) in ((2, 12), (2, 13)):
return "triton-windows>=3.7,<3.8"
if (major, minor) == (2, 14):
return "triton-windows>=3.8,<3.9"
diff --git a/studio/backend/tests/test_msvc_env_triton_hint.py b/studio/backend/tests/test_msvc_env_triton_hint.py
index cab8915bc19..adca9686e4d 100644
--- a/studio/backend/tests/test_msvc_env_triton_hint.py
+++ b/studio/backend/tests/test_msvc_env_triton_hint.py
@@ -17,6 +17,10 @@ from core import _msvc_env
("2.13.0+cu130", "triton-windows>=3.7,<3.8"),
("2.14.0", "triton-windows>=3.8,<3.9"),
("2.11.0+cu128", "triton-windows<3.7"),
+ ("2.12.1+cu130", "triton-windows>=3.7,<3.8"),
+ ("2.12.0", "triton-windows>=3.7,<3.7.1"),
+ ("2.12.0+cu130", "triton-windows>=3.7,<3.7.1"),
+ ("2.13.0a0+gitabc", "triton-windows>=3.7,<3.8"),
("2.9.1", "triton-windows<3.7"),
],
)
diff --git a/studio/setup.ps1 b/studio/setup.ps1
index f0278ea0372..381eb906e7a 100644
--- a/studio/setup.ps1
+++ b/studio/setup.ps1
@@ -8974,12 +8974,13 @@ if ($WinArm64Venv -and $WinArm64EffectiveTorchIndexUrl) {
}
# <3.7 everywhere except Windows on ARM, whose first win_arm64 wheel is 3.8.0.post28.
$_tritonSpec = if ($WinArm64Venv) { "triton-windows>=3.8.0.post28" } else { "triton-windows<3.7" }
-# triton-windows: torch 2.13 -> 3.7, 2.14 -> 3.8, older keeps <3.7.
+# triton-windows follows the Triton each torch pins: 2.12 and 2.13 -> 3.7 (2.12.0 -> 3.7.0), 2.14 -> 3.8, older keeps <3.7.
function Get-TritonWindowsSpec {
param([string]$TorchVersion, [bool]$WinArm64 = $false)
if ($WinArm64) { return "triton-windows>=3.8.0.post28" }
- if ($TorchVersion -match '^2\.(\d+)\.') {
+ if ($TorchVersion -match '^2\.(\d+)\.(\d+)') {
switch ([int]$Matches[1]) {
+ 12 { if ([int]$Matches[2] -eq 0) { return "triton-windows>=3.7,<3.7.1" } return "triton-windows>=3.7,<3.8" }
13 { return "triton-windows>=3.7,<3.8" }
14 { return "triton-windows>=3.8,<3.9" }
}
diff --git a/tests/studio/test_cu130_torch213_route.ps1 b/tests/studio/test_cu130_torch213_route.ps1
index 0be761f04be..dbd7ad7a407 100644
--- a/tests/studio/test_cu130_torch213_route.ps1
+++ b/tests/studio/test_cu130_torch213_route.ps1
@@ -205,7 +205,8 @@ try {
Write-Host "=== setup.ps1 triton-windows pairing ==="
Check "torch 2.11 keeps triton-windows <3.7" ((Get-TritonWindowsSpec -TorchVersion "2.11.0+cu130") -eq "triton-windows<3.7")
- Check "torch 2.12 keeps triton-windows <3.7" ((Get-TritonWindowsSpec -TorchVersion "2.12.1+cu130") -eq "triton-windows<3.7")
+ Check "torch 2.12 pairs triton-windows 3.7 (it pins triton 3.7)" ((Get-TritonWindowsSpec -TorchVersion "2.12.1+cu130") -eq "triton-windows>=3.7,<3.8")
+ Check "torch 2.12.0 pairs triton-windows 3.7.0 (it pins triton 3.7.0)" ((Get-TritonWindowsSpec -TorchVersion "2.12.0+cu130") -eq "triton-windows>=3.7,<3.7.1")
Check "torch 2.13 pairs triton-windows 3.7" ((Get-TritonWindowsSpec -TorchVersion "2.13.0+cu130") -eq "triton-windows>=3.7,<3.8")
Check "torch 2.14 pairs triton-windows 3.8" ((Get-TritonWindowsSpec -TorchVersion "2.14.0+cu130") -eq "triton-windows>=3.8,<3.9")
Check "unknown torch keeps <3.7" ((Get-TritonWindowsSpec -TorchVersion "") -eq "triton-windows<3.7")