ai-toolkit icon indicating copy to clipboard operation
ai-toolkit copied to clipboard

AssertionError: Torch not compiled with CUDA enabled

Open ngrivv opened this issue 1 year ago • 5 comments

Getting this error when trying to run the script

ngrivv avatar Aug 17 '24 09:08 ngrivv

  1. Check if your system has CUDA installed:

    nvcc --version
    
  2. Run the following .py code to verify if PyTorch can detect your GPU:

    import torch
    print(torch.cuda.is_available())
    

    If it returns False, PyTorch isn't detecting CUDA, meaning that the installed version might be CPU-only.

  3. Install the Correct Version of PyTorch:

    pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
    
    
  4. Verify Installation:

    import torch
    print(torch.cuda.is_available())
    print(torch.cuda.get_device_name(0))
    
  5. Try running the config again

martintomov avatar Aug 18 '24 11:08 martintomov

the same mistake,still not solved

suifeng1221 avatar Aug 20 '24 02:08 suifeng1221

Hi, turns out the issue was that I was using the wrong start command (on Windows) so use python run.py config/whatever_you_want.yml instead of python3 run.py config/whatever_you_want.yml

ngrivv avatar Aug 20 '24 02:08 ngrivv

Hi, turns out the issue was that I was using the wrong start command (on Windows) so use python run.py config/whatever_you_want.yml instead of python3 run.py config/whatever_you_want.yml

This exists to distinguish between Python 2.x and Python 3.x installations on systems where both versions are available. Nowadays, Python 2 is hardly ever used, so the best way is to check which one you have is with --version:

python --version
python3 --version
pip --version
pip3 --version

martintomov avatar Aug 20 '24 08:08 martintomov

Try pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 Looks like the wrong torch is being picked up, that version should include CUDA 11.8. Just saw this also mentioned on main page, but with cu121.

deeplearner5 avatar Oct 26 '24 15:10 deeplearner5