🚀 用于卡通化的指令调优稳定扩散模型(微调版)
本模型是 Stable Diffusion (v1.5) 的“指令调优”版本。它是在现有的 InstructPix2Pix 检查点基础上进行微调得到的。
🚀 快速开始
本模型可用于根据输入图像和输入提示进行卡通化处理。以下是使用该模型的示例代码:
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")
✨ 主要特性
此模型的动机部分源自 FLAN,部分源自 InstructPix2Pix。主要思路是先创建一个指令提示数据集(如我们的博客所述),然后进行 InstructPix2Pix 风格的训练。最终目标是让 Stable Diffusion 更好地遵循涉及图像变换相关操作的特定指令。
更多信息请参考 此文章。
📚 详细文档
训练过程和结果
训练是在 instruction-tuning-sd/cartoonization 数据集上进行的。更多信息请参考 此仓库。训练日志可在 这里 找到。
以下是该模型生成的一些结果:
预期用途和局限性
你可以使用该模型根据输入图像和输入提示进行卡通化处理。关于局限性、误用、恶意使用、超出范围使用的注意事项,请参考 此模型卡片。
📄 许可证
本项目采用 MIT 许可证。
📚 引用
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},
}
Stable Diffusion 指令调优博客
@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},
}