解决在Windows安装stable diffusion遇到“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

解决方法

参考了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)
  • 12
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 17
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 17
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值