원클릭으로
train-lora
// Validate Draw Things LoRA training end to end with draw-things-cli, including tiny-dataset training, loss and scaler checks, checkpoint sanity, and base-versus-LoRA generation comparison.
// Validate Draw Things LoRA training end to end with draw-things-cli, including tiny-dataset training, loss and scaler checks, checkpoint sanity, and base-versus-LoRA generation comparison.
| name | train-lora |
| description | Validate Draw Things LoRA training end to end with draw-things-cli, including tiny-dataset training, loss and scaler checks, checkpoint sanity, and base-versus-LoRA generation comparison. |
Use this workflow to validate Draw Things LoRA training end to end with draw-things-cli.
Train on a tiny local dataset, watch loss and scaler health, then verify visually with a reference/base/LoRA comparison.
Build the optimized CLI first:
bazel build --compilation_mode=opt //Apps:DrawThingsCLI
Use the built binary for every run:
bazel-bin/Apps/DrawThingsCLI
Do not switch between bazel run and bazel-bin/... during one validation cycle unless you need to. Reuse the same binary so compile/runtime behavior stays comparable and permission prompts stay predictable.
--compilation_mode=opt, 5 to 30 minutes is possible on heavy trainers. Do not assume a hang too early.loras[].version during generation instead of depending on custom_lora.json.For a single-image reconstruction check:
.txt caption file beside it.zimgdogref
Use this order:
scale stays healthy and loss is not obviously blowing up.Use this as the generic 512x512 single-image baseline:
bazel-bin/Apps/DrawThingsCLI train lora \
--models-dir /Users/liu/Library/Containers/com.liuliu.draw-things/Data/Documents/Models \
--model MODEL.ckpt \
--dataset /tmp/single_image_dataset \
--output RUN_NAME \
--name RUN_NAME \
--steps 500 \
--rank 32 \
--scale 1 \
--learning-rate 0:4e-4 \
--gradient-accumulation 4 \
--warmup-steps 20 \
--save-every 100 \
--width 512 \
--height 512 \
--seed 7 \
--config-json '{"steps_between_restarts":200}' \
--no-download-missing \
--offline
scale lower than 1 to make a run stable. That hides overflow and can prevent useful learning.32768.0.flux_1_dev_q8p.ckptguidanceScale = 3.5guidanceEmbed = 3.5shift = 2resolutionDependentShift = falsescale is typically 32768.0z_image_turbo_1.0_i8x.ckpt1024.0cfg = 1z_image_1.0_q8p.ckpt1024.0{"sampler":17,"shift":1.8776105999999999,"resolutionDependentShift":true}
cfg = 4qwen_image_2512_bf16_i8x.ckptscale is 32768.0scale steadily collapses, something is seriously wrong.scale collapses only on a new backend, compare against the known-stable backend before changing learning rate or dataset settings.scale collapses on a model with rotary applied through cmul, check whether trainer rotary constants are expanded to the real query/key head count.lora_up tensors are not all zeroAlways compare base and LoRA with the exact same:
Use the exact training caption first. If that fails, richer prompts are not useful for debugging.
For non-distilled base models, do not under-sample the generation validation. Use the model's real baseline settings, including enough steps, the correct CFG behavior, and the correct sampler family.
For local LoRAs, pass explicit version metadata:
"loras": [
{
"file": "RUN_NAME_500_lora_f32.ckpt",
"version": "MODEL_VERSION",
"weight": 1.0
}
]
If the model also needs LoRA mode metadata, pass mode too.
bazel-bin/Apps/DrawThingsCLI generate \
--models-dir /Users/liu/Library/Containers/com.liuliu.draw-things/Data/Documents/Models \
--model z_image_turbo_1.0_i8x.ckpt \
--prompt zimgdogref \
--width 512 \
--height 512 \
--steps 15 \
--cfg 1 \
--seed 7 \
--config-json '{"loras":[{"file":"RUN_NAME_500_lora_f32.ckpt","version":"z_image","weight":1.0}]}' \
--offline \
--no-download-missing \
--output /tmp/zimg_lora.png
bazel-bin/Apps/DrawThingsCLI generate \
--models-dir /Users/liu/Library/Containers/com.liuliu.draw-things/Data/Documents/Models \
--model z_image_1.0_q8p.ckpt \
--prompt zimgdogref \
--width 512 \
--height 512 \
--steps 20 \
--cfg 4 \
--seed 7 \
--config-json '{"sampler":17,"shift":1.8776105999999999,"resolutionDependentShift":true,"loras":[{"file":"RUN_NAME_500_lora_f32.ckpt","version":"z_image","weight":1.0}]}' \
--offline \
--no-download-missing \
--output /tmp/zimg_base_lora.png
Use ffmpeg to compose reference, base, and LoRA side by side:
ffmpeg -y \
-i /tmp/single_image_dataset/dog.png \
-i /tmp/base.png \
-i /tmp/lora.png \
-filter_complex hstack=inputs=3 \
-frames:v 1 \
/tmp/compare.png
Use when writing or refactoring UIKit UI in this repo, especially Workflow/ViewController wiring, Controller/View components, SnapKit layout, Workspace/Dflat-driven UI state, Objective-C adapter responders, or app threading boundaries.
Add a new image or video generative model to the Draw Things app / CLI with a compile-first, end-to-end workflow across SwiftDiffusion, tokenizer plumbing, text encoder, fixed encoder, UNet / DiT runtime, VAE, converter and quantizer tooling, and CLI validation.
Add or tighten Draw Things LoRA trainer support for generative models available in the Draw Things app / CLI, covering LoRA builders, trainer dispatch, tokenizer and fixed-encoder wiring, checkpoint export, numerical debugging, and validation.