欢迎关注我的CSDN:https://spike.blog.csdn.net/
本文地址:https://blog.csdn.net/caroline_wendy/article/details/131524075
版本v2.5.41
Stable Diffusion 图像生成工具是一种基于深度学习的技术,可以从随机噪声中生成高质量的图像,利用 Diffusion Probabilistic Models 的概率模型,逐步地将噪声转化为目标图像,同时保持图像的稳定性和多样性。Stable Diffusion 图像生成工具的优点是,不需要预先训练一个生成器网络,而是可以直接从数据分布中采样图像,也可以适应不同的图像域,例如人脸、动物、风景等。Stable Diffusion 图像生成工具是一种创新的图像合成技术,可以为各种应用场景提供高效和实用的解决方案。
-
安装网页:https://stable-diffusion-ui.github.io/docs/installation/
-
GitHub:https://github.com/AUTOMATIC1111/stable-diffusion-webui
在系统中,需要包含 conda 环境,不需要额外创建,在运行过程中,在文件夹中,就会创建默认的环境。
软件下载路径:
- 下载
Easy-Diffusion-Linux
压缩包。 - 解压压缩包,
cd easy-diffusion
。 - 运行
bash start.sh
。
### Linux
1. [**Download** for Linux](https://github.com/cmdr2/stable-diffusion-ui/releases/download/v2.5.24/Easy-Diffusion-Linux.zip)
2. Extract:
- Extract the file with your favourite file manager, or use `unzip Easy-Diffusion-Linux.zip` in a terminal.
- After extracting the .zip file, please open a terminal, and go to the `easy-diffusion` directory.
3. Run:
- In the terminal, run `./start.sh` (or `bash start.sh`)
This will automatically install Easy Diffusion, set it up, and start the interface. No additional steps are needed.
执行 bash start.sh
,开始安装环境,遇到 Git 工程无法下载,手动下载即可。需要注意的点,如下:
- 因国内网速问题,部分包无法安装,需要手动安装,参考Bug 2~5。
- GitHub 工程无法下载,也需要手动下载,建议使用
git ssh
方式。 - GitHub 模型无法下载,手动下载之后,放入相应的文件夹,即
easy-diffusion/models
,具体参考源码。
遇到 Bug,则需要重新安装 Python 包,先激活 Conda 环境 conda activate easy-diffusion/installer_files/env
,再安装相应的 Python 包,即可。
conda activate stable_diffusion/easy-diffusion/installer_files/env
pip install facexlib==0.3.0 tb-nightly==2.14.0a20230702 sdkit==1.0.112 xformers==0.0.20 -i https://mirrors.aliyun.com/pypi/simple
模型手动下载地址,参考 stable-diffusion-webui 源码:
# codeformer
https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/codeformer.pth
# gfpgan, gfpgan_model.py
https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.4.pth
# realesrgan, realesrgan_model.py
https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-general-x4v3.pth
https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-general-wdn-x4v3.pth
https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-animevideov3.pth
https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth
https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth
https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.1/RealESRGAN_x2plus.pth
# ESRGAN, esrgan_model.py
https://github.com/cszn/KAIR/releases/download/v1.0/ESRGAN.pth
# midas, d_models.py
# dpt_large
https://github.com/intel-isl/DPT/releases/download/1_0/dpt_large-midas-2f21e586.pt
# dpt_hybrid
https://github.com/intel-isl/DPT/releases/download/1_0/dpt_hybrid-midas-501f0c75.pt
# midas_v21
https://github.com/AlexeyAB/MiDaS/releases/download/midas_dpt/midas_v21-f6b98070.pt
# midas_v21_small
https://github.com/AlexeyAB/MiDaS/releases/download/midas_dpt/midas_v21_small-70d6b9c8.pt
Bug1: 遇到 Bug “Failed to connect to github.com port 443: Connection timed out”
即:
fatal: unable to access 'https://github.com/cmdr2/stable-diffusion-ui.git/': Failed to connect to github.com port 443: Connection timed out
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
ERROR: git clone failed
Error downloading Stable Diffusion UI. Sorry about that, please try to:
1. Run this installer again.
2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting
3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB
4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues
Thanks!
位于:on_env_start.sh
脚本,进入 easy-diffusion/scripts
文件夹,手动下载 https://github.com/cmdr2/stable-diffusion-ui.git/,即可,推荐使用 git ssh
下载
git clone git@github.com:easydiffusion/easydiffusion.git
Bug2: 遇到 Bug “No module named facexlib”
这个问题,在安装sdkit时,也会遇到,即:
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [17 lines of output]
Traceback (most recent call last):
File "/tmp/pip-install-ftrx1th1/gfpgan_051d13278c764431bd5491fa888528ee/setup.py", line 48, in get_hash
from facexlib.version import __version__
ModuleNotFoundError: No module named 'facexlib'
...
直接手动安装即可,即pip install facexlib==0.3.0
Bug3: 遇到 Bug “gfpgan 1.3.8 depends on tb-nightly”
切换安装源至 aliyun
即可:
pip install tb-nightly==2.14.0a20230702 -i https://mirrors.aliyun.com/pypi/simple
Bug4:遇到 Bug “No module named sdkit”
这个是关键安装包,即
File "easy-diffusion/ui/easydiffusion/utils/save_utils.py", line 10, in <module>
from sdkit.utils import save_dicts, save_images
ModuleNotFoundError: No module named 'sdkit'
先安装facexlib
和tb-nightly
,再直接 pip install sdkit==1.0.112
,即可。
Bug5: 遇到 Bug “No module ‘xformers’. Proceeding without it.”
即
No module 'xformers'. Proceeding without it.
切换安装源至 aliyun
即可:
pip install xformers==0.0.20 -i https://mirrors.aliyun.com/pypi/simple
运行成功,日志如下:
21:25:07.312 INFO cuda:1 Global seed set to 0 seed.py:65
Sampling: 0%| | 0/1 [00:00<?, ?it/s]21:25:07.484 INFO cuda:1 seeds used = [0] sampler_main.py:64
100%|████████████████████████████████████████████████████████| 25/25 [00:01<00:00, 22.85it/s]
Sampling: 100%|████████████████████████████████████████████████| 1/1 [00:01<00:00, 1.53s/it]
21:25:09.258 INFO cuda:1 Task completed renderer.py:73
21:25:09.507 INFO cuda:1 Session 1688389496479 task 139918897684288 task_manager.py:367
completed by NVIDIA A100-SXM4-80GB.
输出测试图像,如下:
参考:
-
知乎 - Anaconda-用conda创建python虚拟环境
-
How to fix “ModuleNotFoundError: No module named ‘facexlib’”
-
Bilibili - 新版stable-diffusion-webui安装的补充说明
-
CSDN - No module ‘xformers‘. Proceeding without it.
-
AI图片生成Stable Diffusion环境搭建与运行