Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Closed
1 task done
Raz0rStorm opened this issue Apr 10, 2023 · 5 comments
Closed
1 task done

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

Raz0rStorm opened this issue Apr 10, 2023 · 5 comments

Comments

@Raz0rStorm
Copy link

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What happened?

After installing the requirements, I run webui.bat and got the error

Steps to reproduce the problem

  1. Install requirements
  2. Run webui.bat
  3. error

What should have happened?

It should go through, I encoutered no such error when using the vanilla webui

Commit where the problem happens

ffc54d0

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

No

List of extensions

No

Console logs

venv "D:\Stable_diffusion\automatic\venv\Scripts\Python.exe"
Traceback (most recent call last):
  File "D:\Stable_diffusion\automatic\launch.py", line 310, in <module>
    prepare_environment()
  File "D:\Stable_diffusion\automatic\launch.py", line 247, 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 "D:\Stable_diffusion\automatic\launch.py", line 108, in run_python
    return run(f'"{python}" -c "{code}"', desc, errdesc)
  File "D:\Stable_diffusion\automatic\launch.py", line 84, in run
    raise RuntimeError(message)
RuntimeError: Error running command.
Command: "D:\Stable_diffusion\automatic\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

No response

@JoBilert
Copy link

You can solve this by manually reinstalling the proper PyTorch version from the PyTorch-Website.

Make sure to adapt the command to use your local venv. In my example, I had to change it from:

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

to

.\venv\Scripts\Python.exe -m pip install --upgrade --force-reinstall torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

After that I get a numpy version error, but webui.bat seems to run fine.

@AceroMagico
Copy link

AceroMagico commented Apr 10, 2023

To eliminate the numpy (or any other lib) version error you can do :
.\venv\Scripts\Python.exe -m pip install --force-reinstall --no-deps numpy
the --no-deps assure that the library installation does not reinstall libraries linked to it (which triggers a loop of error requirements then for example in torch ver cu118 )

@Raz0rStorm
Copy link
Author

All that got me through the first step of launch, thank you JoBilert and AceroMagico.
However, then I encoutered:
Fetching updates for Taming Transformers...
Checking out commit for Taming Transformers with hash: 3ba01b241669f5ade541ce990f7650a3b8f65318...
Traceback (most recent call last):
File "D:\Stable_diffusion\automatic\launch.py", line 310, in
prepare_environment()
File "D:\Stable_diffusion\automatic\launch.py", line 275, in prepare_environment
git_clone(taming_transformers_repo, repo_dir('taming-transformers'), "Taming Transformers", taming_transformers_commit_hash)
File "D:\Stable_diffusion\automatic\launch.py", line 135, in git_clone
run(f'"{git}" -C "{dir}" checkout {commithash}', f"Checking out commit for {name} with hash: {commithash}...", f"Couldn't checkout commit {commithash} for {name}")
File "D:\Stable_diffusion\automatic\launch.py", line 84, in run
raise RuntimeError(message)
RuntimeError: Couldn't checkout commit 3ba01b241669f5ade541ce990f7650a3b8f65318 for Taming Transformers.
Command: "git" -C "D:\Stable_diffusion\automatic\repositories\taming-transformers" checkout 3ba01b241669f5ade541ce990f7650a3b8f65318
Error code: 128
stdout:
stderr: fatal: reference is not a tree: 3ba01b241669f5ade541ce990f7650a3b8f65318
this is strange, because the latest hash should be 3ba01b2
Does anyone know how to solve this?

@AceroMagico
Copy link

AceroMagico commented Apr 10, 2023

If you have the folder taming-transformers in D:\Stable_diffusion\automatic\repositories you can try to go in folder with a cmd shell and do an update to last Version:

git checkout master

this are other useful commands:

Current Version log commit checkout number
git log -1

rem All Previews Versions Updates log commit hash (press enter for more)
git log

rem To revert to Preview Version paste a commit checkout number after git checkout
git checkout XXXXXXXX

If I make git log -1 (Current Version log commit checkout number) I take :
commit 3ba01b241669f5ade541ce990f7650a3b8f65318 (HEAD, origin/master, origin/HEAD, master)
Merge: 2426893 9e9981c
....
Merge pull request #190 from carmocca/patch-1

Use compatible import

(see too [Bug]: Unable to install, unable to launch #83)

@vladmandic
Copy link
Owner

See #92. Work is in progress, in the meantime closing this as duplicate.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants