Nodes/Lora-Training-in-Comfy/Lora Training in Comfy (Advanced)
ComfyUI Node

Lora Training in Comfy (Advanced)

Every kohya knob, still inside ComfyUI

By LarryJane491·Created 3 years ago·Updated 2 years ago· 544
Lora Training in Comfy (Advanced)
      ckpt_name
      v2
      networkmodule
      networkdimension32
      networkalpha32
      trainingresolution512
      data_pathInsert path of image folders
      batch_size1
      max_train_epoches10
      save_every_n_epochs10
      keeptokens0
      minSNRgamma0.0
      learningrateText0.0001
      learningrateUnet0.0001
      learningRateScheduler
      lrRestartCycles1
      optimizerType
      output_nameDesired name for LoRA.
      algorithm
      networkDropout0.0
      clip_skip2
      output_dirmodels/loras

      This is the same trainer as the plain Lora Training in ComfyUI node - same underlying kohya-derived script, same "runs inside the graph, saves straight to your loras folder" behavior - but with the hood popped. Where the basic node gives you eight fields, this hands you the parameter surface community LoRA guides have been written against for years: network dimension and alpha, optimizer choice, LR scheduler, LyCORIS algorithm, the works. If you've read a Kohya settings dump on Reddit or CivitAI and wondered where to plug those numbers in inside ComfyUI, this node is the answer.

      Worth knowing up front, in the author's own words: "The Advanced node is full of many recommended features... Not everything was tested, I personally don't even know what most of these do." That's an honest map of where to spend your attention. A handful of these fields decide the outcome of your run; the rest exist for people who already know why they're reaching for them. Change the first group deliberately, leave the second at default until a result tells you otherwise.

      How it works

      Same mechanism as the basic node - point it at a checkpoint and a captioned dataset, queue the prompt, and a kohya-style training run executes in the background, writing progress to your console and a finished .safetensors to disk. This node adds no output socket either; it's an endpoint, not a pass-through.

      The inputs worth setting deliberately

      • ckpt_name and data_path work exactly as they do on the basic node - same folder-naming gotcha applies (data_path is the folder above your [repeats]_[name] image directory, not the directory itself).
      • algorithm - the LyCORIS method: lora (plain, the safest default), loha, lokr, ia3, dylora, or locon. LoCon extends adaptation into convolution layers and is the classic pick for exact character/style reproduction on SD-lineage models; LoKr has become the go-to for character LoRAs on newer architectures elsewhere in the ecosystem, but that finding is from Flux/Z-Image-era training - on this SD 1.5/2.0 pack, plain lora or locon is the well-trodden path. To use anything beyond plain LoRA, also flip networkmodule from networks.lora to lycoris.kohya - that's the switch that actually unlocks the LyCORIS backend.
      • networkdimension / networkalpha - rank and its scaling factor. Higher dimension means more capacity (and a bigger file); alpha scales the LoRA's effective strength. The defaults (32/32) are a reasonable SD 1.5 starting point.
      • optimizerType - AdamW8bit is the safe default and still fine for this era of training. prodigy auto-tunes the learning rate for you (pair it with learningrateText/learningrateUnet set to 1) if you don't want to hand-tune LR. The others (Lion8bit, SGDNesterov8bit, AdaFactor) are for people already chasing a specific tradeoff.
      • learningrateText / learningrateUnet - separate learning rates for the text encoder and the U-Net. This is SD 1.5/2.0-era architecture, where the text encoder is still trainable (unlike the newer LLM-encoder models, where it's frozen entirely) - so these two actually matter here.
      • output_name and output_dir - same as the basic node; output_dir defaults to models/loras.

      The rest - v2 (only flip to Yes if your checkpoint is genuinely SD 2.0), trainingresolution (512 for SD 1.5, bump to 768 for SD 2.0-class models), keeptokens, minSNRgamma, learningRateScheduler, lrRestartCycles, networkDropout, and clip_skip - are real kohya flags with real effects, but they're refinements. networkDropout in particular is a regularization dial worth nudging up a little if you're overfitting a very small dataset; leave everything else at its shipped default until a specific result tells you to change it.

      How to install it

      It ships in the same pack as the basic node, so one install covers both:

      • ComfyUI Manager - search "Lora-Training-in-Comfy", install, restart.
      • Manual:
        cd ComfyUI/custom_nodes
        git clone https://github.com/LarryJane491/Lora-Training-in-Comfy
        
        then install requirements_win.txt (Windows) or the equivalent, and restart. Activate your venv first if ComfyUI runs in one - that's the most common reason people see "module not found" right after install.

      Common issues & troubleshooting

      Everything on the basic node's list applies here too - dependency conflicts from the shared Python environment, CUDA/PyTorch mismatches, the data-path parent-folder trap. Two things specific to going Advanced:

      Changing algorithm without changing networkmodule. Picking loha or lokr does nothing unless networkmodule is also set to lycoris.kohya. Left on networks.lora, you'll just train a plain LoRA regardless of what the algorithm dropdown says.

      Tuning too many dials at once. With this many fields exposed, it's tempting to change everything in one run. Don't - if the result looks off, you won't know whether it was the optimizer, the rank, or the scheduler. Change one axis at a time, and lean on save_every_n_epochs so you can compare checkpoints instead of guessing from the final one.

      CategoryLJRE/LORA

      Inputs (22)

      NameTypeDefaultDescription
      ckpt_nameCOMBO0 options:
      v2COMBO2 options: No, Yes
      networkmoduleCOMBO2 options: networks.lora, lycoris.kohya
      networkdimensionINT32
      networkalphaINT32
      trainingresolutionINT512
      data_pathSTRINGInsert path of image folders
      batch_sizeINT1
      max_train_epochesINT10
      save_every_n_epochsINT10
      keeptokensINT0
      minSNRgammaFLOAT0.0
      learningrateTextFLOAT0.0001
      learningrateUnetFLOAT0.0001
      learningRateSchedulerCOMBO6 options: cosine_with_restarts, linear, cosine, polynomial, constant, constant_with_warmup
      lrRestartCyclesINT1
      optimizerTypeCOMBO5 options: AdamW8bit, Lion8bit, SGDNesterov8bit, AdaFactor, prodigy
      output_nameSTRINGDesired name for LoRA.
      algorithmCOMBO6 options: lora, loha, lokr, ia3, dylora, locon
      networkDropoutFLOAT0.0
      clip_skipINT2
      output_dirSTRINGmodels/loras

      Outputs (0)

      No outputs