AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
136.37k stars 25.99k forks source link

[Bug]: Torch is not able to use GPU #15827

Open gabikreal1 opened 2 months ago

gabikreal1 commented 2 months ago

Checklist

What happened?

RuntimeError: Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check

I've reinstalled VENV it didn't help

Steps to reproduce the problem

Installed the Automatic WebUI. and it just showed this problem. By the documentation I've been instructed to post the enviroment. I've attached it in system info.

What should have happened?

The webUI should've started

What browsers do you use to access the UI ?

Google Chrome

Sysinfo

python -m torch.utils.collect_env

Output@

PyTorch version: 2.1.2+cu121 Is debug build: False CUDA used to build PyTorch: 12.1 ROCM used to build PyTorch: N/A

OS: Microsoft Windows 11 Home GCC version: Could not collect Clang version: Could not collect CMake version: Could not collect Libc version: N/A

Python version: 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] (64-bit runtime) Python platform: Windows-10-10.0.22631-SP0 Is CUDA available: False CUDA runtime version: Could not collect CUDA_MODULE_LOADING set to: N/A GPU models and configuration: GPU 0: NVIDIA GeForce RTX 3050 Laptop GPU Nvidia driver version: 511.69 cuDNN version: Could not collect HIP runtime version: N/A MIOpen runtime version: N/A Is XNNPACK available: True

CPU: Architecture=9 CurrentClockSpeed=3201 DeviceID=CPU0 Family=107 L2CacheSize=4096 L2CacheSpeed= Manufacturer=AuthenticAMD MaxClockSpeed=3201 Name=AMD Ryzen 7 5800H with Radeon Graphics ProcessorType=3 Revision=20480

Versions of relevant libraries: [pip3] numpy==1.26.4 [pip3] torch==2.1.2+cu121 [pip3] torchvision==0.16.2+cu121 [conda] Could not collect

Console logs

RuntimeError: Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check

Additional information

No response

b-fission commented 2 months ago

You should update your nvidia graphics driver. The log says your driver version is 511.69, which is too old for CUDA 12.1

Go here: https://www.nvidia.com/download/index.aspx?lang=en-us

IblisBane commented 2 months ago

Happened to me this morning on an install that has been running fine for months. Updated extensions, (I think adetailer and controlnet updated), and when I re-launched the webui, got the same error. (Edit: Rolling back the extensions and disabling the extensions did not help.)

Updated Nvidia driver and CUDA, still got the same error.

What worked for me was re-installing Torch, (added --reinstall-torch to COMMANDLINE_ARGS in webui-user.bat), and re-running it. (Downloaded the latest Torch (about 2.5GB).)

(Remember to remove that parameter before you run it again or it'll install every time.)

(It did throw an error about Xformers, but I'm using --opt-sdp-attention instead and it didn't seem to affect anything.)

Hope that helps (somebody). :D

niony commented 2 months ago

No xformers fit for torch-2.1.2+cu121. When u pip install any version xformers , the torch-2.1.2+cu121 will be uninstall automatically and install torch-2.1 or 2.3 automatically.

jwnder commented 1 month ago

Installing xformers 0.024 works for me, it will automatically update its respective torch, but you will need to upgrade torchvision ana torchaudio at the same time .\venv\Scripts\python -m pip install xformers==0.0.24 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 --upgrade