50系显卡使用stable-diffusion-webui进行AI画图时,提示RuntimeError: CUDA error_50系显卡 stable diffusion runtimeerror: cuda error: n
50系显卡,AI画图提示CUDA错误
50系显卡使用stable-diffusion-webui画图时提示 CUDA错误
RuntimeError: CUDA error: no kernel image is available for execution on the device CUDAkernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect. For debugging consider passing CUDA_LAUNCH_BLOCKING=1. Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions. Time taken: 0.6 sec.
前提配置 CUDA Toolkit Archive 和 cuDNN
**提前声明本机配置为 9600x+5060 **
pytorch不支持 CUDA128 解决方式
进入虚拟环境
# ${filepath}\\stable-diffusion-webui\\venv\\Scripts 1. cmd窗口启动虚拟环境 activate
cd ${fileLocal}\\stable-diffusion-webui\\venv\\Scriptsactivate
更新库文件
1. pip list# 查看虚拟环境中的python相关的库版本信息 以及依赖项
这里是本机更新后的版本信息 ,没有更新的话版本应该是比较老
需要和自己的CUDA信息一致
# 使用 nvcc -V 查看本地的CUDA信息nvcc -V # 本机的CUDATook 安装的是 128版本 需要和pytorch版本相对应
进行更新
# 要先删除对应的库文件 pip uninstall xformers torch torchvision torchaudio# 使用install安装库文件# 先安装 xformers 他会自动配置对应的 pytorch库信息pip install xformers# 指定安装 2.7.0的版本 CUDA128 切记 CUDA不一致可能不一样 建议查询官方文档后在进行操作pip install torch==2.7.0 torchvision==0.22.0 torchaudio==2.7.0 --index-url https://download.pytorch.org/whl/cu128
官方文档地址
xformers地址 文档有说明安装的方式,可以参考 。pytorch下载地址,这里因为没有看到和 xformers 0.0.30 匹配的pytorch2.7.0版本
pytorch最新的是 2.7.1 但是好像xformers最新版本0.30不兼容此新版本 2.7.1
验证
验证环境是否正常
# 在虚拟环境中进入python环境python>>>import torch>>>print(torch.__version__) #输出 2.7.0+cu128>>>print(torch.cuda.is_available()) #输出 True
显示内容正常的话就说明更新完毕
重新启动stable-diffusion-webui
webui.bat
就可以使用CUDA128进行画图了