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.

Torch.Cuda Is Available Condition and Warning (#1545)

AminWhat6b22725df71b
diff --git a/unsloth/__init__.py b/unsloth/__init__.py
index 8002fbaefdb..7f37a2069ed 100644
--- a/unsloth/__init__.py
+++ b/unsloth/__init__.py
@@ -86,6 +86,10 @@ elif (major_torch == 2) and (minor_torch < 2):
del os.environ["PYTORCH_CUDA_ALLOC_CONF"]
pass
+# First check if CUDA is available ie a NVIDIA GPU is seen
+if not torch.cuda.is_available():
+ raise NotImplementedError("Unsloth: No NVIDIA GPU found? Unsloth currently only supports GPUs!")
+
# Fix Xformers performance issues since 0.0.25
import importlib.util
from pathlib import Path