🚀 T2I-Adapter-SDXL - Openpose
T2I Adapterは、Stable Diffusionに追加の条件付けを提供するネットワークです。各T2Iチェックポイントは、異なるタイプの条件付けを入力として受け取り、特定のベースのStable Diffusionチェックポイントと共に使用されます。
このチェックポイントは、StableDiffusionXLチェックポイントに対してOpenposeの条件付けを提供します。これは、Tencent ARCとHugging Faceの共同プロジェクトです。
📚 ドキュメント
モデルの詳細
-
開発者: T2I-Adapter: Learning Adapters to Dig out More Controllable Ability for Text-to-Image Diffusion Models
-
モデルのタイプ: 拡散ベースのテキストから画像への生成モデル
-
言語: 英語
-
ライセンス: Apache 2.0
-
詳細情報のリソース: GitHubリポジトリ、論文。
-
モデルの複雑性:
| | SD-V1.4/1.5 | SD-XL | T2I-Adapter | T2I-Adapter-SDXL |
| --- | --- | --- | --- | --- |
| パラメータ | 860M | 2.6B | 77 M | 77/79 M |
-
引用方法:
@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}
}
チェックポイント
💻 使用例
基本的な使用法
まず、必要な依存関係をインストールします。
pip install -U git+https://github.com/huggingface/diffusers.git
pip install -U controlnet_aux==0.0.7
pip install transformers accelerate safetensors
- 画像を適切な制御画像形式でダウンロードします。
- 制御画像とプロンプトを
StableDiffusionXLAdapterPipeline
に渡します。
Openpose Adapterを使用した簡単な例を見てみましょう。
依存関係
from diffusers import StableDiffusionXLAdapterPipeline, T2IAdapter, EulerAncestralDiscreteScheduler, AutoencoderKL
from diffusers.utils import load_image, make_image_grid
from controlnet_aux import OpenposeDetector
import torch
import numpy as np
from PIL import Image
adapter = T2IAdapter.from_pretrained(
"TencentARC/t2i-adapter-openpose-sdxl-1.0", torch_dtype=torch.float16
).to("cuda")
model_id = 'stabilityai/stable-diffusion-xl-base-1.0'
euler_a = EulerAncestralDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
pipe = StableDiffusionXLAdapterPipeline.from_pretrained(
model_id, vae=vae, adapter=adapter, scheduler=euler_a, torch_dtype=torch.float16, variant="fp16",
).to("cuda")
pipe.enable_xformers_memory_efficient_attention()
open_pose = OpenposeDetector.from_pretrained("lllyasviel/Annotators")
条件画像
url = "https://huggingface.co/Adapter/t2iadapter/resolve/main/people.jpg"
image = load_image(url)
image = open_pose(image, detect_resolution=512, image_resolution=1024)
image = np.array(image)[:, :, ::-1]
image = Image.fromarray(np.uint8(image))

生成
prompt = "A couple, 4k photo, highly detailed"
negative_prompt = "anime, cartoon, graphic, text, painting, crayon, graphite, abstract, glitch, deformed, mutated, ugly, disfigured"
gen_images = pipe(
prompt=prompt,
negative_prompt=negative_prompt,
image=image,
num_inference_steps=30,
adapter_conditioning_scale=1,
guidance_scale=7.5,
).images[0]
gen_images.save('out_pose.png')

学習
私たちの学習スクリプトは、ここで提供している公式の学習スクリプトをベースに構築されています。
このモデルは、LAION-Aesthetics V2の300万の高解像度画像テキストペアを使用して学習されています。
- 学習ステップ: 35000
- バッチサイズ: 単一GPUのバッチサイズが
16
のデータ並列で、合計バッチサイズは256
。
- 学習率:
1e-5
の一定の学習率。
- 混合精度: fp16
📄 ライセンス
このモデルは、Apache 2.0ライセンスの下で提供されています。