sdxl-training
- 14 Devlogs
- 48 Total hours
A lightweight toolkit for SDXL(Stable Diffusion XL) training.
A lightweight toolkit for SDXL(Stable Diffusion XL) training.
This update introduces benchmarking and metadata-related features, along with improvements to the trainer engine and documentation.
Detailed changes:
benchmark.py for training performance evaluationtest_benchmark.py and test_metadata_features.py to improve test coverageWith this update completed, the training framework is now ready for official use.
For detailed usage instructions and examples, please refer to:
Please note that this project has relatively high resource requirements. The following configuration is recommended as the minimum supported environment:
OS: Ubuntu 24.04 LTS
RAM: 64 GB
GPU VRAM: At least 12 GB
NVMe SSD (recommended for latent/text-encoder caching)
Running below these requirements may result in insufficient memory, significantly reduced performance, or inability to complete training.
Thank you for following the development of this project.
Checkpoint System:
Dataset & Caching:
Performance Optimizations:
Hardware Guardrails:
Testing:
feat: add gradient accumulation and offload checkpoint writes to a background worker
Two small polish passes today!
fixed a sneaky little bug: SDXL micro-conditioning was using the resized image size and crop coords, which was a bit off~ now it happily uses the TRUE original size and original-image-space crop offsets, matching the kohya / diffusers convention, so the model finally understands each image’s real backstory
also, caption augmentation used the global random, so it got all mixed up on resume (´;ω;`) gave it its own little seeded RNG baby — its state is saved with the checkpoint and restored exactly, so training picks up right where it left off, no getting lost.
collate got a tiny shield too: if a batch mixes cached/uncached samples, it now complains LOUDLY instead of throwing a cryptic KeyError
Hi~ today the trainer went on a little diet!
Gave precaching a little diet today! Added a VAE-slicing toggle (off by default = faster), and now we hand VRAM back to the GPU after every batch (no more sneaky CUDA hoarding~). Single-file checkpoints now only carry the UNet home instead of lugging the whole pipeline. Shoved caption augmentation into the prefetch thread, and the progress bar got smarter — it counts only real encodes, not the lazy “already-cached” ones. The GPU is having an easy day, meow~
Two little wheels rolled into the trainer today:
🎯 Aspect-ratio bucketing: no more squishing every image into a square! Each pic now hops into the bucket whose ratio fits it best, gets a gentle cover-resize + center-crop, and BucketBatchSampler keeps same-bucket pals together so batches stack nice and tidy.
🏷️ Cute caption magic: Kohya-style tag shuffling, keep_tokens to pin the first few tags, and playful tag / whole-caption dropout — data augmentation now feels like sprinkling sugar 🍬.
Also fixed a sneaky SDXL detail: we now record each image’s real original_size and crop_ltrb and feed them into add_time_ids, instead of pretending everything is a 1024² square.
The cache grew up too — one combined cache_{hash}.pt carrying latents + text-encoder outputs + metadata, always saved to disk so reruns load in a blink, with shape checks that auto-recompute if you resize.
And the UNet now takes a nap 💤 until caching is done, freeing VRAM for the little GPUs that could.
✨ Precaching got a turbo boost! 🚀
Hi hi~ today the caching step stopped being such a lazy little snail! 🐌➡️🐇
Before, we loaded one image, encoded it, saved it… one… by… one… zzz 😴 The GPU was basically napping while the disk did all the reading.
Now we have a squad of worker threads (cache_workers) fetching images in parallel while the GPU chomps through them in batches (cache_batch_size). I/O and compute finally hold hands and work together! 🤝
Bonus: a cute little progress log tells you img/s and ETA, so you know exactly when snack time ends. 🍪⏱️
Also added a safety hug for resumes!
If you try to resume a checkpoint with a different config, the trainer now gently stops and asks “are you suuure? type ‘yes’~” 🥺 No more silently mixing old weights with new settings and crying later. In non-interactive mode it just aborts to keep you safe. 💖
Added cute little tqdm progress bars to the caching & training loops so we can watch them go brrr~
Two handy little things landed in the trainer this time~
train_text_encoder switch (off bySingle-file SDXL checkpoints are now supported!
Initial implementation of the SDXL Training Toolkit!
This is a very early and minimal version. The core training pipeline is now in place, but features like aspect ratio bucketing, VAE caching, and other optimizations are still on the way.
I just realized how complex it is to build an SDXL training pipeline from scratch… It might be a long while before the first version is ready to ship qwq