Nodes/Realtime LoRA Trainer/Realtime LoRA Trainer (Z-Image - Musubi Tuner)
ComfyUI Node

Realtime LoRA Trainer (Z-Image - Musubi Tuner)

Train a Z-Image LoRA without leaving ComfyUI

By shootthesound·Created 8 months ago·Updated 2 months ago· 538
Realtime LoRA Trainer (Z-Image - Musubi Tuner)
  • image_1
  • image_2
  • image_3
  • image_4
  • lora_path
inputcount4
images_path
musubi_path~/musubi-tuner
dit_model
vae_model
text_encoder
captionphoto of subject
training_steps400
learning_rate0.0002
lora_rank16
vram_modeLow (768px)
keep_loratrue
output_nameMyLora
custom_python_exe
caption_1
caption_2
caption_3
caption_4

Z-Image LoRA training normally means leaving ComfyUI, wrangling a separate trainer's config files, and coming back once it's done. This node skips that: drop in your images, point it at a Musubi Tuner install, and it trains the LoRA as a queued job in your workflow, handing you a path you can plug straight into a loader.

What it is and why you'd reach for it

Musubi Tuner (by kohya-ss, the same author behind sd-scripts) is one of two Musubi-family Z-Image training paths this pack ships - the other being AI-Toolkit. The README recommends Musubi for Z-Image specifically: no diffusers dependency, faster runs, smaller output files. Community numbers back that up - a character LoKr on Z-Image via Musubi lands around 32 minutes on a 5090 for 22 images at 2,200 steps, and this node's own default preset (400 steps, rank 16, learning rate 0.0002) is aimed at that same quick-iteration territory rather than a polished final LoRA.

The point of running this inside ComfyUI rather than a standalone trainer is the loop: train here, wire lora_path straight into one of the pack's selective loaders, and see which blocks your freshly trained subject actually landed in - without ever leaving the graph.

The one thing you need to know about Z-Image training

Z-Image ships in two flavors: the distilled Turbo you generate with, and an undistilled base model that's the one you're actually supposed to train on. The README is explicit about this - download the de-distilled model (ostris/Z-Image-De-Turbo on HuggingFace) into models/diffusion_models, train against that, and the resulting LoRA works on the regular Turbo model you already have installed. Skipping straight to training on Turbo is the single most common way to get a LoRA that looks fine in isolation and fights the base model at inference.

Inputs and outputs that matter

  • images_path - a folder of training images (with .txt caption files if you're batch-training), or use the inputcount slider plus the image_1-image_4 / caption_1-caption_4 optional inputs for a small, hand-picked set.
  • musubi_path - where you installed Musubi Tuner (default ~/musubi-tuner). The node just needs the path; you never open that environment yourself.
  • dit_model, vae_model, text_encoder - dropdowns populated from your model folders, pointing at the de-distilled DiT, its VAE, and the text encoder.
  • caption - a default caption applied if you didn't supply per-image ones; rare-token trigger words (ohwx, styl3name-style tokens) are still the standard trick to avoid vocabulary collisions.
  • training_steps (default 400), learning_rate (default 0.0002), lora_rank (default 16) - the README is blunt that these are starting points, not tuned values: the default LR is "already high," and if a LoRA looks overcooked or the subject bleeds into everything, drop it toward 0.0001 or 0.00005 before raising steps.
  • vram_mode - eight presets from Min (512px) up through Max (1256px) fp8 offload; Low (768px) is the shipped default.
  • output_name, keep_lora - name the file and decide whether to keep it after the run.
  • Output: lora_path - a string you feed directly into the pack's lora_path_opt input on any Z-Image selective loader or analyzer, or the Apply Trained LoRA node.

Installing it

The node ships with the pack itself - ComfyUI Manager search "Realtime LoRA Trainer," or:

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

Restart ComfyUI. That gets you the node. Actually training needs Musubi Tuner installed separately (kohya-ss/musubi-tuner on GitHub, follow its own install docs) and the de-distilled Z-Image model downloaded - the README calls this out explicitly as the one part that isn't "install and go." If you only want to load and analyze existing LoRAs, none of this applies; that half of the pack works with zero extra install.

Troubleshooting

Nothing happens, or it errors immediately. Check musubi_path actually points at a working Musubi Tuner checkout, and that dit_model resolved to the de-distilled model rather than an empty dropdown - an empty choices: 0 dropdown means ComfyUI can't see any matching files in the expected folder yet.

Training runs but the LoRA looks overcooked or bleeds the subject into everything. That's the README's own diagnosis for too-high a learning rate at the default 0.0002 - lower it before adding more steps.

LoRA works fine on Turbo but the identity feels weak. Double-check you trained against the de-distilled base model and not the Turbo checkpoint directly; training on Turbo is the shortcut that produces LoRAs which don't transfer cleanly.

Categoryloaders

Inputs (22)

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.
musubi_pathSTRING~/musubi-tunerPath to musubi-tuner installation.
dit_modelCOMBOZ-Image DiT model (transformer) from diffusion_models folder.
vae_modelCOMBOZ-Image VAE model from vae folder.
text_encoderCOMBOQwen3 text encoder from text_encoders or clip folder.
captionSTRINGphoto of subjectDefault caption for all images. Per-image caption inputs override this.
training_stepsINT40010–5000Number of training steps. 400 is a good starting point.
learning_rateFLOAT0.00020.00001–0.1Learning rate. 0.0002 is recommended for Z-Image training.
lora_rankINT164–128LoRA rank/dimension. 16 is recommended for Z-Image.
vram_modeCOMBOLow (768px)VRAM optimization preset. Low/Min always use fp8. Min adds pre-caching for lowest VRAM.
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 musubi_path. The musubi_path field is still required for locating training scripts.
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 Z-Image LoRA file (ComfyUI format).