T2I-Adapters
Last updated
Last updated
The train_t2i_adapter_sdxl.py
script (as shown below) shows how to implement the for .
Before running the scripts, make sure to install the libraryβs training dependencies:
Important
To make sure you can successfully run the latest versions of the example scripts, we highly recommend installing from source and keeping the install up to date as we update the example scripts frequently and install some example-specific requirements. To do this, execute the following steps in a new virtual environment:
Copied
Then cd in the examples/t2i_adapter
folder and run
Copied
And initialize an π environment with:
Copied
Or for a default accelerate configuration without answering questions about your environment
Copied
Or if your environment doesnβt support an interactive shell (e.g., a notebook)
Copied
When running accelerate config
, if we specify torch compile mode to True there can be dramatic speedups.
Our training examples use two test conditioning images. They can be downloaded by running
Copied
Then run boincai-cli login
to log into your BOINC AI account. This is needed to be able to push the trained T2IAdapter parameters to BOINC AI Hub.
Copied
To better track our training experiments, weβre using the following flags in the command above:
report_to="wandb
will ensure the training runs are tracked on Weights and Biases. To use it, be sure to install wandb
with pip install wandb
.
validation_image
, validation_prompt
, and validation_steps
to allow the script to do a few validation inference runs. This allows us to qualitatively check if the training is progressing as expected.
Our experiments were conducted on a single 40GB A100 GPU.
Once training is done, we can perform inference like so:
Copied
The original dataset is hosted in the . We re-uploaded it to be compatible with datasets
. Note that datasets
handles dataloading within the training script.
SDXLβs VAE is known to suffer from numerical instability issues. This is why we also expose a CLI argument namely --pretrained_vae_model_name_or_path
that lets you specify the location of a better VAE (such as ).