Stable Diffusion:在服务器上部署使用Stable Diffusion WebUI进行AI绘图(v2.0)

Qwen3-32B-Chat 私有部署镜像 | RTX4090D 24G 显存 CUDA12.4 优化版

本镜像基于 RTX 4090D 24GB 显存 + CUDA 12.4 + 驱动 550.90.07 深度优化,内置完整运行环境与 Qwen3-32B 模型依赖,开箱即用。

在这里插入图片描述
在这里插入图片描述

前言

环境要求

Package                   Version
------------------------- ------------------
Python                    3.10.6
absl-py                   2.3.1
accelerate                0.21.0
addict                    2.4.0
aenum                     3.1.16
aiofiles                  23.2.1
aiohappyeyeballs          2.6.1
aiohttp                   3.12.14
aiosignal                 1.4.0
albumentations            1.4.3
altair                    5.5.0
antlr4-python3-runtime    4.9.3
anyio                     3.7.1
async-timeout             5.0.1
attrs                     25.3.0
blendmodes                2022
certifi                   2025.7.14
cffi                      1.17.1
charset-normalizer        3.4.2
clean-fid                 0.1.35
click                     8.2.1
clip                      1.0
colorama                  0.4.6
colorlog                  6.9.0
contourpy                 1.3.2
controlnet_aux            0.0.10
cssselect2                0.8.0
cycler                    0.12.1
Cython                    3.1.2
deprecation               2.1.0
depth_anything            2024.1.22.0
depth_anything_v2         2024.7.1.0
diffusers                 0.31.0
diskcache                 5.6.3
dsine                     2024.3.23
easydict                  1.13
einops                    0.4.1
exceptiongroup            1.3.0
facexlib                  0.3.0
fastapi                   0.94.0
ffmpy                     0.6.1
filelock                  3.18.0
filterpy                  1.4.5
flatbuffers               25.2.10
fonttools                 4.59.0
frozenlist                1.7.0
fsspec                    2025.7.0
ftfy                      6.3.1
fvcore                    0.1.5.post20221221
geffnet                   1.0.2
gitdb                     4.0.12
GitPython                 3.1.32
glob2                     0.5
gradio                    3.41.2
gradio_client             0.5.0
h11                       0.12.0
handrefinerportable       2024.2.12.0
httpcore                  0.15.0
httpx                     0.24.1
huggingface-hub           0.33.4
hydra-core                1.3.2
idna                      3.10
imageio                   2.37.0
importlib_metadata        8.7.0
importlib_resources       6.5.2
inflection                0.5.1
insightface               0.7.3
iopath                    0.1.9
jax                       0.6.2
jaxlib                    0.6.2
Jinja2                    3.1.6
joblib                    1.5.1
jsonmerge                 1.8.0
jsonschema                4.25.0
jsonschema-specifications 2025.4.1
kiwisolver                1.4.8
kornia                    0.6.7
lark                      1.1.2
lazy_loader               0.4
lightning-utilities       0.14.3
llvmlite                  0.44.0
loguru                    0.7.3
lxml                      6.0.0
manifold3d                3.2.0
mapbox_earcut             1.0.3
MarkupSafe                2.1.5
matplotlib                3.10.3
mediapipe                 0.10.21
ml_dtypes                 0.5.1
modelscope                1.28.0
mpmath                    1.3.0
multidict                 6.6.3
narwhals                  1.48.0
networkx                  3.4.2
numba                     0.61.2
numpy                     1.26.2
omegaconf                 2.2.3
onnx                      1.18.0
onnxruntime               1.22.1
open-clip-torch           2.20.0
opencv-contrib-python     4.11.0.86
opencv-python             4.11.0.86
opencv-python-headless    4.12.0.88
opt_einsum                3.4.0
orjson                    3.11.0
packaging                 25.0
pandas                    2.3.1
piexif                    1.1.3
Pillow                    9.5.0
pillow-avif-plugin        1.4.3
pip                       25.1
platformdirs              4.3.8
portalocker               3.2.0
prettytable               3.16.0
propcache                 0.3.2
protobuf                  3.20.0
psutil                    5.9.5
pycollada                 0.9.2
pycparser                 2.22
pydantic                  1.10.17
pydub                     0.25.1
pyparsing                 3.2.3
python-dateutil           2.9.0.post0
python-multipart          0.0.20
pytorch-lightning         1.9.4
pytz                      2025.2
PyWavelets                1.8.0
pywin32                   311
PyYAML                    6.0.2
referencing               0.36.2
regex                     2024.11.6
reportlab                 4.4.3
requests                  2.32.4
resize-right              0.0.2
rich                      14.1.0
rpds-py                   0.26.0
rtree                     1.4.0
safetensors               0.4.2
scikit-image              0.21.0
scikit-learn              1.7.1
scipy                     1.15.3
segment-anything          1.0
semantic-version          2.10.0
sentencepiece             0.2.0
setuptools                69.5.1
shapely                   2.1.1
six                       1.17.0
smmap                     5.0.2
sniffio                   1.3.1
sounddevice               0.5.2
spandrel                  0.3.4
spandrel_extra_arches     0.1.1
starlette                 0.26.1
svg.path                  7.0
svglib                    1.5.1
sympy                     1.13.1
tabulate                  0.9.0
termcolor                 3.1.0
threadpoolctl             3.6.0
tifffile                  2025.5.10
timm                      0.9.5
tinycss2                  1.4.0
tokenizers                0.13.3
tomesd                    0.1.3
tomli                     2.2.1
torch                     2.4.0+cu118
torchao                   0.12.0
torchaudio                2.4.0+cu118
torchdiffeq               0.2.3
torchmetrics              1.8.0
torchsde                  0.2.6
torchvision               0.19.0+cu118
tqdm                      4.67.1
trampoline                0.1.2
transformers              4.30.2
trimesh                   4.7.1
typing_extensions         4.14.1
tzdata                    2025.2
ultralytics               8.3.170
urllib3                   2.5.0
uvicorn                   0.35.0
vhacdx                    0.0.8.post2
wcwidth                   0.2.13
webencodings              0.5.1
websockets                11.0.3
wheel                     0.45.1
win32_setctime            1.2.0
xformers                  0.0.27.post2+cu118
xxhash                    3.5.0
yacs                      0.1.8
yapf                      0.43.0
yarl                      1.20.1
zipp                      3.23.0

