英文

指令调整的稳定扩散低级图像处理(Scratch)

该流程是对 Stable Diffusion (v1.5) 的“指令调整”版本。使用 InstructPix2Pix methodology 进行训练。

流程描述

该流程的动机部分来自 FLAN ,部分来自 InstructPix2Pix 。主要思路是首先创建一个指令提示的数据集(如 our blog 中所述),然后进行InstructPix2Pix风格的训练。最终目标是使稳定扩散更好地遵循涉及图像转换的特定指令。

查看 this post 以了解更多。

训练过程和结果

在 instruction-tuning-sd/low-level-image-proc 数据集上进行了训练。详细信息请参阅 this repository 。

下面是从该流程中得出的一些结果:

预期用途和限制

您可以使用该流程对输入图像和输入提示进行低级图像处理。

如何使用

以下是如何使用此模型:

import torch
from diffusers import StableDiffusionInstructPix2PixPipeline
from diffusers.utils import load_image

model_id = "instruction-tuning-sd/scratch-low-level-img-proc"
pipeline = StableDiffusionInstructPix2PixPipeline.from_pretrained(
    model_id, torch_dtype=torch.float16, use_auth_token=True
).to("cuda")

image_path = "https://hf.co/datasets/sayakpaul/sample-datasets/resolve/main/derain%20the%20image_1.png"
image = load_image(image_path)

image = pipeline("derain the image", image=image).images[0]
image.save("image.png")

有关限制、误用、恶意使用和超出范围使用的注意事项,请参阅模型卡 here 。

引用

FLAN

@inproceedings{
    wei2022finetuned,
    title={Finetuned Language Models are Zero-Shot Learners},
    author={Jason Wei and Maarten Bosma and Vincent Zhao and Kelvin Guu and Adams Wei Yu and Brian Lester and Nan Du and Andrew M. Dai and Quoc V Le},
    booktitle={International Conference on Learning Representations},
    year={2022},
    url={https://openreview.net/forum?id=gEZrGCozdqR}
}

InstructPix2Pix

@InProceedings{
    brooks2022instructpix2pix,
    author     = {Brooks, Tim and Holynski, Aleksander and Efros, Alexei A.},
    title      = {InstructPix2Pix: Learning to Follow Image Editing Instructions},
    booktitle  = {CVPR},
    year       = {2023},
}

稳定扩散的指令调整博客

@article{
  Paul2023instruction-tuning-sd,
  author = {Paul, Sayak},
  title = {Instruction-tuning Stable Diffusion with InstructPix2Pix},
  journal = {Hugging Face Blog},
  year = {2023},
  note = {https://huggingface.co/blog/instruction-tuning-sd},
}