SDXL Container

SDXL Container

License Python OS

CI CodeQL Advanced Pytest Python Lint pages

A docker container for SDXL

"image"

Highlights:

  • Reproducible: everything runs inside a container (no local Python env needed).
  • Simple: one command to (optionally) caption images + train.
  • Safe defaults for few-shot SDXL LoRA.
  • Includes inference: SDXL txt2img with LoRA using diffusers.

Requirements

  • Docker + Docker Compose v2
  • A GPU-enabled Docker runtime is strongly recommended for training.

Build

docker compose build trainer

Train (caption + LoRA)

# train
docker compose run --rm trainer train \
--base-model /models/base/sd_xl_base_1.0.safetensors \
--images /datasets/title \
--run-name title \
--sdxl \
--caption-mode blip \
--concept-token sksSubject \
--max-train-steps 1600 \
--num-repeats 20 \
--network-dim 16 \
--network-alpha 8

Caption (BLIP)

If you want to generate .txt captions next to each image (same basename):

# caption
docker compose run  \
--rm trainer caption  \  
--images /datasets/subject \   
--prefix sksSubject    \
--overwrite

Inference (SDXL txt2img with LoRA)

Generate images with the trained LoRA:

# inference
docker compose run  \
--rm trainer infer    \
--base-model /models/base/sd_xl_base_1.0.safetensors    \
--lora /models/loras/title_20260204_123246.safetensors    \
--prompt "sksSubject seaside"    \
--negative-prompt ""    \
--out-dir /datasets/title/inference    \
--num-images 4    \
--steps 30    \
--cfg 7.0    \
--width 1024    \
--height 1024    \
--lora-scale 0.8    \
--seed 42

License

  • Apache License 2.0