Stable diffusion Web UI环境部署搭建

1、安装Nvidia驱动、cuda版本等

2、安装anaconda环境

3、安装git


4、下载源码和模型参数文件

#1、下载源码
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
#2、下载模型参数文件,以下示例为v1.4版本,大约7GB
wget https://***-bj.tos-cn-beijing.volces.com/sd-v1-4-full-ema.ckpt
#3、设置模型参数存放位置
#将下载的模型参数文件改名为 model.ckpt 并放在 Stable-diffusion 目录下
ln -s ln -s /root/sd-v1-4-full-ema.ckpt /root/stable-diffusion-webui/models/Stable-diffusion/model.ckpt

5、Anaconda创建虚拟环境

#切换清华源,便于后续生成环境,下载python包 
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

//开了FT的只开github的加速,不开http/https代理

#进入之前的源码解压目录
cd stable-diffusion-webui
conda env create -f environment-wsl2.yaml
conda activate automatic

6、运行web.sh

#修改 can_run_as_root 从0改成 1,允许root权限运行
vim webui.sh  

#./webui.sh --share
(automatic) root@iv-yc5px7gju72udbdhx52r:~/stable-diffusion-webui# ./webui.sh --share

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################

################################################################
Running on root user
################################################################

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
Create and activate python venv
################################################################

################################################################
Launching launch.py...
################################################################
Python 3.9.12 (main, Apr  5 2022, 06:56:58)
[GCC 7.5.0]
Commit hash: cca6e5212ddd77be7efdce2c27e475d3af436d85
Installing torch and torchvision
Installing gfpgan
Installing clip
Installing open_clip
Cloning Stable Diffusion into repositories/stable-diffusion-stability-ai...
Cloning Taming Transformers into repositories/taming-transformers...
Cloning K-diffusion into repositories/k-diffusion...
Cloning CodeFormer into repositories/CodeFormer...
Cloning BLIP into repositories/BLIP...
Installing requirements for CodeFormer
Installing requirements for Web UI
Launching Web UI with arguments: --share
No module 'xformers'. Proceeding without it.
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Loading weights [06c50424] from /root/stable-diffusion-webui/models/Stable-diffusion/model.ckpt
Applying cross attention optimization (Doggettx).
Textual inversion embeddings loaded(0):
Model loaded.
Running on local URL:  http://127.0.0.1:7860
Running on public URL: https://e7b6d156-c1cd-487c.gradio.live

This share link expires in 72 hours. For free permanent hosting and GPU upgrades (NEW!), check out Spaces: https://huggingface.co/spaces
100%|██████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:02<00:00,  7.89it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:01<00:00, 12.41it/s]
100%|██████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:01<00:00, 12.75it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:01<00:00, 12.21it/s]
100%|██████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:01<00:00, 12.45it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:01<00:00, 12.00it/s]
100%|██████████████████████████████████████████████████████████████████████████████████████████████████| 20/20 [00:01<00:00, 12.69it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:01<00:00, 12.18it/s]

7、打开URL链接

#https://e7b6d156-c1cd-487c.gradio.live/ 打开页面如下图所示

你可能感兴趣的:(stable,diffusion)