Stable Diffusion:修订间差异

无编辑摘要
无编辑摘要
 
(未显示同一用户的4个中间版本)
第47行: 第47行:
! 平台
! 平台
! 描述
! 描述
! 网址
|-
|-
| Hugging Face
| Hugging Face
| 无需注册,直接使用。
| 无需注册,直接使用。
| https://huggingface.co/spaces/stabilityai/stable-diffusion
官网:https://huggingface.co/spaces/stabilityai/stable-diffusion
|-
|-
|Replicate
|Replicate
| 无需注册,直接使用,支持付费API。
| 无需注册,直接使用,支持付费API。
|https://replicate.com/stability-ai/stable-diffusion
官网:https://replicate.com/stability-ai/stable-diffusion
|-
|-
| DreamStudio  
| DreamStudio  
| Stability AI 提供的网站。
| 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
|-
|-
|  
|  
第78行: 第81行:
== 快速开始 ==
== 快速开始 ==
==Prompt 提示词==
==Prompt 提示词==
=== 语法 ===
{| class="wikitable"
|-
! 名称
! 描述
! 示例
|-
|prompt
|提示词,需要在画面出现内容。
|
|-
|Negative prompt
|反向提示词,不需要在画面出现内容。
|
|-
|
|
|
|-
|
|
|
|-
|Seed
|
|
|}
=== 常见提示词 ===
{| class="wikitable"
|-
! 类型
! 提示词
|-
|设备 Device
|佳能:Canon,尼康:Nikon,iPhone,
|-
|镜头 Lenses
|
|-
|风格
|
|-
|画质
|杰作:masterpiece,最佳品质:best quality
|-
|
|
|}
===常用网站===
===常用网站===
{| class="wikitable"  
{| class="wikitable"  
第151行: 第204行:


=== 训练模型 ===
=== 训练模型 ===
==== 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 ==
== Controlnet ==

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

资源

官网

网站

视频


文章