Stable Diffusion:修订间差异

无编辑摘要
无编辑摘要
 
(未显示同一用户的11个中间版本)
第3行: 第3行:
==简介==
==简介==
===时间轴===
===时间轴===
===常见图像生成模型===
{| class="wikitable"
! 名称
! 描述
|-
| Diffusion models
|
|-
| GAN<br />(Generative adversarial networks)
|
|-
| VAE<br />(Variational auto encoders)
|
|-
| Flow-based models
|
|}


=== 相似对比 ===
=== 相似对比 ===
第28行: 第47行:
! 平台
! 平台
! 描述
! 描述
! 网址
|-
|-
| Hugging Face
| Hugging Face
| 无需注册,直接使用。
| 无需注册,直接使用。
| https://huggingface.co/spaces/stabilityai/stable-diffusion
官网:https://huggingface.co/spaces/stabilityai/stable-diffusion
|-
|Replicate
| 无需注册,直接使用,支持付费API。
官网:https://replicate.com/stability-ai/stable-diffusion
|-
|-
| DreamStudio  
| DreamStudio  
|  
| Stability AI 提供的网站。
| http://beta.dreamstudio.ai
官网:http://beta.dreamstudio.ai
|-
|-
| Google Colab
| Google Colab
| Colab是Google提供的一个免费和付费的Jupyter Notebook环境。 <br />使用步骤:<br />1.登录Colab,https://colab.research.google.com/  <br />2.安装Stable Diffusion环境,在 https://github.com/camenduru/stable-diffusion-webui-colab 选择一个环境脚本,点击打开并在Colab运行安装。<br />3.Colab中安装完成后会有WebUI链接,点击访问即可。
| Colab是Google提供的一个免费和付费的Jupyter Notebook环境。 <br />使用步骤:<br />1.登录Colab,https://colab.research.google.com/  <br />2.安装Stable Diffusion环境,在 https://github.com/camenduru/stable-diffusion-webui-colab 选择一个环境脚本,点击打开并在Colab运行安装。<br />3.Colab中安装完成后会有WebUI链接,点击访问即可。
|https://colab.research.google.com/ <br />https://github.com/camenduru/stable-diffusion-webui-colab
Google Colab:https://colab.research.google.com/ <br />stable-diffusion-webui-colab:https://github.com/camenduru/stable-diffusion-webui-colab  
|-
| 腾讯云GPU服务器
| 购买活动服务器,60元15天。 <br />使用步骤:<br />1.系统选择:Docker基础镜像。<br />2.拉取Docker镜像:<code>sudo docker pull gpulab.tencentcloudcr.com/ai/stable-diffusion:1.0.8</code> <br />3.运行容器:<code><nowiki>sudo docker run -itd --gpus=all --network=host --device=/dev/dri --group-add=video --ipc=host --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --name=stable-diffusion gpulab.tencentcloudcr.com/ai/stable-diffusion:1.0.8 | xargs sudo docker logs --follow</nowiki></code>。<br />4.点击Public URL:https://xxxxxxxx.gradio.live/ 可以打开Stable Diffusion WebUI。点击http://外网IP:8888/?token=xxxxxx打开JupyterNotebook
官网:https://cloud.tencent.com/act/pro/gpu-study
|-
|-
|  
|  
第53行: 第79行:
==== Windows上部署 ====
==== Windows上部署 ====


==基础知识==
== 快速开始 ==
==Prompt 提示词==
=== 语法 ===
{| class="wikitable"
|-
! 名称
! 描述
! 示例
|-
|prompt
|提示词,需要在画面出现内容。
|
|-
|Negative prompt
|反向提示词,不需要在画面出现内容。
|
|-
|
|
|
|-
|
|
|
|-
|Seed
|
|
|}
 
=== 常见提示词 ===
 
