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

Realtime LoRA Trainer (Qwen Image Edit - Musubi Tuner)

Teach Qwen-Image-Edit a new editing behavior

By shootthesound·Created 8 months ago·Updated 2 months ago· 538
Realtime LoRA Trainer (Qwen Image Edit - Musubi Tuner)
    • lora_path
    images_path
    control_path
    musubi_path~/musubi-tuner
    model_modeQwen-Image-Edit-2509
    dit_model
    vae_model
    text_encoder
    training_steps500
    learning_rate0.0003
    lora_rank16
    vram_modeMedium (768px) fp8
    blocks_to_swap30
    keep_loratrue
    output_nameMyQwenEditLora
    custom_python_exe

    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_path and control_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_encoder dropdowns - 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), and blocks_to_swap (0 up to 45 blocks offloaded to CPU RAM).
    • output_name, keep_lora, custom_python_exe round 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.

    Categoryloaders

    Inputs (15)

    NameTypeDefaultDescription
    images_pathSTRINGPath to folder containing TARGET images (the edited results). Caption .txt files with matching names are used.
    control_pathSTRINGPath to folder containing CONTROL/SOURCE images (the inputs to edit). Must match target images by filename.
    musubi_pathSTRING~/musubi-tunerPath to musubi-tuner installation.
    model_modeCOMBOQwen-Image-Edit-2509Edit model variant. Edit-2509 is the newer version with improved editing.
    dit_modelCOMBOQwen Image Edit DiT model. Use qwen_image_edit_bf16 or qwen_image_edit_2509_bf16.
    vae_modelCOMBOQwen Image VAE model (qwen_image_vae.safetensors).
    text_encoderCOMBOQwen2.5-VL text encoder from text_encoders or clip folder.
    training_stepsINT50010–5000Number of training steps. 500 is a good starting point.
    learning_rateFLOAT0.00030.00001–0.1Learning rate. 3e-4 (0.0003) is recommended.
    lora_rankINT164–128LoRA rank/dimension. 16 is recommended.
    vram_modeCOMBOMedium (768px) fp8VRAM optimization preset.
    blocks_to_swapCOMBO30Number of transformer blocks to offload to CPU (0-45).
    keep_loraBOOLEANtrueIf True, keeps the trained LoRA file.
    output_nameSTRINGMyQwenEditLoraCustom 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.

    Outputs (1)

    NameTypeDescription
    lora_pathSTRINGPath to the trained Qwen Image Edit LoRA file.