AUTOMATIC1111 / stable-diffusion-webui

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

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

Open lebakerino opened 1 year ago

lebakerino commented 1 year ago

Is there an existing issue for this?

What happened?

Opened A1111 a few days ago, UI wouldn't load, checked the cmd prompt and it showed xformers and Torch needed updated, followed instructions.

OS Win 11, latest update, Geforce 3070Ti, latest drivers. Installed CUDN toolkit (as I was installing Vlad1111 a week or so before this and it runs fine), Python 3.10.9

Steps to reproduce the problem

  1. Open Web-UI
  2. Wait a few seconds
  3. ERROR

What should have happened?

It loaded without an error

Commit where the problem happens

5ab7f213bec2f816f9c5644becb32eb72c8ffb89

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

The same issue persists with the --reinstall commands for xformers, torch, the --xformers command aswell and no commands.

List of extensions

NA

Console logs

Python 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]
Commit hash: 5ab7f213bec2f816f9c5644becb32eb72c8ffb89
Traceback (most recent call last):
  File "C:\Users\SC\stable-diffusion-webui\launch.py", line 352, in <module>
    prepare_environment()
  File "C:\Users\SC\stable-diffusion-webui\launch.py", line 257, in prepare_environment
    run_python("import torch; assert torch.cuda.is_available(), 'Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check'")
  File "C:\Users\SC\stable-diffusion-webui\launch.py", line 120, in run_python
    return run(f'"{python}" -c "{code}"', desc, errdesc)
  File "C:\Users\SC\stable-diffusion-webui\launch.py", line 96, in run
    raise RuntimeError(message)
RuntimeError: Error running command.
Command: "C:\Users\SC\stable-diffusion-webui\venv\Scripts\python.exe" -c "import torch; assert torch.cuda.is_available(), 'Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check'"
Error code: 1
stdout: <empty>
stderr: Traceback (most recent call last):
  File "<string>", line 1, in <module>
AssertionError: Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check

Press any key to continue . . .

Additional information

I had installed Vlad1111 a week before and it loads just fine.

I have tried deleting the env and reinstalling multiple times. Tried a fresh install, also deleting env and reinstalling, multiple times. Tried installing the latest torch manually. Reinstalling Python, . When deleting the env and letting things reinstall, sometimes the site wouldn't connect and it would draw files from the cache so I have also tried after using the pip command to wipe the cache, it would re-download the files... and the problem still appears.

It DID work briefly after a new graphics card came out a few days ago but after i restarted my computer, the problem returned. It has worked briefly a few times but for whatever reason the error re appears, i can't understand what is going on.

Wh1t3Fox commented 1 year ago

@lebakerino Sounds like your drivers aren't loading. The error stating it cannot detect your GPU. Double check to make sure you have all drivers installed for your new GPU and CUDA is working before trying to run the script.

lebakerino commented 1 year ago

@lebakerino Sounds like your drivers aren't loading. The error stating it cannot detect your GPU. Double check to make sure you have all drivers installed for your new GPU and CUDA is working before trying to run the script.

Thanks for the response. My GPU isn't new, how do I test if CUDA is working? Before I had this issue with the A1111 update, I had installed Vlad and had installed Cuda 12.1, could that have messed it up? Last night I installed the 11.8 version of CUDA to see if that would help but to no avail.

I'm still stuck.. Vlad1111 loads just fine on start up it says this if it is of any help:

"nVidia toolkit detected 16:19:12-103354 INFO Torch 2.0.0+cu118 16:19:12-139377 INFO Torch backend: nVidia CUDA 11.8 cuDNN 8700 16:19:12-141360 INFO Torch detected GPU: NVIDIA GeForce RTX 3070 Ti Laptop GPU VRAM 8192 Arch (8, 6) Cores 46 16:19:12-142288 INFO Verifying requirements"

Thanks.

Harvester62 commented 1 year ago

I am facing the same error message after I reinstalled the venv today. The previous venv (which I didn't deleted but simply renamed) was using torch-1.13.1+cu117 and xformers-0.0.17.dev464, furthermore I configured Accelerator (accelerate-0.18.0 is still the same as in the previous venv) before running the SD Web UI after the venv reinstall (mentioning it because it's in the error message). The new venv now has torch-2.0.1, torchvision-0.15.2+cu118, xformers-0.0.17 installed.

My OS is Windows 10 Pro and I use the Firefox browser. My graphics card is Nvidia GTX1070 with the latest drivers immagine

The following is the console content after running webui-user.bat: immagine