相关介绍

  • Python是一种跨平台的计算机程序设计语言。是一个高层次的结合了解释性、编译性、互动性和面向对象的脚本语言。最初被设计用于编写自动化脚本(shell),随着版本的不断更新和语言新功能的添加,越多被用于独立的、大型项目的开发。
  • PyTorch 是一个深度学习框架,封装好了很多网络和深度学习相关的工具方便我们调用,而不用我们一个个去单独写了。它分为 CPU 和 GPU 版本,其他框架还有 TensorFlow、Caffe 等。PyTorch 是由 Facebook 人工智能研究院(FAIR)基于 Torch 推出的,它是一个基于 Python 的可续计算包,提供两个高级功能:1、具有强大的 GPU 加速的张量计算(如 NumPy);2、构建深度神经网络时的自动微分机制。
  • AIGC(人工智能生成内容)是指由人工智能系统创建或生成的内容。它涉及使用人工智能技术,如机器学习、自然语言处理和计算机视觉,生成各种形式的内容,包括文本、图像、视频、音乐等。
  • 稳定扩散(Stable Diffusion)是一种用于概率建模和图像处理的方法。它基于扩散过程的理论,旨在对图像进行平滑和去噪处理,同时保持重要的图像结构和细节。
  • 稳定扩散方法通过在图像上应用非线性扩散算子来实现平滑和去噪。与传统的线性扩散方法不同,稳定扩散引入了非线性项,以更好地保留图像的边缘和细节。
  • 稳定扩散的核心思想是在扩散过程中考虑梯度信息,并根据梯度大小和方向来调整扩散速度。这样可以在平滑图像的同时,有效地抑制边缘的模糊和细节的丢失。
  • 稳定扩散方法在图像去噪、边缘保持、纹理增强等方面具有广泛应用。它提供了一种平衡平滑和保持图像结构的方法,可以应用于计算机视觉、图像处理和模式识别等领域。
  • LoRA模型全称是:Low-Rank Adaptation of Large Language Models,可以理解为Stable-Diffusion中的一个插件,仅需要少量的数据就可以进行训练的一种模型。
  • LoRA模型可以用于大语言模型的微调,可以用来降低微调成本。
  • LoRA模型可以和大模型结合使用,干涉大模型产生的结果。
  • LoRA采用的方式是向原有的模型中插入新的数据处理层,从而避免了去修改原有的模型参数,从而避免将整个模型进行拷贝的情况,同时其也优化了插入层的参数量,最终实现了一种很轻量化的模型调校方法。
  • LoRA建议冻结预训练模型的权重并在每个Transformer块中注入可训练层(秩-分解矩阵)。 LoRA还可以用于Stable-diffusion中的交叉关注层,从而改善用文字生成图片的效果。
  • LoRA模型的个头都比较小,常见的都是144MB左右,使用的时候要与精简版(prund)的Stable Diffusion1.5模型配合使用。

