1.下载conda官方包

这里我们需要在官网上查找自己需要的版本。

官方下载地址:https://repo.anaconda.com/archive/

这里以我自己安装的版本为例:

wget https://repo.anaconda.com/archive/Anaconda3-5.3.0-Linux-x86_64.sh

2.安装conda虚拟环境

运行conda虚拟环境sh安装命令,命令如下

chmod +x Anaconda3-5.3.0-Linux-x86_64.sh

./Anaconda3-5.3.0-Linux-x86_64.sh

3.创建并运行conda虚拟环境

conda create -n sd python=3.7 (sd 为环境名称,python为指定版本)

conda activate sd

4.创建并运行conda虚拟环境

torch包按照需要根据系统版本、显卡版本来选择,支持向下兼容,CUDA版本可以小于显卡版本。

安装命令:conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch

5.创建并运行conda虚拟环境

Webui项目中有requirements_versions.txt、requirements.txt两个依赖包管理文件,可以直接通过pip命令进行安装。

pip install -r requirements_versions.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

备注:pip默认下载源为国外,下载速度非常慢,可以通过-i指定国内镜像源。

6.下载xformes加速插件

在启动weubi时会提示No module ‘xformers’. Proceeding without it.错误。

pip install -U -I –no-deps xformers==0.0.20 -i https://pypi.tuna.tsinghua.edu.cn/simple

7.大模型下载

启动webui时会提示FileNotFoundError: No checkpoints found. When searching for checkpoints for Stable-diffusion.错误,需访问https://huggingface.co/手动下载Stable diffusion大模型。

8.下载open_clip插件

启动webui时提示AttributeError: module ‘open_clip’ has no attribute ‘transformer错误,需安装open_clip插件。

安装命令:pip install git+https://github.com/mlfoundations/open_clip.git –prefer-binary

9.下载google-perftools

启动weubi提示Cannot locate TCMalloc情况,需手动安装google-perftools安装包。

安装命令:sudo apt install –no-install-recommends google-perftools

10.torch导入异常情况

 torch 正常安装,在 python 中,调用 import torch 时,同样出现异常:

ImportError: cannot import name ‘_get_cpp_backtrace’ from ‘torch._C’。

重新安装 PyTorch 即可,即先查看并卸载 PyTorch,再安装。

安装完成之后测试命令:

import torch
print(torch.__version__)

import torchvision
print(torchvision.__version__)

11.下载clip模型

启动webui过程中会出现提示OSError: Can’t load tokenizer for ‘openai/clip-vit-large-patch14’.情况,这个报错是因为国内无法访问 huggingface ,导致脚本未能成功下载 CLIP 模型的参数。

访问:https://huggingface.co/openai/clip-vit-large-patch14/tree/main手动下载目录下的模型文件,上传服务器上。上传完成之后需要修改modules.py源码。

第一处:

第二处:

将其中 version=”openai/clip-vit-large-patch14″ 里的 clip-vit-large-patch14 路径替换为你放置 clip-vit-large-patch14 文件夹的路径。

12.屏蔽webui自动更新

启动webui会自动git pull远程项目地址来检查是否更新,提示RuntimeError: Couldn’t fetch assets. Command: “git” -C “/myyule/webui/stable-diffusion-webui/repositories/stable-diffusion-webui-assets” fetch –refetch –no-auto-gc异常。

需修改launch_utils.py源码屏蔽git自动更新。通过搜索git_clone关键字屏蔽git自动更新。

13.webui启动

启动命令:nohup python launch.py –port 8762 –listen –share > output.log 2>&1 &

查看进程:ps -ef|grep python

日志文件:日志文件位于webui根目录下的output.log文件中。

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注