Nodes/ComfyUI Flux Trainer/Init SD3 LoRA Training
ComfyUI Node

Init SD3 LoRA Training

LoRA training for SD3.5 inside ComfyUI

By kijai·Created 2 years ago·Updated about a year ago· 1,156
Init SD3 LoRA Training
  • sd3_models
  • dataset
  • optimizer_settings
  • resume_args
  • block_args
  • loss_args
  • network_trainer
  • epochs_count
  • args
output_namesd35_lora
output_dirsd35_trainer_output
network_dim16
network_alpha16.00
learning_rate0.0001
max_train_steps1500
cache_latents
cache_text_encoder_outputs
training_shift 3.0000
highvramfalse
blocks_to_swap0
fp8_basefalse
gradient_dtypefp32
save_dtypebf16
attention_modesdpa
train_text_encoderdisabled
clip_l_lr0.0000
clip_g_lr0.0000
T5_lr0.0000
sample_promptsillustration of a kitten | photograph of a turtle
gradient_checkpointingenabled
additional_args

The SD3/SD3.5 sibling of the Init family. If you're training a LoRA for Stable Diffusion 3.5 and you'd rather do it in ComfyUI than spin up Kohya separately, InitSD3LoRATraining is the node that configures and launches the run. It's the least-trafficked of the three Init nodes for a reason - SD3.5 never grew the training community that Flux and SDXL did - but if that's your base model, this is your node.

Like the rest of the pack, it wraps kohya-ss/sd-scripts, so the knobs and their names are Kohya's. SD3.5 shares Flux's DNA in the ways that matter to a trainer: it's a flow-matching model with a T5 text encoder alongside the CLIP pair, which is why you'll see flow-shift and T5 options here that SDXL doesn't have.

How it works

You feed it three required inputs - sd3_models (type TRAIN_SD3_MODELS), a dataset JSON, and optimizer_settings from an OptimizerConfig node - and it builds a trainer. The output network_trainer (NETWORKTRAINER) goes into a FluxTrainLoop node to run steps, exactly like the Flux and SDXL paths; the loop machinery is shared. You also get epochs_count and the raw Kohya args.

The inputs that matter

  • network_dim (default 16) and network_alpha (default 16) - a reasonable 1:1 starting point.
  • learning_rate (default 1e-4) - a sensible default for this architecture family.
  • max_train_steps (default 1500) - scale to your dataset.
  • training_shift (default 3) - the flow-matching timestep shift, specific to SD3-style models. The default is a fine starting point; it's not a knob to fiddle with blind.
  • train_text_encoder - this one exposes the full menu (clip_l, clip_l+T5, and fp8 variants). On modern flow-matching bases you generally leave the text encoders frozen and just cache their outputs, so disabled is the safe default. Caching (cache_text_encoder_outputs) is also your biggest speed win here.
  • blocks_to_swap and fp8_base - the usual VRAM levers.

Installing the pack

Via ComfyUI Manager: search ComfyUI Flux Trainer, install, restart. Or manually:

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

Torch 2.4.0+ is recommended, and the examples pull in kijai's ComfyUI-KJNodes. Use the normal fp8/fp16 SD3.5 model files, and - as with Flux - make sure any VAE you supply is the standard non-diffusers safetensors, not the diffusers folder version.

Common issues

Fewer guides exist for SD3.5. This is the honest one. The training community largely skipped SD3.5, so you'll find far fewer copy-paste recipes than for SDXL or Flux. Lean on the pack's example workflows and the general flow-matching intuition (frozen encoders, cache the outputs, moderate learning rate) rather than hunting for an SD3.5-specific settings table that may not exist.

Dataset setup is the same trap as everywhere else. A bad or empty dataset JSON throws an opaque parse error. Build your dataset with the pack's dataset node, keep captions in .txt files next to the images, and make sure the folder path resolves before you start.

It's experimental. Kijai's README is blunt that the whole thing is work-in-progress and that his defaults aren't necessarily good. Validate on a short run before committing hours of GPU time.

CategoryFluxTrainer/SD3

Inputs (28)

NameTypeDefaultDescription
sd3_modelsTRAIN_SD3_MODELS
datasetJSON
optimizer_settingsARGS
output_nameSTRINGsd35_lora
output_dirSTRINGsd35_trainer_outputpath to dataset, root is the 'ComfyUI' folder, with windows portable 'ComfyUI_windows_portable'
network_dimINT161–2048network dim
network_alphaFLOAT16.000–2048network alpha
learning_rateFLOAT0.00010–10learning rate
max_train_stepsINT15001–100000max number of training steps
cache_latentsCOMBOcaches text encoder outputs
cache_text_encoder_outputsCOMBOcaches text encoder outputs
training_shift FLOAT3.00000–10shift value for the training distribution of timesteps
highvramBOOLEANfalsememory mode
blocks_to_swapINT00–100option for memory use reduction. The maximum number of blocks that can be swapped is 36 for SD3.5L and 22 for SD3.5M
fp8_baseBOOLEANfalseuse fp8 for base model
gradient_dtypeCOMBOfp32the actual dtype training uses
save_dtypeCOMBObf16the dtype to save checkpoints as
attention_modeCOMBOsdpamemory efficient attention mode
train_text_encoderCOMBOdisabledalso train the selected text encoders using specified dtype, T5 can not be trained without clip_l
clip_l_lrFLOAT0.00000–10text encoder learning rate
clip_g_lrFLOAT0.00000–10text encoder learning rate
T5_lrFLOAT0.00000–10text encoder learning rate
sample_promptsSTRINGillustration of a kitten | photograph of a turtlevalidation sample prompts, for multiple prompts, separate by `|`
gradient_checkpointingCOMBOenableduse gradient checkpointing
additional_argsoptSTRINGadditional args to pass to the training command
resume_argsoptARGSresume args to pass to the training command
block_argsoptARGSlimit the blocks used in the LoRA
loss_argsoptARGSloss args

Outputs (3)

NameTypeDescription
network_trainerNETWORKTRAINER
epochs_countINT
argsKOHYA_ARGS