部署使用Stable Diffusion WebUI

下载Stable Diffusion WebUI项目

  • 官方源地址:https://github.com/AUTOMATIC1111/stable-diffusion-webui.git

Windows

在这里插入图片描述

下载解压后,项目目录,如下图所示。
在这里插入图片描述

Linux

git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git

安装Stable Diffusion WebUI项目

  1. 打开终端并导航到所需的安装目录。
    进入kohya_ss目录:
cd stable-diffusion-webui/
  1. 执行如下命令运行setup脚本:
# CUDA 11.8
pip install torch==2.4.0 torchvision==0.19.0 torchaudio==2.4.0 --index-url https://download.pytorch.org/whl/cu118
# win
# pip install torch-2.4.0+cu118-cp310-cp310-win_amd64.whl -i https://mirrors.aliyun.com/pypi/simple
# pip install torchvision-0.19.0+cu118-cp310-cp310-win_amd64.whl -i https://mirrors.aliyun.com/pypi/simple
# pip install torchaudio-2.4.0+cu118-cp310-cp310-win_amd64.whl -i https://mirrors.aliyun.com/pypi/simple
# linux
# pip install torch-2.4.0+cu118-cp310-cp310-linux_x86_64.whl -i https://mirrors.aliyun.com/pypi/simple
# pip install torchvision-0.19.0+cu118-cp310-cp310-linux_x86_64.whl -i https://mirrors.aliyun.com/pypi/simple
# pip install torchaudio-2.4.0+cu118-cp310-cp310-linux_x86_64.whl -i https://mirrors.aliyun.com/pypi/simple

pip install xformers==0.0.27.post2+cu118 --index-url https://download.pytorch.org/whl/cu118

pip install torchao -i https://mirrors.aliyun.com/pypi/simple

# 设计缺省安装源,如全局已设置,可不需要
# pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
 
#安装项目其它依赖包
pip install -r requirements_versions.txt -i https://mirrors.aliyun.com/pypi/simple
pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple --no-deps
pip install CLIP --index-url https://pypi.mirrors.ustc.edu.cn/simple

如果没有报错,则安装成功。

运行Stable Diffusion WebUI项目

在终端中运行它,命令如下:

python launch.py --listen --enable-insecure-extension-access --port 7860

在这里插入图片描述

运行成功后,可在浏览器输入http://127.0.0.1:7860/打开,如下图所示。
在这里插入图片描述
运行成功后,可在浏览器输入http://127.0.0.1:7860/打开,如下图所示。

注:详细使用教程可查阅此项目中的README.md文件

AI绘图

文生图(txt2img)

1boy, bandages, black background, black jacket, blue eyes, gojou satoru, hand up, jacket, jujutsu kaisen, looking at viewer, male focus, parted lips, s0311 tre, short hair, simple background, solo, twitter username, upper body, white hair, wind

在这里插入图片描述

图生图(img2img)

局部重绘

1boy, wearing  glasses, 4k

在这里插入图片描述

注:更多玩法,自行探索!需要使用自己的数据集微调LoRA模型的,可查阅Stable Diffusion:使用自己的数据集微调训练LoRA模型(v2.0)

您可能感兴趣的与本文相关的镜像

Qwen3-32B-Chat 私有部署镜像 | RTX4090D 24G 显存 CUDA12.4 优化版

Qwen3-32B-Chat 私有部署镜像 | RTX4090D 24G 显存 CUDA12.4 优化版

Qwen
文本生成
Qwen3

本镜像基于 RTX 4090D 24GB 显存 + CUDA 12.4 + 驱动 550.90.07 深度优化,内置完整运行环境与 Qwen3-32B 模型依赖,开箱即用。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

FriendshipT

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值