Realtime LoRA Trainer (Qwen Image - Musubi Tuner)
Train Qwen-Image style and subject LoRAs in ComfyUI
- image_1
- image_2
- image_3
- image_4
- lora_path
What it is
MusubiQwenImageLoraTrainer trains a LoRA on Alibaba's Qwen-Image family - the 20B Apache 2.0 model best known for its text rendering and complex prompt adherence - right inside your ComfyUI graph. It runs on Musubi Tuner, Kohya's second trainer (the one that split off sd-scripts to chase newer architectures), and it's the plain generation-side trainer in this pack: no control images, no before/after pairs, just style or subject LoRAs from a set of reference images. If you want to teach the model an editing behavior instead of a look, that's a different node in this pack, MusubiQwenImageEditLoraTrainer.
Qwen-Image itself isn't most people's daily driver for text-to-image - it's heavier than Z-Image or Flux Klein - but its Apache 2.0 license means no platform will pull your LoRA for a licensing technicality, and the text-rendering strength carries through to fine-tunes. If your subject involves signage, labels, or in-image text, this is a reasonable place to put the training budget.
How it works
The node drives Musubi Tuner's own training pipeline against whichever Qwen-Image variant you point it at - the mode selector covers plain Qwen-Image as well as the Edit line's checkpoints, in case you want to train a style LoRA that happens to run on the edit model too. Musubi Tuner caches text embeddings once up front, which is the standard modern-trainer speed lever now that text encoders on current-gen models are frozen language models rather than something you'd fine-tune.
Inputs and outputs that matter
model_mode- Qwen-Image, Qwen-Image-Edit, or Qwen-Image-Edit-2509, all trainable from plain images through this node.dit_model,vae_model,text_encoder- dropdowns populated from your local model folders; the README is explicit that you need the bf16 builds here, not the pre-quantized fp8 ones, which don't work for training.inputcountplusimage_N/caption_Npairs, orimages_pathfor a folder.training_steps(500 default),learning_rate(0.0003),lora_rank(16).vram_mode- six presets from Max (1024px) down to Low (512px), each with an fp8 variant for lower memory use during inference-side ops.blocks_to_swap- an enum from 0 up to 45, Musubi's block-offloading control: the higher the number, the more transformer blocks get pushed to CPU RAM to save VRAM, at a speed cost.
Output is a single lora_path string, ready for ApplyTrainedLora or the Qwen Selective Loader.
Installing it
The node itself installs with the rest of the pack - ComfyUI Manager (search "Realtime LoRA Trainer") or:
cd ComfyUI/custom_nodes
git clone https://github.com/ShootTheSound/comfyUI-Realtime-Lora
Restart ComfyUI. Training won't work until Musubi Tuner is installed separately and its path is set in musubi_path. You'll also need to download the specific models by hand: the bf16 DiT (qwen_image_bf16.safetensors from Comfy-Org, or the Edit variant), qwen_image_vae.safetensors, and qwen_2.5_vl_7b.safetensors as the text encoder. The example workflows link the exact files.
Common issues
Training silently underperforms or errors with fp8 models. This is the single most common trap the README flags directly: pre-quantized fp8 Qwen-Image models don't work for training, only bf16. If your dropdowns are empty or training behaves strangely, check you downloaded the right precision.
Running out of VRAM. Qwen-Image is a 20B model - raise blocks_to_swap before you drop resolution, and switch to an fp8 vram_mode preset if you're still tight. Musubi's own guidance recommends 12GB VRAM and 64GB system RAM as a reasonable floor for image models.
Python version. Same as this pack's other trainers: 3.10–3.12, skip 3.13.
Inputs (24)
| 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. | |
| musubi_path | STRING | ~/musubi-tuner | Path to musubi-tuner installation. |
| model_mode | COMBO | Qwen-Image | Model type. Use Qwen-Image for text-to-image, Edit variants for image editing models. For edit training WITH control images, use the separate Edit trainer node. |
| dit_model | COMBO | Qwen Image DiT model from diffusion_models folder. Match model to selected mode. | |
| vae_model | COMBO | Qwen Image VAE model from vae folder (qwen_image_vae.safetensors). | |
| text_encoder | COMBO | Qwen2.5-VL text encoder from text_encoders or clip folder. | |
| 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. |
| learning_rate | FLOAT | 0.00030.00001–0.1 | Learning rate. 3e-4 (0.0003) is recommended for Qwen Image training. |
| lora_rank | INT | 164–128 | LoRA rank/dimension. 16 is recommended for Qwen Image. |
| vram_mode | COMBO | Medium (768px) fp8 | VRAM optimization preset. Controls resolution, fp8, and gradient checkpointing. |
| blocks_to_swap | COMBO | 30 | Number of transformer blocks to offload to CPU (0-45). Higher = less VRAM but slower. 30 is a good balance. |
| keep_lora | BOOLEAN | true | If True, keeps the trained LoRA file. |
| output_name | STRING | MyQwenLora | 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. | |
| 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 Qwen Image LoRA file. |