模型:
该模型卡片关注与 Stable Diffusion Upscaler 相关的模型,可在 here 上使用。该模型在 10M 的 LAION 子数据集上进行了 1.25M 步的训练,其中包含大于 2048x2048 的图像。该模型是在尺寸为 512x512 的裁剪图像上训练的,并且是一个文本引导型模型。除了文本输入之外,它还接收一个 noise_level 作为输入参数,根据预定义的扩散计划,可以给低分辨率输入添加噪声。
@InProceedings{Rombach_2022_CVPR,
author = {Rombach, Robin and Blattmann, Andreas and Lorenz, Dominik and Esser, Patrick and Ommer, Bj\"orn},
title = {High-Resolution Image Synthesis With Latent Diffusion Models},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2022},
pages = {10684-10695}
}
使用 Stable Diffusion 2 运行 Stable Diffusion 2 的一个简单高效的方法。
pip install diffusers transformers accelerate scipy safetensors
import requests
from PIL import Image
from io import BytesIO
from diffusers import StableDiffusionUpscalePipeline
import torch
# load model and scheduler
model_id = "stabilityai/stable-diffusion-x4-upscaler"
pipeline = StableDiffusionUpscalePipeline.from_pretrained(model_id, torch_dtype=torch.float16)
pipeline = pipeline.to("cuda")
# let's download an image
url = "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd2-upscale/low_res_cat.png"
response = requests.get(url)
low_res_img = Image.open(BytesIO(response.content)).convert("RGB")
low_res_img = low_res_img.resize((128, 128))
prompt = "a white cat"
upscaled_image = pipeline(prompt=prompt, image=low_res_img).images[0]
upscaled_image.save("upsampled_cat.png")
注意:
该模型仅用于研究目的。可能的研究领域和任务包括:
以下是不包括在内的用途:
注意:这一部分最初摘自 DALLE-MINI model card ,用于 Stable Diffusion v1,但同样适用于 Stable Diffusion v2。
模型不应用于故意创建或传播可能对人们造成敌意或疏远环境的图像。这包括生成人们可以预见到会感到恶心、苦恼或冒犯的图像;或者传播历史或现实的刻板印象的内容。
超出范围的使用
该模型未经过训练,不能作为人物或事件的真实表达,因此使用该模型生成此类内容超出了该模型的能力。
误用和恶意使用
将模型用于生成对个人残酷的内容是对该模型的误用。这包括但不限于:
尽管图像生成模型的能力令人印象深刻,但它们也可能强化或加剧社会偏见。Stable Diffusion vw 主要在 LAION-2B(en) 的子集上进行了训练,该子集包含的图像仅限于英文描述。其他语言社区和文化的文本和图像可能无法得到充分考虑。这会影响模型的整体输出,因为白人和西方文化通常被设置为默认值。此外,与使用英语提示相比,模型生成非英语内容的能力要差得多。Stable Diffusion v2 明显反映和加剧了偏见,因此不管输入或意图如何,都应谨慎使用。
训练数据
培训过程 Stable Diffusion v2 是一个潜在的扩散模型,它将自动编码器与在自动编码器的潜在空间中训练的扩散模型相结合。在训练过程中:
我们目前提供以下检查点:
通过使用不同的无分类器引导尺度(1.5、2.0、3.0、4.0、5.0、6.0、7.0、8.0)和 50 步 DDIM 采样步骤进行评估,展示了检查点的相对改进:

使用 50 个 DDIM 步骤和 COCO2017 验证集的 10000 个随机提示进行评估,以 512x512 分辨率进行评价。未针对 FID 分数进行优化。
Stable Diffusion v1 估计的排放量基于 Machine Learning Impact calculator 中提供的信息,利用硬件、运行时间、云服务提供商和计算区域估计碳足迹。
@InProceedings{Rombach_2022_CVPR,
author = {Rombach, Robin and Blattmann, Andreas and Lorenz, Dominik and Esser, Patrick and Ommer, Bj\"orn},
title = {High-Resolution Image Synthesis With Latent Diffusion Models},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2022},
pages = {10684-10695}
}
该模型卡片由 Robin Rombach、Patrick Esser 和 David Ha 撰写,基于 Stable Diffusion v1 和 DALL-E Mini model card 。