🚀 T2I Adapter - Sketch
T2I Adapter是一个为稳定扩散模型提供额外条件控制的网络。每个T2I检查点接收不同类型的条件作为输入,并与特定的基础稳定扩散检查点一起使用。此检查点为稳定扩散1.4检查点提供草图条件控制。
🚀 快速开始
依赖安装
pip install diffusers transformers controlnet_aux
运行代码
import torch
from PIL import Image
from controlnet_aux import PidiNetDetector
from diffusers import (
T2IAdapter,
StableDiffusionAdapterPipeline
)
image = Image.open('./images/sketch_in.png')
processor = PidiNetDetector.from_pretrained('lllyasviel/Annotators')
sketch_image = processor(image)
sketch_image.save('./images/sketch.png')
adapter = T2IAdapter.from_pretrained("TencentARC/t2iadapter_zoedepth_sd15v1", torch_dtype=torch.float16)
pipe = StableDiffusionAdapterPipeline.from_pretrained(
"CompVis/stable-diffusion-v1-4", adapter=adapter, safety_checker=None, torch_dtype=torch.float16, variant="fp16"
)
pipe.to('cuda')
generator = torch.Generator().manual_seed(0)
sketch_image_out = pipe(prompt="royal chamber with fancy bed", image=sketch_image, generator=generator).images[0]
sketch_image_out.save('./images/sketch_image_out.png')
示例图片

✨ 主要特性
T2I Adapter能够为稳定扩散模型提供额外的条件控制,通过不同的检查点接收不同类型的条件输入,从而实现更丰富、更可控的文本到图像生成。
📚 详细文档
模型详情
属性 |
详情 |
开发者 |
《T2I-Adapter: Learning Adapters to Dig out More Controllable Ability for Text-to-Image Diffusion Models》团队 |
模型类型 |
基于扩散的文本到图像生成模型 |
语言 |
英文 |
许可证 |
Apache 2.0 |
更多信息资源 |
GitHub仓库,论文 |
引用信息
@misc{
title={T2I-Adapter: Learning Adapters to Dig out More Controllable Ability for Text-to-Image Diffusion Models},
author={Chong Mou, Xintao Wang, Liangbin Xie, Yanze Wu, Jian Zhang, Zhongang Qi, Ying Shan, Xiaohu Qie},
year={2023},
eprint={2302.08453},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
检查点
📄 许可证
本项目采用Apache 2.0许可证。