当前位置:   article > 正文

解决在Windows安装stable diffusion遇到“Torch is not able to use GPU”的问题

torch is not able to use gpu

解决在Windows安装stable diffusion遇到“Torch is not able to use GPU”的问题

遇到的问题

在Windows上安装stable diffusion的最后一步执行webui-user.bat时,提示了错误信息AssertionError: Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check

具体错误代码如下:

venv "C:\Users\giray\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Commit hash: 67d011b
Traceback (most recent call last):
File "C:\Users\giray\stable-diffusion-webui\launch.py", line 110, in
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\giray\stable-diffusion-webui\launch.py", line 60, in run_python
return run(f'"{python}" -c "{code}"', desc, errdesc)
File "C:\Users\giray\stable-diffusion-webui\launch.py", line 54, in run
raise RuntimeError(message)
RuntimeError: Error running command.
Command: "C:\Users\giray\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:
stderr: Traceback (most recent call last):
File "", line 1, in
AssertionError: Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

解决方法

参考了github上的issue,需要修改webui-user.bat文件,具体更改如下:

COMMANDLINE_ARGS=
and change it to:
COMMANDLINE_ARGS= --lowvram --precision full --no-half --skip-torch-cuda-test

保存修改之后再次运行webui-user.bat就可以了。如果这个解决方法还没解决问题,可以查看同个issue下的其它回答,或者能找到解决方法。

参考链接

  1. Torch is not able to use GPU
  2. How to install Stable Diffusion on Windows (AUTOMATIC1111)
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/215888
推荐阅读
相关标签
  

闽ICP备14008679号