Nodes/ComfyUI Flux Trainer/Init Flux Training
ComfyUI Node

Init Flux Training

Full Flux fine-tuning (DreamBooth) in ComfyUI, not a LoRA

By kijai·Created 2 years ago·Updated about a year ago· 1,156
Init Flux Training
  • flux_models
  • dataset
  • optimizer_settings
  • resume_args
  • network_trainer
  • epochs_count
  • args
output_nameflux
output_dirflux_trainer_output
learning_rate0.0000
max_train_steps1500
apply_t5_attn_masktrue
t5xxl_max_token_length512
cache_latents
cache_text_encoder_outputs
weighting_scheme
logit_mean0.00
logit_std1.00
mode_scale1.29
loss_typel2
timestep_sampling
sigmoid_scale1.0
model_prediction_type
cpu_offload_checkpointingtrue
optimizer_fusing
blocks_to_swap0
guidance_scale1.00
discrete_flow_shift1.0000
highvramfalse
fp8_basefalse
gradient_dtypebf16
save_dtypebf16
attention_modesdpa
sample_promptsillustration of a kitten | photograph of a turtle
additional_args

Note the missing word: this is InitFluxTraining, not LoRA Training. This node does a full fine-tune of the Flux model - the DreamBooth path - where you're updating the actual model weights instead of training a small adapter on top. It's the heavyweight cousin of InitFluxLoRATraining, and it's the one you reach for when a LoRA isn't cutting it and you want a full checkpoint out the other end.

Full fine-tuning consistently produces better quality than a LoRA - that's the settled community verdict - but it's far more demanding on hardware and it produces multi-gigabyte checkpoints instead of a tidy few-megabyte adapter. The usual advice holds: LoRA for personal and creative projects, full fine-tune for a base model you intend to distribute widely. Kijai's README flags this path as "untested" relative to the LoRA nodes, so go in expecting rough edges.

How it works

Same shape as the rest of the pack. Required inputs are flux_models (from FluxTrainModelSelect), a dataset JSON, and optimizer_settings. It builds the trainer and outputs network_trainer (NETWORKTRAINER) for a FluxTrainLoop node to step through, plus epochs_count and raw args. The difference from the LoRA node is what's not here - there's no network_dim/network_alpha, because you're not building a low-rank network, you're training the model itself.

The inputs that matter

  • learning_rate (default 4e-6) - much lower than the LoRA default, and correctly so. Full fine-tunes want a gentler learning rate because every weight is in play.
  • blocks_to_swap - this is the load-bearing knob for full Flux fine-tuning. Block swapping offloads transformer blocks to system RAM, and it's what brought Flux DreamBooth down to famously low VRAM figures. Expect to need 32GB+ of system RAM to lean on it.
  • cpu_offload_checkpointing (default true) and fp8_base - more memory relief. Full fine-tuning is a VRAM fight and these are your tools.
  • optimizer_fusing (fused_backward_pass or blockwise_fused_optimizers) - a memory optimization specific to the full-training path that fuses the optimizer step into the backward pass. Leave it on the default unless you have a reason.
  • guidance_scale, timestep_sampling, discrete_flow_shift - the Flux flow-matching controls, shared with the LoRA node; the defaults are the starting point.

Installing the pack

ComfyUI Manager: search ComfyUI Flux Trainer, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-FluxTrainer
pip install -r ComfyUI-FluxTrainer/requirements.txt

Torch 2.4.0+ recommended. Critically, for full model training the README says you need the fp16 version of the main model - not the fp8 file you might use for LoRA work. And your VAE has to be the non-diffusers ae.safetensors.

Common issues

You almost certainly want a LoRA instead. Be honest about why you're here. Full fine-tuning eats VRAM, time, and disk, and for a character or style the community's near-universal answer is that a well-trained LoRA gets you most of the way at a fraction of the cost. Reach for this node when you're building a base model to hand out, not to teach Flux one face.

Wrong model precision. If you loaded the fp8 model expecting full training to work, it won't behave - full fine-tuning wants the fp16 main model per the README.

It's the untested path. Kijai's own words. The LoRA nodes get the attention; this one is more likely to surprise you. Do a short validation run and watch VRAM before you commit to a long job.

CategoryFluxTrainer

Inputs (32)

NameTypeDefaultDescription
flux_modelsTRAIN_FLUX_MODELS
datasetJSON
optimizer_settingsARGS
output_nameSTRINGflux
output_dirSTRINGflux_trainer_outputpath to dataset, root is the 'ComfyUI' folder, with windows portable 'ComfyUI_windows_portable'
learning_rateFLOAT0.00000–10learning rate
max_train_stepsINT15001–100000max number of training steps
apply_t5_attn_maskBOOLEANtrueapply t5 attention mask
t5xxl_max_token_lengthINT51264–4096dev and LibreFlux uses 512, schnell 256
cache_latentsCOMBOcaches text encoder outputs
cache_text_encoder_outputsCOMBOcaches text encoder outputs
weighting_schemeCOMBO5 options: logit_normal, sigma_sqrt, mode, cosmap, none
logit_meanFLOAT0.000–1mean to use when using the logit_normal weighting scheme
logit_stdFLOAT1.000–1std to use when using the logit_normal weighting scheme
mode_scaleFLOAT1.290–10Scale of mode weighting scheme. Only effective when using the mode as the weighting_scheme
loss_typeCOMBOl2loss type
timestep_samplingCOMBOMethod to sample timesteps: sigma-based, uniform random, sigmoid of random normal and shift of sigmoid (recommend value of 3.1582 for discrete_flow_shift)
sigmoid_scaleFLOAT1.00–10Scale factor for sigmoid timestep sampling (only used when timestep-sampling is sigmoid
model_prediction_typeCOMBOHow to interpret and process the model prediction: raw (use as is), additive (add to noisy input), sigma_scaled (apply sigma scaling)
cpu_offload_checkpointingBOOLEANtrueoffload the gradient checkpointing to CPU. This reduces VRAM usage for about 2GB
optimizer_fusingCOMBOreduces memory use
blocks_to_swapINT00–100Sets the number of blocks (~640MB) to swap during the forward and backward passes, increasing this number lowers the overall VRAM used during training at the expense of training speed (s/it).
guidance_scaleFLOAT1.001–32guidance scale
discrete_flow_shiftFLOAT1.00000–10for the Euler Discrete Scheduler, default is 3.0
highvramBOOLEANfalsememory mode
fp8_baseBOOLEANfalseuse fp8 for base model
gradient_dtypeCOMBObf16to use the full fp16/bf16 training
save_dtypeCOMBObf16the dtype to save checkpoints as
attention_modeCOMBOsdpamemory efficient attention mode
sample_promptsSTRINGillustration of a kitten | photograph of a turtlevalidation sample prompts, for multiple prompts, separate by `|`
additional_argsoptSTRINGadditional args to pass to the training command
resume_argsoptARGSresume args to pass to the training command

Outputs (3)

NameTypeDescription
network_trainerNETWORKTRAINER
epochs_countINT
argsKOHYA_ARGS