从零开始实现Stable Diffusion本地部署

1. 依赖安装

文件打包下载地址(Stable Diffusion)

sh 复制代码
# git : 用于下载源码
https://git-scm.com/downloads/win
# Python 作为基础编译环境
https://www.python.org/downloads/
# Nvidia 驱动,用于编译使用GPU显卡硬件
https://www.nvidia.com/en-us/drivers/
# Cuda 用于编译运行GPU的程序软件
https://developer.nvidia.com/cuda-toolkit-archive
# cuDNN 用于深度神经网络相关大模型的GPU加速库
https://developer.nvidia.com/cudnn-downloads
# Pytorch 用于构建和训练深度学习模型
# pip3 install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128
https://pytorch.org/get-started/locally/


2. Stable Diffusion安装

bash 复制代码
# 下载本地网页
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
# 下载模型 Stable-diffusion
https://huggingface.co/stabilityai/stable-diffusion-3.5-large
# 模型放入:stable-diffusion-webui\models\Stable-diffusion
# stable-diffusion-webui 目录下双击 webui.bat 启动

3. 使用体验

浏览器打开 http://127.0.0.1:7860

3.1 基础使用
  • 正向提示词:描述你想要的画面,如:(best quality), 1girl, in a garden, sunlight, flowers, smiling

  • 反向提示词:排除不想要的内容,如:(worst quality, low quality), deformed hands, extra fingers

  • 参数设置:

    • 采样步数(Steps):20~30
    • 图片尺寸(Width/Height):512x512 或 768x768
    • 生成数量(Batch count):1
  • 点击"Generate"生成, 图片保存在 outputs\txt2img-images 文件夹。

3.2 进阶调试
  • 如果显存不足(报错 CUDA out of memory):
    • 降低图片尺寸(如 512x512 → 480x640)
    • 在启动器 → "高级选项" → 勾选 xformers 和 低显存模式
    • 使用优化模型(如 RealisticVision)
    • 在启动命令中添加 --medvram 参数:python launch.py --medvram
  • 安装插件
    在 WebUI 的 Extensions 选项卡 → Available → 点击"Load from URL" → 输入插件 GitHub 地址 → 安装:
    • ControlNet:控制人物姿势/构图
    • Additional Networks:融合多个模型风格
  • 中文汉化
    启动器 → "扩展" → 搜索 zh_CN → 安装汉化包 → 重启 WebUI。
相关推荐
我希望的一路生花4 天前
Nik Collection 6.2全新版Nik降噪锐化调色PS/LR插件
人工智能·计算机视觉·设计模式·stable diffusion·aigc
GetcharZp4 天前
玩转AI绘画,你只差一个节点式“魔法”工具——ComfyUI 保姆级入门指南
人工智能·stable diffusion
爱分享的飘哥5 天前
第八十三章:实战篇:文 → 图:Prompt 控制图像生成系统构建——从“咒语”到“神作”的炼成!
人工智能·计算机视觉·prompt·文生图·stablediffusion·diffusers·text-to-image
Seeklike6 天前
diffuxers学习--AutoPipeline
人工智能·python·stable diffusion·diffusers
游戏AI研究所6 天前
ComfyUI 里的 Prompt 插值器(prompt interpolation / text encoder 插值方式)的含义和作用!
人工智能·游戏·机器学习·stable diffusion·prompt·aigc
迈火9 天前
ComfyUI-3D-Pack:3D创作的AI神器
人工智能·gpt·3d·ai·stable diffusion·aigc·midjourney
Seeklike10 天前
diffusers学习--stable diffusion的管线解析
人工智能·stable diffusion·diffusers
马甲是掉不了一点的<.<10 天前
Stable Diffusion 环境配置详细指南
stable diffusion·环境配置
软件测试-阿涛10 天前
【AI绘画】Stable Diffusion webUI 常用功能使用技巧
人工智能·深度学习·计算机视觉·ai作画·stable diffusion
m0_6038887111 天前
Stable Diffusion Models are Secretly Good at Visual In-Context Learning
人工智能·ai·stable diffusion·论文速览