解决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长路径=》选择启用

相关推荐
北上ing8 小时前
从FP32到BF16,再到混合精度的全景解析
人工智能·pytorch·深度学习·计算机视觉·stable diffusion
源客z1 天前
搭建Stable Diffusion图像生成系统实现通过网址访问(Ngrok+Flask实现项目系统公网测试,轻量易部署)
stable diffusion
源客z2 天前
搭建 Stable Diffusion 图像生成系统并通过 Ngrok 暴露到公网(实现本地系统网络访问)——项目记录
stable diffusion
朴拙数科4 天前
Stable Diffusion秋叶整合包V4独立版Python本地API连接指南
开发语言·python·stable diffusion
璇转的鱼5 天前
爆肝整理!Stable Diffusion的完全使用手册(二)
人工智能·ai作画·stable diffusion·aigc
曲幽6 天前
Stable Diffusion LoRA模型加载实现风格自由
python·ai·stable diffusion·lora·文生图·diffusers
nan_black8 天前
在Pycharm配置stable diffusion环境(使用conda虚拟环境)
stable diffusion·pycharm·conda
AI绘画咪酱8 天前
Stable Diffusion【进阶篇】:如何实现人脸一致
人工智能·深度学习·学习·机器学习·ai作画·stable diffusion
AIGC-Lison9 天前
AI绘画SD中,如何保持生成人物角色脸部一致?Stable Diffusion精准控制AI人像一致性两种实用方法教程!
人工智能·ai作画·stable diffusion·midjourney·sd
AI绘画咪酱10 天前
SD教程|巧用Stable Diffusion,实现不同风格的LOGO设计|实战篇幅,建议收藏!
人工智能·学习·ai作画·stable diffusion·sd