stable diffusion 安装xFormers 报错:Couldn‘t install open_clip.

 一、No module ‘xformers’. Proceeding without it.

这是因为没有安装xformers导致的。
解决办法:
在webui-user.bat文件这添加一行:

set COMMANDLINE_ARGS=--xformers

如下图所示:

试着点击webui-user.bat,看能否下载,如果等了很久报错了,是网络问题,需要科学,但是科学你开全局也没有用

解决方法:我使用的是有蓝色的猫的软件。步骤如下:

(1)打开webui中的launch.py文件,找到prepare_enviroment()函数部分,在下图画圈部分的网址https://github.com前面添加https://ghproxy.com/,然后保存文件。

然后试着点击webui-user.bat,看能否下载,如果不能,继续执行(2)和(3)。(我是不行的)
(2)开启服务模式,若开启服务模式报错,请参考第五节
(3)然后开启TUN模式

 然后再次点击webui-user.bat,运行一段时间,就能够成功安装这些包了,如下图所示:

二、Couldn’t install requirements for Web UI
翻看报错日志发现是出现如下错误:

No matching distribution found for gradio==3.23

然后发现它使用的是国内的源,所以这个错误的原因就是当前的源找不到这个版本的包。
解决办法: 换其他的源

在launch.py文件中找到run_pip函数,在命令后添加:

--trusted-host 信任的主机地址 -i 源地址

如下图:

常见的源:
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/

三、v1-5-pruned-emaonly.safetensors没有下载完全就出错

解决办法:从huggingface.co/CompVis/stable-diffusion-v-1-4-original/tree/main这个网站下载Stable Diffusion的权重文件,然后放在models/Stable Diffusion,权重文件如下:

 

 

四、GPU显存问题

电脑显存只有3G,第一次跑的时候出现了如下错误:

OutOfMemoryException

解决办法:在webui-user.bat文件中添加–lowvram这个语句,即:

set COMMANDLINE_ARGS=--xformers --lowvram

如下图:

 

它适用于显存不到2G的。

五、服务模式 无法安装

Windows

先确定系统安装了.NET framework runtime

然后尝试手动安装:

  1. 打开 C:/Program Files 目录,新建 Clash for Windows Service 目录
  2. 进入 安装目录/resources/static/files/win/[x64|arm64|ia32]/service 目录,拷贝里面两个 exe 文件到 1 中新建目录中
  3. 进入 安装目录/resources/static/files/win/common 目录,拷贝 service.yml 文件到 1 中新建目录中
  4. 在 1 中新建目录中,使用管理员权限打开 CMD 执行一下命令:
    service.exe install
    service.exe start
    

如果 install 时出现如下提示:

Service with id 'Clash Core Service' already exists
To install the service, delete the existing one or change service Id in the configuration file
2022-09-26 09:37:32,316 FATAL - Unhandled exception
System.Exception: Installation failure: Service with id 'Clash Core Service' already exists
   at WinSW.Program.<Run>g__Install|2_0(<>c__DisplayClass2_0& )
   at WinSW.Program.Run(String[] argsArray, IWinSWConfiguration descriptor)
   at WinSW.Program.Main(String[] args)
System.Exception: Installation failure: Service with id 'Clash Core Service' already exists
   at WinSW.Program.<Run>g__Install|2_0(<>c__DisplayClass2_0& )
   at WinSW.Program.Run(String[] argsArray, IWinSWConfiguration descriptor)
   at WinSW.Program.Main(String[] args)

可以先执行:

service.exe stop
service.exe uninstall

如果安装后,Service Mode manage 里显示 active 但图标显示红色,可以进入 Home Directory 管理员启动 CMD,执行 icacls.exe service /remove:d Everyone 后手动删除 service 文件夹,重启 APP 即可

macOS

  1. 打开终端
  2. 运行以下命令:
    curl https://gist.githubusercontent.com/Fndroid/2119fcb5ccb5a543a8f6a609418ae43f/raw/ff63615309a9b3f3e1d682fc29bc73284816422e/mac.sh > cfw-tun.sh && chmod +x cfw-tun.sh && sudo ./cfw-tun.sh install && rm cfw-tun.sh
    

    如要卸载则将 install 改为 uninstall

 

物联沃分享整理
物联沃-IOTWORD物联网 » stable diffusion 安装xFormers 报错:Couldn‘t install open_clip.

发表评论