解决stable-diffusion-webui时的问题:No module ‘xformers‘. Proceeding without it

p.s 被另一篇文章坑了,装个xformers把我原先的pytorch降智了&%$^#

注意:!!!xformers非强制安装;可优化显存,提高性能和出图速率,对于GPU能力有限的用户很有用;安装过程会调整pytorch版本以适配xformers安装版本。过高版本的xformers可能会引起兼容性问题

被坑后总结的方法:

stable-diffusion-webui/venv/Scripts目录下进入terminal,输入activate激活stable diffusion创建的虚拟环境,然后使用:

pip install xformers==x.x.x

xformers同pytorch的版本对应关系:

py 复制代码
# 进入sd虚拟python环境查看
import torch # 如果pytorch安装成功即可导入
print(torch.__version__) # 查看pytorch版本
print(torch.cuda.is_available()) # 查看CUDA是否可用
print(torch.cuda.device_count()) # 查看可用的CUDA数量
print(torch.version.cuda) # 查看CUDA的版本号

详细可查 https://github.com/facebookresearch/xformers/tags

例如我的pytorch是2.1.2+cu121版本,根据github文档这里我下载的便是v0.0.23.post1

提供一些参考:

可能的问题:

  • 如果出现长路径不支持的警告
    ERROR: Could not install packages due to an OSError: Errno 2 No such file or directory...HINT: This error might have occurred since this system does not have Windows Long Path support enabled. You can find information on how to enable this at https://pip.pypa.io/warnings/enable-long-paths

参照这篇文章设置:

https://www.cnblogs.com/sugarwxx/p/17804888.html

win11:

Win +R 打开运行 输入 gpedit.msc 》计算机配置》管理模板=》系统=》文件系统=》双击启用Win32长路径=》选择启用

相关推荐
三无推导3 天前
ComfyUI 安装部署教程:Windows 下快速搭建可视化 AI 绘图工作流,零基础也能跑通
人工智能·pytorch·windows·stable diffusion·aigc·ai绘画·持续部署
code_pgf3 天前
ViT 与 MAE 在图像特征提取方面的优势详解
人工智能·stable diffusion
code_pgf3 天前
多模态技术在主要 AI 应用领域中的应用分析与工程落地建议
人工智能·stable diffusion
程序员大辉4 天前
Z-Image迷你整合包:只有10G大小,5G小显存也能跑的Stable Diffusion文生图工具
stable diffusion·文生图·sd·z-image
嗝o゚6 天前
昇腾CANN cann-recipes-infer 仓:Stable Diffusion 推理加速方案
人工智能·stable diffusion·cann
菜鸟是大神6 天前
04-高效编写CLAUDE.md
数据库·chatgpt·ai作画·stable diffusion·文心一言·dall·e 2
Rocky Ding*9 天前
昔日AI绘画框架王者Stable Diffusion WebUI,已死
人工智能·深度学习·机器学习·chatgpt·ai作画·stable diffusion·aigc
艾古力斯9 天前
比迪丽AI绘画模型Python爬虫实战:自动化采集艺术素材
stable diffusion·ai绘画·python爬虫
风落无尘10 天前
Stable Diffusion WebUI & ComfyUI 完整安装教程:官方部署+一键整合包+Docker容器化(2026最新)
docker·容器·stable diffusion
code_pgf11 天前
Stable-Diffusion模型中常见 Stable Diffusion Sampling 方法
人工智能·stable diffusion