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.

fix: prevent training hang on Windows by adding triton-windows support

Roland Tannousef9184c731c9
diff --git a/setup.ps1 b/setup.ps1
index d2bfed3a4c7..591310c2497 100644
--- a/setup.ps1
+++ b/setup.ps1
@@ -685,6 +685,11 @@ $CuTag = Get-PytorchCudaTag
Write-Host " Installing PyTorch with CUDA support ($CuTag)..." -ForegroundColor Cyan
pip install torch torchvision torchaudio --index-url "https://download.pytorch.org/whl/$CuTag" 2>&1 | Out-Null
+# Install Triton for Windows (enables torch.compile — without it training can hang)
+Write-Host " Installing Triton for Windows..." -ForegroundColor Cyan
+pip install "triton-windows<3.7" 2>&1 | Out-Null
+Write-Host "[OK] Triton for Windows installed (enables torch.compile)" -ForegroundColor Green
+
# Ordered heavy dependency installation — shared cross-platform script
Write-Host " Running ordered dependency installation..." -ForegroundColor Cyan
python "$PSScriptRoot\install_python_stack.py"
diff --git a/studio/backend/core/export/worker.py b/studio/backend/core/export/worker.py
index adc197c3359..9e7e72e9dda 100644
--- a/studio/backend/core/export/worker.py
+++ b/studio/backend/core/export/worker.py
@@ -228,6 +228,18 @@ def run_export_process(
})
return
+ # ── 1b. On Windows, check Triton availability (must be before import torch) ──
+ if sys.platform == "win32":
+ try:
+ import triton # noqa: F401
+ logger.info("Triton available — torch.compile enabled")
+ except ImportError:
+ os.environ["TORCHDYNAMO_DISABLE"] = "1"
+ logger.warning(
+ "Triton not found on Windows — torch.compile disabled. "
+ 'Install for better performance: pip install "triton-windows<3.7"'
+ )
+
# ── 2. Import ML libraries (fresh in this clean process) ──
try:
_send_response(resp_queue, {
diff --git a/studio/backend/core/inference/worker.py b/studio/backend/core/inference/worker.py
index 04a93b8f2a8..7683d5e3147 100644
--- a/studio/backend/core/inference/worker.py
+++ b/studio/backend/core/inference/worker.py
@@ -323,6 +323,18 @@ def run_inference_process(
})
return
+ # ── 1b. On Windows, check Triton availability (must be before import torch) ──
+ if sys.platform == "win32":
+ try:
+ import triton # noqa: F401
+ logger.info("Triton available — torch.compile enabled")
+ except ImportError:
+ os.environ["TORCHDYNAMO_DISABLE"] = "1"
+ logger.warning(
+ "Triton not found on Windows — torch.compile disabled. "
+ 'Install for better performance: pip install "triton-windows<3.7"'
+ )
+
# ── 2. Import ML libraries (fresh in this clean process) ──
try:
_send_response(resp_queue, {
diff --git a/studio/backend/core/training/trainer.py b/studio/backend/core/training/trainer.py
index 2dd2e6eeebb..c2ce009879d 100644
--- a/studio/backend/core/training/trainer.py
+++ b/studio/backend/core/training/trainer.py
@@ -3,6 +3,7 @@ Unsloth Training Backend
Integrates Unsloth training capabilities with the FastAPI backend
"""
import os
+import sys
# Prevent tokenizer parallelism deadlocks when datasets uses multiprocessing fork
os.environ["TOKENIZERS_PARALLELISM"] = "false"
@@ -752,6 +753,11 @@ class UnslothTrainer:
"include_num_input_tokens_seen": True, # Enable token counting
"dataset_num_proc": safe_num_proc(max(1, os.cpu_count() // 4)),
}
+
+ # On Windows, disable DataLoader multiprocessing to avoid
+ # issues with modified sys.path in spawned subprocesses.
+ if sys.platform == "win32":
+ config_args["dataloader_num_workers"] = 0
# Add warmup parameter - use warmup_ratio if provided, otherwise warmup_steps
if warmup_ratio_val is not None:
diff --git a/studio/backend/core/training/worker.py b/studio/backend/core/training/worker.py
index a0ecb8d4e32..e4b833cb9af 100644
--- a/studio/backend/core/training/worker.py
+++ b/studio/backend/core/training/worker.py
@@ -97,6 +97,18 @@ def run_training_process(
})
return
+ # ── 1b. On Windows, check Triton availability (must be before import torch) ──
+ if sys.platform == "win32":
+ try:
+ import triton # noqa: F401
+ logger.info("Triton available — torch.compile enabled")
+ except ImportError:
+ os.environ["TORCHDYNAMO_DISABLE"] = "1"
+ logger.warning(
+ "Triton not found on Windows — torch.compile disabled. "
+ 'Install for better performance: pip install "triton-windows<3.7"'
+ )
+
# ── 2. Now import ML libraries (fresh in this clean process) ──
try:
_send_status(event_queue, "Importing ML libraries...")