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
Update __init__.py
Daniel Han41ad82c1bac4
diff --git a/unsloth/__init__.py b/unsloth/__init__.pyindex 74312389c9d..c111cce6b9d 100644--- a/unsloth/__init__.py+++ b/unsloth/__init__.py@@ -82,7 +82,18 @@ def get_device_type():return "cuda"elif hasattr(torch, "xpu") and torch.xpu.is_available():return "xpu"- raise NotImplementedError("Unsloth currently only works on NVIDIA GPUs and Intel GPUs.")+ # Check torch.accelerator+ if hasattr(torch, "accelerator"):+ if not torch.accelerator.is_available():+ raise NotImplementedError("Unsloth cannot find any torch accelerators? You need a GPU.")+ accelerator = str(torch.accelerator.current_accelerator())+ if accelerator in ("cuda", "xpu", "hip"):+ raise RuntimeError(+ f"Unsloth: Weirdly `torch.cuda.is_available()`, `torch.xpu.is_available()` and `is_hip` all failed.\n"\+ f"But `torch.accelerator.current_accelerator()` works with it being = `{accelerator}`\n"\+ f"Please reinstall torch - it's most likely broken :("+ )+ raise NotImplementedError("Unsloth currently only works on NVIDIA, AMD and Intel GPUs.")passDEVICE_TYPE : str = get_device_type()