stable-diffusion-webui的安装教程 ubuntu

自动安装

  1. 先clone代码:
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
  1. 要在不创建虚拟环境的情况下通过 pip 安装所需的包,运行:
python launch.py

手动安装

手动安装虽有些过时,但在自动安装遇到问题的时候只能用手动安装了,我的自动安装就偶尔遇到git clone超时的问题。

  1. 安装支持CUDA的torch
pip install torch --extra-index-url https://download.pytorch.org/whl/cu113
  1. 检查一下torch是否支持gpu
python -c "import torch; print(torch.cuda.is_available())"
  1. 克隆webui的代码
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui
  1. 克隆SD和CodeFormer的储存库
mkdir repositories
git clone https://github.com/CompVis/stable-diffusion.git repositories/stable-diffusion
git clone https://github.com/CompVis/taming-transformers.git repositories/taming-transformers
git clone https://github.com/sczhou/CodeFormer.git repositories/CodeFormer
git clone https://github.com/salesforce/BLIP.git repositories/BLIP
  1. 安装SD所需的库
pip install transformers==4.19.2 diffusers invisible-watermark --prefer-binary
  1. 安装k-diffusion
pip install git+https://github.com/crowsonkb/k-diffusion.git --prefer-binary
  1. (可选)安装GFPGAN(面部修复)
pip install git+https://github.com/TencentARC/GFPGAN.git --prefer-binary
  1. (可选)安装CodeFormer所需的库(面部修复)
pip install -r repositories/CodeFormer/requirements.txt --prefer-binary
  1. 安装webui所需的库
pip install -r requirements.txt  --prefer-binary
  1. 更新numpy到最新版本
pip install -U numpy  --prefer-binary
  1. 把SD的模型放到webui的models文件夹中

安装完以上步骤,打开webui:

python webui.py

碰到的问题及解决方案:

    resolved_obj = getattr(resolved_obj, attr_name)
AttributeError: module 'open_clip' has no attribute 'transformer'

如果碰到open_clip no transformer的问题
解决方案:
从源码安装open_clip:

pip install git+https://github.com/mlfoundations/open_clip.git --prefer-binary

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
心中带点小风骚的头像心中带点小风骚普通用户
上一篇 2023年12月5日
下一篇 2023年12月5日

相关推荐