You can also check configs/t2i_adapter/README.md
file.
All configuration files are placed under the configs/t2i_adapter
folder.
Following is the example config fixed from the stable_diffusion_xl_t2i_adapter_fill50k config file in configs/t2i_adapter/stable_diffusion_xl_t2i_adapter_fill50k.py
:
from mmengine.config import read_base with read_base(): from .._base_.datasets.fill50k_t2i_adapter_xl import * from .._base_.default_runtime import * from .._base_.models.stable_diffusion_xl_t2i_adapter import * from .._base_.schedules.stable_diffusion_3e import * optim_wrapper.update( optimizer=dict(lr=1e-5), accumulative_counts=2, )Run training¶
Run train
# single gpu $ diffengine train ${CONFIG_FILE} # multi gpus $ NPROC_PER_NODE=${GPU_NUM} diffengine train ${CONFIG_FILE} # Example $ diffengine train stable_diffusion_xl_t2i_adapter_fill50kInference with diffusers¶
Once you have trained a model, specify the path to the saved model and utilize it for inference using the diffusers.pipeline
module.
import torch from diffusers import StableDiffusionXLAdapterPipeline, T2IAdapter, AutoencoderKL from diffusers.utils import load_image checkpoint = 'work_dirs/stable_diffusion_xl_t2i_adapter_fill50k/step75000' prompt = 'cyan circle with brown floral background' condition_image = load_image( 'https://github.com/okotaku/diffengine/assets/24734142/1af9dbb0-b056-435c-bc4b-62a823889191' ).resize((1024, 1024)) adapter = T2IAdapter.from_pretrained( checkpoint, subfolder='adapter', torch_dtype=torch.float16) vae = AutoencoderKL.from_pretrained( 'madebyollin/sdxl-vae-fp16-fix', torch_dtype=torch.float16, ) pipe = StableDiffusionXLAdapterPipeline.from_pretrained( 'stabilityai/stable-diffusion-xl-base-1.0', adapter=adapter, vae=vae, torch_dtype=torch.float16) pipe.to('cuda') image = pipe( prompt, image=condition_image, num_inference_steps=50, ).images[0] image.save('demo.png')Results Example¶ stable_diffusion_xl_t2i_adapter_fill50k¶
You can check configs/t2i_adapter/README.md
for more details.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4