{| class="wikitable"
|-
! 类型
! 提示词
|-
|设备 Device
|佳能:Canon,尼康:Nikon,iPhone,
|-
|镜头 Lenses
|
|-
|风格
|
|-
|画质
|杰作:masterpiece,最佳品质:best quality
|-
|
|
|}
===常用网站===
{| class="wikitable"
|-
! 网站名称
! 描述
! 网址
|-
| Civitai
| 模型分享网站,点击图片右下角的感叹号,会显示提示词。
| https://civitai.com/
|-
| Promptbase
| 有 DALL·E, GPT, Midjourney, Stable Diffusion, ChatGPT提示词
| https://promptbase.com/
|-
| Prompthero
|
| https://prompthero.com/
|-
| 无界AI
|
| https://wujieai.com/
|-
| Lexica
|
| https://lexica.art/
 
|}
 
 
==Model 模型==
Stable Diffusion模型是由一大堆的图像和图像的本注释训练而成。
 
===模型类型===
{| class="wikitable"
! 名称
! 描述
|-
| Checkpoint
| 又称大模型、底模型,真正 Stable Diffusion模型,直接使用即可生成图片。模型很大,一般2 – 7 GB。 <br />格式:ckpt,safetensors <br /> 位置:stable-diffusion-webui/models/Stable-diffusion/ <br /> 使用:点击webUI左上角Stable Diffusion checkpoint单选框选择模型,默认Stable diffusion训练模型。
|-
| LoRA
|
|-
|
|
|-
|
|
|}
 
=== 下载安装 ===
安装模型,只需要下载模型放入对应文件夹,再在网页点击模型刷新按钮。如Checkpoint模型放入stable-diffusion-webui/models/Stable-diffusion文件夹中。可以网页浏览下载模型,也可以使用命令下载,如在[[Linux]]中下载chilloutmix 模型:
<syntaxhighlight lang="bash">
# 进入模型对应文件夹,使用wget下载。
cd stable-diffusion-webui/models/Stable-diffusion
wget -O chilloutmix_NiPrunedFp32.safetensors https://civitai.com/api/download/models/9475
</syntaxhighlight>
{| class="wikitable"
! 名称
! 描述
! 网址
|-
| Civitai
| 模型多,浏览下载方便。
| https://civitai.com/
|-
| Hugging Face
| 模型多
| https://huggingface.co/
|}
 
=== 训练模型 ===
==== LoRA训练 ====
1.训练环境搭建,一般使用kohya-ss/sd-scripts脚本训练,地址:https://github.com/kohya-ss/sd-scripts 。基于kohya-ss/sd-scripts制作的更易用的图形界面有:
* 独立的GUI界面:https://github.com/bmaltais/kohya_ss
* Stable Diffusion WebUI 插件界面:https://github.com/liasece/sd-webui-train-tools
 
以下示例在Ubuntu下安装bmaltais/kohya_ss:
<syntaxhighlight lang="bash" >
# 安装anaconda
sudo apt update
wget https://repo.anaconda.com/archive/Anaconda3-2023.03-1-Linux-x86_64.sh
bash Anaconda3-2023.03-1-Linux-x86_64.sh
export PATH=/home/yourusername/anaconda3/bin:$PATH
 
# 重启终端,创建虚拟环境
conda create -n kohya_ss python=3.10
conda init bash 
conda activate kohya_ss  # 进入虚拟环境
 
sudo apt install python3-tk
conda install -c conda-forge accelerate
# 下载项目,安装,启动
git clone https://github.com/bmaltais/kohya_ss.git
cd kohya_ss
./setup.sh  # 安装
accelerate config
./gui.sh --share  # 启动
</syntaxhighlight>
 
2.图像处理
 
3.打标签
 
4.训练
 
