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

* check for torch.cuda and triton if available
on my machine(mac m3) the cuda were not available

* Update pyproject.toml

* Update __init__.py

---------

Co-authored-by: Daniel Han <danielhanchen@gmail.com>
This commit is contained in:
AminWhat 2025-01-16 10:32:23 +03:30 committed by GitHub
commit 6b22725df7

View file

@ -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