Realtime LoRA Trainer (Qwen Image Edit - Musubi Tuner)
Teach Qwen-Image-Edit a new editing behavior
- lora_path
What it is
This node trains a LoRA that teaches Qwen-Image-Edit a specific transformation rather than a look - feed it pairs of "before" and "after" images and it learns the edit, not the subject. Qwen-Image-Edit is Alibaba's Apache 2.0 instruction editor and, by the community's own account, the model that made a chunk of masked inpainting and ControlNet posing pipelines obsolete: you describe the change in a sentence and it happens. This node is how you extend that vocabulary yourself - train a LoRA for a specific relighting style, a garment swap, a pose transfer, anything you can demonstrate with matched image pairs, and it becomes another instruction the model understands.
This is a genuinely different job from MusubiQwenImageLoraTrainer next door, which trains plain style/subject LoRAs from single images. If you're teaching a look, use that one. If you're teaching an action, this is it.
How it works
Under the hood it's Musubi Tuner again, but wired for paired training data: a folder of target (after) images and a separate folder of control (before) images, matched by filename. Musubi feeds both sides through Qwen-Image-Edit's dual-encoding path - the model reads the control image for semantic content and the VAE for pixel-level structure - and trains the LoRA against the difference. Text embeddings get cached up front, same as every other current-gen trainer in this pack.
Inputs and outputs that matter
images_pathandcontrol_path- two separate folders: the target/after images, and their matching control/before images. This is the field that makes it a pair trainer instead of a single-image one.model_mode- Qwen-Image-Edit or Qwen-Image-Edit-2509 (the newer, better-consistency revision most community LoRAs target).dit_model,vae_model,text_encoderdropdowns - again, bf16 builds only; the pack's README is explicit that pre-quantized fp8 doesn't train.training_steps(500),learning_rate(0.0003),lora_rank(16),vram_mode(six presets, Max 1024px down to Low 512px, each with an fp8 option), andblocks_to_swap(0 up to 45 blocks offloaded to CPU RAM).output_name,keep_lora,custom_python_exeround it out.
Output is a single lora_path string for ApplyTrainedLora or a Qwen Selective Loader downstream.
Installing it
Same pack, same install path - ComfyUI Manager (search "Realtime LoRA Trainer") or:
cd ComfyUI/custom_nodes
git clone https://github.com/ShootTheSound/comfyUI-Realtime-Lora
Restart ComfyUI. Musubi Tuner needs its own separate install with the path set in musubi_path. Download the bf16 DiT for whichever Edit model you picked (Comfy-Org hosts them), plus qwen_image_vae.safetensors and the qwen_2.5_vl_7b.safetensors text encoder - the pack's example workflows link the exact files, including a dedicated "Qwen image Edit with Control images pairs" demo.
Common issues
Mismatched pairs. The control and target folders need matching filenames so Musubi knows which "before" goes with which "after" - a mismatch here is the most likely cause of a LoRA that learns nothing coherent.
fp8 models in the dropdowns. Same trap as the rest of this pack's Musubi trainers: only bf16 works for training. If dit_model or text_encoder show nothing, or training behaves oddly, check the precision of what you downloaded.
Underestimating VRAM. This is a 20B model doing dual-encoded editing training, heavier than the plain Qwen-Image trainer next to it - lean on blocks_to_swap and the fp8 vram_mode presets before assuming your card can't do it.
Result doesn't generalize. If your control/target pairs are too narrow (one lighting condition, one subject), the LoRA will overfit to that specific pair rather than learning the general transformation - vary the subjects in your dataset even if the edit itself stays consistent.
Inputs (15)
| Name | Type | Default | Description |
|---|---|---|---|
| images_path | STRING | Path to folder containing TARGET images (the edited results). Caption .txt files with matching names are used. | |
| control_path | STRING | Path to folder containing CONTROL/SOURCE images (the inputs to edit). Must match target images by filename. | |
| musubi_path | STRING | ~/musubi-tuner | Path to musubi-tuner installation. |
| model_mode | COMBO | Qwen-Image-Edit-2509 | Edit model variant. Edit-2509 is the newer version with improved editing. |
| dit_model | COMBO | Qwen Image Edit DiT model. Use qwen_image_edit_bf16 or qwen_image_edit_2509_bf16. | |
| vae_model | COMBO | Qwen Image VAE model (qwen_image_vae.safetensors). | |
| text_encoder | COMBO | Qwen2.5-VL text encoder from text_encoders or clip folder. | |
| training_steps | INT | 50010–5000 | Number of training steps. 500 is a good starting point. |
| learning_rate | FLOAT | 0.00030.00001–0.1 | Learning rate. 3e-4 (0.0003) is recommended. |
| lora_rank | INT | 164–128 | LoRA rank/dimension. 16 is recommended. |
| vram_mode | COMBO | Medium (768px) fp8 | VRAM optimization preset. |
| blocks_to_swap | COMBO | 30 | Number of transformer blocks to offload to CPU (0-45). |
| keep_lora | BOOLEAN | true | If True, keeps the trained LoRA file. |
| output_name | STRING | MyQwenEditLora | 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 musubi_path. The musubi_path field is still required for locating training scripts. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| lora_path | STRING | Path to the trained Qwen Image Edit LoRA file. |