5.模型测试
 
 
{{了解更多
|[https://github.com/kohya-ss/sd-scripts GitHub:kohya-ss/sd-scripts]
|[https://github.com/bmaltais/kohya_ss GitHub:bmaltais/kohya_ss]
|[https://github.com/kohya-ss/sd-scripts/blob/main/docs/train_README-zh.md kohya-ss/sd-scripts:训练]
}}
 
== Controlnet ==
 


==资源==
==资源==
第63行: 第258行:


===网站===
===网站===
*  Stable Diffusion web UI:https://github.com/AUTOMATIC1111/stable-diffusion-webui
*  Stable Diffusion WebUI:https://github.com/AUTOMATIC1111/stable-diffusion-webui
*  stable diffusion webui colab:https://github.com/camenduru/stable-diffusion-webui-colab
*  stable diffusion webui colab:https://github.com/camenduru/stable-diffusion-webui-colab
*  LAION-5B :https://laion.ai/blog/laion-5b/
===视频===
* [https://space.bilibili.com/241552578/channel/collectiondetail?sid=1176399 哔哩哔哩:my3d - AI绘图-stable diffusion从入门到精通]
* [https://www.bilibili.com/video/BV1eL411176f/  哔哩哔哩:AI次世代 - 【AI绘画入门教程】AI绘画入门  模型详解  保姆教程 Stable Diffusion模型到哪下载?]
* [https://www.youtube.com/watch?v=MXmacOUJUaw Youtube:Jay Alammar - AI Art Explained: How AI Generates Images (Stable Diffusion, Midjourney, and DALLE)]
* [https://www.youtube.com/watch?v=z83Edfvgd9g Youtube:李宏毅 -【生成式AI】速覽圖像生成常見模型 ]
* [https://www.youtube.com/watch?v=azBugJzmz-o Youtube:李宏毅 -【生成式AI】淺談圖像生成模型 Diffusion Model 原理]
===文章===
* [https://jalammar.github.io/illustrated-stable-diffusion/ Jay Alammar:The Illustrated Stable Diffusion]
* [https://www.nolibox.com/creator_articles/principle_of_stablediffusion.html 画宇宙:倒立的BOB - stable diffusion 原理是什么?stable diffusion 原理介绍 - AI绘画每日一帖]
* [https://pub.towardsai.net/getting-started-with-stable-diffusion-f343639e4931 Towards AI:Youssef Hosni - Getting Started With Stable Diffusion]
* [https://zhuanlan.zhihu.com/p/617134893 知乎:小小将 - 文生图模型之Stable Diffusion]
* [https://zhuanlan.zhihu.com/p/599869764 知乎:新智元 - Jay Alammar再发新作:超高质量图解Stable Diffusion,看完彻底搞懂「图像生成」原理]
* [https://zhuanlan.zhihu.com/p/583124756 知乎:Sean - Stable Diffusion原理解读]
* [https://stable-diffusion-art.com/models/ STABLE DIFFUSION ART:models]
* [https://aws.amazon.com/cn/blogs/china/generating-ai-models-to-match-outfits-in-e-commerce-scenarios/ 亚马逊AWS官方博客: Stable Diffusion WebUI 在电商场景生成 AI 模特搭配服装的方案探索]


[[分类:深度学习]]
[[分类:深度学习]]

2023年6月28日 (三) 17:01的最新版本

Stable Diffusion是一个开源的文本生成图像模型。由CompVis、StabilityAI和Runway合作开发。

简介

时间轴

常见图像生成模型

名称 描述
Diffusion models
GAN
(Generative adversarial networks)
VAE
(Variational auto encoders)
Flow-based models


相似对比

名称 描述 网站
Stable Diffusion
Midjourney
DALL-E

安装

在线使用

平台 描述
Hugging Face 无需注册,直接使用。

官网:https://huggingface.co/spaces/stabilityai/stable-diffusion

Replicate 无需注册,直接使用,支持付费API。

官网:https://replicate.com/stability-ai/stable-diffusion

DreamStudio Stability AI 提供的网站。

官网:http://beta.dreamstudio.ai

Google Colab Colab是Google提供的一个免费和付费的Jupyter Notebook环境。
使用步骤:
1.登录Colab,https://colab.research.google.com/
2.安装Stable Diffusion环境,在 https://github.com/camenduru/stable-diffusion-webui-colab 选择一个环境脚本,点击打开并在Colab运行安装。
3.Colab中安装完成后会有WebUI链接,点击访问即可。

Google Colab:https://colab.research.google.com/
stable-diffusion-webui-colab:https://github.com/camenduru/stable-diffusion-webui-colab

腾讯云GPU服务器 购买活动服务器,60元15天。
使用步骤:
1.系统选择:Docker基础镜像。
2.拉取Docker镜像:sudo docker pull gpulab.tencentcloudcr.com/ai/stable-diffusion:1.0.8
3.运行容器:sudo docker run -itd --gpus=all --network=host --device=/dev/dri --group-add=video --ipc=host --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --name=stable-diffusion gpulab.tencentcloudcr.com/ai/stable-diffusion:1.0.8 | xargs sudo docker logs --follow
4.点击Public URL:https://xxxxxxxx.gradio.live/ 可以打开Stable Diffusion WebUI。点击http://外网IP:8888/?token=xxxxxx打开JupyterNotebook

官网:https://cloud.tencent.com/act/pro/gpu-study

了解更多 >> Stability 博客:Stable Diffusion 公开发布


Windows上部署

快速开始

Prompt 提示词

语法

名称 描述 示例
prompt 提示词,需要在画面出现内容。
Negative prompt 反向提示词,不需要在画面出现内容。
Seed

常见提示词

类型 提示词
设备 Device 佳能:Canon,尼康:Nikon,iPhone,
镜头 Lenses
风格
画质 杰作:masterpiece,最佳品质:best quality

常用网站

网站名称 描述 网址
Civitai 模型分享网站,点击图片右下角的感叹号,会显示提示词。 https://civitai.com/
Promptbase 有 DALL·E, GPT, Midjourney, Stable Diffusion, ChatGPT提示词 https://promptbase.com/
Prompthero https://prompthero.com/
无界AI https://wujieai.com/
Lexica https://lexica.art/


Model 模型

Stable Diffusion模型是由一大堆的图像和图像的本注释训练而成。

模型类型

名称 描述
Checkpoint 又称大模型、底模型,真正 Stable Diffusion模型,直接使用即可生成图片。模型很大,一般2 – 7 GB。
格式:ckpt,safetensors
位置:stable-diffusion-webui/models/Stable-diffusion/
使用:点击webUI左上角Stable Diffusion checkpoint单选框选择模型,默认Stable diffusion训练模型。
LoRA

下载安装

安装模型,只需要下载模型放入对应文件夹,再在网页点击模型刷新按钮。如Checkpoint模型放入stable-diffusion-webui/models/Stable-diffusion文件夹中。可以网页浏览下载模型,也可以使用命令下载,如在Linux中下载chilloutmix 模型:

# 进入模型对应文件夹,使用wget下载。
cd stable-diffusion-webui/models/Stable-diffusion
wget -O chilloutmix_NiPrunedFp32.safetensors https://civitai.com/api/download/models/9475
名称 描述 网址
Civitai 模型多,浏览下载方便。 https://civitai.com/
Hugging Face 模型多 https://huggingface.co/

训练模型

LoRA训练

1.训练环境搭建,一般使用kohya-ss/sd-scripts脚本训练,地址:https://github.com/kohya-ss/sd-scripts 。基于kohya-ss/sd-scripts制作的更易用的图形界面有:

以下示例在Ubuntu下安装bmaltais/kohya_ss:

# 安装anaconda
sudo apt update
wget https://repo.anaconda.com/archive/Anaconda3-2023.03-1-Linux-x86_64.sh
bash Anaconda3-2023.03-1-Linux-x86_64.sh
export PATH=/home/yourusername/anaconda3/bin:$PATH

# 重启终端,创建虚拟环境
conda create -n kohya_ss python=3.10
conda init bash  
conda activate kohya_ss  # 进入虚拟环境

sudo apt install python3-tk
conda install -c conda-forge accelerate
# 下载项目,安装,启动
git clone https://github.com/bmaltais/kohya_ss.git
cd kohya_ss
./setup.sh  # 安装
accelerate config
./gui.sh --share   # 启动

2.图像处理

3.打标签

4.训练

5.模型测试


了解更多 >> GitHub:kohya-ss/sd-scripts GitHub:bmaltais/kohya_ss kohya-ss/sd-scripts:训练


Controlnet

资源

官网

网站

视频


文章