从零开始实现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。
相关推荐
Eric.461 天前
2026 AI 漫剧叙事可控性深度工程:解决逻辑崩坏、镜头错乱、道具漂移的高阶落地方案
人工智能·stable diffusion·comfyui·ai漫剧
Eric.462 天前
用 Stable Diffusion 做 AI 漫剧:从静态分镜到动态漫视频的完整工程链路
人工智能·深度学习·stable diffusion·音视频·ai漫剧
CSharp精选营2 天前
DeepSeek Harness 爆火但安装劝退?一键启动器来了,不懂编程也能用
本地部署·ai agent·一键启动·deepseekharness·dsh·非技术友好
Eric.463 天前
AI漫剧量产Prompt参数实操手册:Stable Diffusion+ComfyUI+OpenClaw通用复制即用配置
人工智能·深度学习·stable diffusion·prompt·ai漫剧
Eric.463 天前
OpenClaw 结合 Stable Diffusion 与 ComfyUI 实现本地离线 AI 漫剧全自动流水线|批量渲染、人设一致性、帧闪烁问题工程实践
人工智能·stable diffusion·comfyui·ai漫剧
Eric.463 天前
Stable Diffusion+ComfyUI+OpenClaw AI漫剧量产提示词工程:结构化Prompt、负面词脱敏、权重锁定防画面崩坏全方案
大数据·人工智能·stable diffusion·prompt·comfyui·ai漫剧
Eric.463 天前
AI 漫剧量产实战:StableDiffusion 帧稳画算法 + ComfyUI 自动质检流水线搭建(附完整代码 + 配置)
人工智能·深度学习·stable diffusion·comfyui·ai漫剧
MarkHD5 天前
Stable Diffusion入门第19-20天:保存与分享你的工作流——第一阶段收官,从“能用”到“可复用”
java·开发语言·stable diffusion
eric-sjq6 天前
0.6B 前端生成模型本地部署实战:消费级显卡跑通 WanlyFrontend 全流程
前端·本地部署
ShallWeL7 天前
【机器学习】(39)—— 部署测试
人工智能·机器学习·大模型·llm·本地部署