Realtime LoRA Trainer (FLUX Klein - Musubi Tuner)
Train LoRAs for FLUX Klein 4B and 9B
- image_1
- image_2
- image_3
- image_4
- lora_path
What it is
FLUX Klein is Black Forest Labs' small, fast, distilled Flux 2 line, and it's been the default local image editor since it shipped in January 2026 - four checkpoints at once, split across size (4B/9B) and distillation (base/distilled). This node trains on the base variants: Klein Base 4B or Klein Base 9B, the undistilled ones BFL says explicitly are not meant for generation, only for fine-tuning. Whatever LoRA comes out gets applied at inference against the distilled 4B or 9B model, same pattern as Z-Image Base training on this pack.
Why bother: Klein tolerates LoRA stacking noticeably better than Z-Image (community reports of three LoRAs at full strength on Klein 9B without the quality collapse Z-Image shows past two), and its 4B variant is Apache 2.0 - the only Flux 2 weight you can build a commercial LoRA on without a BFL licensing conversation. Training landed in every major trainer within three days of Klein's release, which tells you the ecosystem cared.
How it works
Musubi Tuner trains against the Klein base checkpoint, using the Qwen3 text encoder Klein was built around (Qwen3-4B for the 4B model, Qwen3-8B for the 9B) and the FLUX.2 VAE. The node's blocks_to_swap control here is deliberately separate from resolution and precision settings, so you can dial VRAM usage independently of image quality - useful given how much heavier the 9B variant is than the 4B.
Inputs and outputs that matter
model_variant- Klein Base 4B or Klein Base 9B. This decision drives everything downstream: the 4B needs a Qwen3-4B text encoder and roughly 13GB VRAM footprint, the 9B needs Qwen3-8B and closer to 29GB.dit_model,vae_model,text_encoderdropdowns, filled once you've downloaded the base (undistilled) checkpoint - not the distilled generation model - plus the matching Qwen3 encoder and the shared FLUX.2 VAE (ae.safetensors, the same file across all FLUX.2 variants).inputcountplusimage_N/caption_Npairs, orimages_pathfor a folder.training_steps(400),learning_rate(0.0001),lora_rank(32) - all deliberately lower/higher than this pack's older-architecture trainers, reflecting how sensitive current models are to a hot LR.blocks_to_swap(0–16) as an independent VRAM lever, plusvram_modewith eight presets from Max (1256px) down to Min (512px), several offering fp8 and fp8-offload variants.
Output is a single lora_path string, ready for ApplyTrainedLora.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/ShootTheSound/comfyUI-Realtime-Lora
Restart ComfyUI, install Musubi Tuner separately, and set musubi_path. From Hugging Face's black-forest-labs org, download flux-2-klein-base-4b.safetensors or flux-2-klein-base-9b.safetensors - the base, undistilled versions - plus ae.safetensors and the matching Qwen3-4B or Qwen3-8B text encoder. Dedicated example workflows for both sizes ship in the pack's workflows/Training/ folder.
Common issues
Downloaded the distilled model by mistake. BFL ships four Klein checkpoints and it's easy to grab the wrong one; only the base (undistilled) variants train correctly here.
9B running out of VRAM. The 9B is genuinely large - lean on blocks_to_swap first, then drop into an fp8 vram_mode preset, before concluding your card can't do it.
Applying a 4B LoRA to the 9B model or vice versa. The two sizes are not interchangeable; a LoRA trained on Klein Base 4B only applies to Klein 4B at inference, and the same goes for 9B. Publish and load for the size you actually trained on.
Inputs (24)
| Name | Type | Default | Description |
|---|---|---|---|
| model_variant | COMBO | Klein Base 4B | FLUX Klein model variant. 4B uses Qwen3-4B text encoder, 9B uses Qwen3-8B. |
| 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. |
| dit_model | COMBO | FLUX Klein DiT model (flux-2-klein-base-4b.safetensors or flux-2-klein-base-9b.safetensors) from diffusion_models folder. | |
| vae_model | COMBO | FLUX 2 VAE model (ae.safetensors from black-forest-labs/FLUX.2-dev) from vae folder. NOT the diffusers format VAE. | |
| text_encoder | COMBO | Qwen3 text encoder (qwen_3_4b.safetensors for 4B, qwen_3_8b.safetensors for 9B) 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 | 40010–5000 | Number of training steps. 400 is a good starting point. |
| learning_rate | FLOAT | 0.00010.00001–0.1 | Learning rate. 0.0001 is recommended for FLUX Klein training. |
| lora_rank | INT | 324–128 | LoRA rank/dimension. 32 is recommended for FLUX Klein. |
| blocks_to_swap | INT | 00–16 | Number of transformer blocks to swap to CPU for VRAM savings. Max 13 for 4B, 16 for 9B. 0 = no swapping. |
| vram_mode | COMBO | Low (768px) | VRAM optimization preset. Controls resolution, gradient checkpointing, and fp8 settings. |
| 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 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 FLUX Klein LoRA file. |