模型:
该流程是对 Stable Diffusion (v1.5) 的'指导调整'版本,它是从现有的 InstructPix2Pix checkpoints 进行微调的。
该流程的动机部分来自于 FLAN ,部分来自于 InstructPix2Pix 。主要思想是首先创建一个按照指导进行的数据集(如 our blog 中所述),然后进行InstructPix2Pix风格的训练。最终目标是使稳定扩散更好地遵循涉及图像转换操作的具体指导。
了解更多信息,请查阅 this post 。
训练是在 instruction-tuning-sd/cartoonization 数据集上进行的。请参阅 this repository 了解更多信息。训练日志可以在 here 中找到。
这里是从该流程中得出的一些结果:
您可以使用该流程对输入图像和输入提示进行卡通化处理。
以下是如何使用该模型:
import torch
from diffusers import StableDiffusionInstructPix2PixPipeline
from diffusers.utils import load_image
model_id = "instruction-tuning-sd/cartoonizer"
pipeline = StableDiffusionInstructPix2PixPipeline.from_pretrained(
model_id, torch_dtype=torch.float16, use_auth_token=True
).to("cuda")
image_path = "https://hf.co/datasets/diffusers/diffusers-images-docs/resolve/main/mountain.png"
image = load_image(image_path)
image = pipeline("Cartoonize the following 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},
}