Realtime LoRA Trainer (SDXL - sd-scripts)
Fast, in-workflow SDXL LoRA training via Kohya's sd-scripts
- image_1
- image_2
- image_3
- image_4
- lora_path
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).inputcountplus pairedimage_N/caption_Ninputs, orimages_pathfor 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_exeround 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.
Inputs (21)
| Name | Type | Default | Description |
|---|---|---|---|
| inputcount | INT | 41–100 | Number of image inputs. Click 'Update inputs' button after changing. |
| images_path | STRING | Optional: 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_path | STRING | ~/sd-scripts | Path to kohya sd-scripts installation. |
| ckpt_name | COMBO | SDXL checkpoint to train LoRA on. | |
| caption | STRING | photo of subject | Default caption for all images. Per-image caption inputs override this. |
| training_steps | INT | 50010–5000 | Number of training steps. 500 is a good starting point. Increase for more images or complex subjects. |
| learning_rate | FLOAT | 0.00050.00001–0.1 | Learning rate. 0.0005 trains fast but may overshoot. Experiment with lowering for more stable/slower training. |
| lora_rank | INT | 164–128 | LoRA rank/dimension. 16-32 typical. Higher = more capacity but larger file and more VRAM. |
| vram_mode | COMBO | Low (768px) | VRAM optimization preset. Images are automatically resized to the specified resolution. |
| keep_lora | BOOLEAN | true | If True, keeps the trained LoRA file. |
| output_name | STRING | MyLora | Custom name for the output LoRA. Timestamp will be appended. |
| custom_python_exe | STRING | Advanced: 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_vae | BOOLEAN | false | Disable half-precision for VAE. Enable this if you get NaN errors during training with certain models. |
| image_1opt | IMAGE | Training image (not needed if images_path is set). | |
| caption_1opt | STRING | Caption for image_1. Overrides default caption. | |
| image_2opt | IMAGE | Training image. | |
| caption_2opt | STRING | Caption for image_2. Overrides default caption. | |
| image_3opt | IMAGE | Training image. | |
| caption_3opt | STRING | Caption for image_3. Overrides default caption. | |
| image_4opt | IMAGE | Training image. | |
| caption_4opt | STRING | Caption for image_4. Overrides default caption. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| lora_path | STRING | Path to the trained SDXL LoRA file. |