Nodes/Realtime LoRA Trainer/Realtime LoRA Trainer (SDXL - sd-scripts)
ComfyUI Node

Realtime LoRA Trainer (SDXL - sd-scripts)

Fast, in-workflow SDXL LoRA training via Kohya's sd-scripts

By shootthesound·Created 8 months ago·Updated 2 months ago· 538
Realtime LoRA Trainer (SDXL - sd-scripts)
  • image_1
  • image_2
  • image_3
  • image_4
  • lora_path
inputcount4
images_path
sd_scripts_path~/sd-scripts
ckpt_name
captionphoto of subject
training_steps500
learning_rate0.0005
lora_rank16
vram_modeLow (768px)
keep_loratrue
output_nameMyLora
custom_python_exe
no_half_vaefalse
caption_1
caption_2
caption_3
caption_4

What it is

SDXLLoraTrainer trains an SDXL LoRA from a handful of images without you ever opening a terminal. It's one of ten trainer nodes in the "Realtime LoRA Trainer" pack, and it's the one running on the oldest, most battle-tested backend of the bunch: kohya-ss/sd-scripts, the tool whose flag names - network_dim, network_alpha and friends - became the vocabulary every LoRA guide and rival trainer still borrows. The pack's author is upfront about why this node exists at all: "I think SDXL is due for a revival. It trains fast, runs on reasonable hardware, and the results are solid." He's not wrong about the speed - a few minutes on a decent card gets you a usable LoRA, fast enough to test a concept before committing to a longer Flux or Z-Image run.

Worth knowing going in: SDXL training itself is a mature, settled recipe at this point. If you want the cutting-edge model or the smallest file size, look at this pack's Musubi or AI-Toolkit trainers instead. If you want something that just works, fast, on hardware you already own, this is the one.

How it works

The node shells out to sd-scripts' own training loop with the parameters you set on the node - it's not reinventing LoRA training, it's giving you a form instead of a config file. Your images and captions get assembled into a dataset, sd-scripts trains against your chosen checkpoint, and the resulting LoRA file path comes back as the node's output. Identical inputs on a re-run skip training entirely and hand back the cached result, which matters more than it sounds like once you're iterating on captions.

Inputs and outputs that matter

  • ckpt_name - the SDXL checkpoint you're training against (the pack's README notes it's been tested with Juggernaut XL Ragnarok, but any SDXL checkpoint should work).
  • inputcount plus paired image_N / caption_N inputs, or images_path for a folder instead.
  • training_steps (default 500), learning_rate (default 0.0005), lora_rank (default 16) - the settled SDXL-era rank range (16–32) is still correct here, unlike on the pack's newer-architecture trainers.
  • vram_mode - Min (512px), Low (768px), or Max (1024px).
  • no_half_vae - a fix for NaN errors some SDXL checkpoints throw; leave it off unless you hit that specific failure.
  • sd_scripts_path, output_name, keep_lora, custom_python_exe round out the setup fields.

Output is a single lora_path string, ready for ApplyTrainedLora or the SDXL Selective Loader's path override.

Installing it

The node ships in the same pack as everything else - ComfyUI Manager (search "Realtime LoRA Trainer") or:

cd ComfyUI/custom_nodes
git clone https://github.com/ShootTheSound/comfyUI-Realtime-Lora

Restart ComfyUI. This particular node needs sd-scripts installed separately per its own docs, with the path pasted into sd_scripts_path - you don't run sd-scripts' own UI, the node just needs to find it.

Common issues

NaN outputs on some checkpoints. This is a known sd-scripts issue with certain SDXL models; the pack added the no_half_vae toggle specifically to fix it. If your training run produces black or corrupted images, flip it on.

Python version mismatches. Same rule as this pack's other trainers: 3.10–3.12, avoid 3.13.

Batch size is fixed at 1. The pack pins batch_size to 1 across every VRAM preset deliberately, for stability - don't go hunting for a batch-size field, it isn't exposed here on purpose.

Overfitting on small datasets. Standard SDXL-era LoRA failure mode: too many steps or too high a learning rate on a small dataset gives you outputs that look like copies of your training images and lose prompt control. The fix is the usual one - fewer steps, lower LR, or a slightly larger and more varied dataset.

Categoryloaders

Inputs (21)

NameTypeDefaultDescription
inputcountINT41–100Number of image inputs. Click 'Update inputs' button after changing.
images_pathSTRINGOptional: Path to folder containing training images. If provided, images from this folder are used instead of image inputs. Caption .txt files with matching names are used if present.
sd_scripts_pathSTRING~/sd-scriptsPath to kohya sd-scripts installation.
ckpt_nameCOMBOSDXL checkpoint to train LoRA on.
captionSTRINGphoto of subjectDefault caption for all images. Per-image caption inputs override this.
training_stepsINT50010–5000Number of training steps. 500 is a good starting point. Increase for more images or complex subjects.
learning_rateFLOAT0.00050.00001–0.1Learning rate. 0.0005 trains fast but may overshoot. Experiment with lowering for more stable/slower training.
lora_rankINT164–128LoRA rank/dimension. 16-32 typical. Higher = more capacity but larger file and more VRAM.
vram_modeCOMBOLow (768px)VRAM optimization preset. Images are automatically resized to the specified resolution.
keep_loraBOOLEANtrueIf True, keeps the trained LoRA file.
output_nameSTRINGMyLoraCustom name for the output LoRA. Timestamp will be appended.
custom_python_exeSTRINGAdvanced: Optionally enter the full path to a custom python.exe (e.g. C:\my-venv\Scripts\python.exe). If empty, uses the venv inside sd_scripts_path. The sd_scripts_path field is still required for locating training scripts.
no_half_vaeBOOLEANfalseDisable half-precision for VAE. Enable this if you get NaN errors during training with certain models.
image_1optIMAGETraining image (not needed if images_path is set).
caption_1optSTRINGCaption for image_1. Overrides default caption.
image_2optIMAGETraining image.
caption_2optSTRINGCaption for image_2. Overrides default caption.
image_3optIMAGETraining image.
caption_3optSTRINGCaption for image_3. Overrides default caption.
image_4optIMAGETraining image.
caption_4optSTRINGCaption for image_4. Overrides default caption.

Outputs (1)

NameTypeDescription
lora_pathSTRINGPath to the trained SDXL LoRA file.