Nodes/ComfyUI-FunPack/FunPack Train LoRA
ComfyUI Node

FunPack Train LoRA

Train a LoRA from a saved training set, on ComfyUI's own trainer. Saves it to the loras folder.

By digital-garbage·Created about a year ago·Updated about 21 hours ago· 20
FunPack Train LoRA
  • clip
  • vae
  • model
  • audio_vae
  • lora
◄set_name►
◄namefunpack_lora►
◄usenormal►
◄steps500►
◄learning_rate0►
◄rank16►
◄algorithmLoRA►
◄optimizerAdamW►
◄lossMSE►
◄batch_size1►
◄grad_accumulation1►
◄resolution512►
◄aspect_bucketsfalse►
◄frames33►
◄fps0.0►
◄startstart►
◄trigger►
◄seed0►
◄training_dtypebf16►
◄lora_dtypebf16►
◄gradient_checkpointingtrue►
◄offloadingfalse►
◄bypassfalse►
◄model_name►
◄weight_dtypedefault►
◄compute_dtypedefault►
◄postfix►
◄swap_blocks0►
◄preview_every0►
◄save_every0►
◄resume►
CategoryFunPack/Training

Inputs (35)

NameTypeDefaultDescription
clipCLIPThe text encoder that turns the captions into conditioning.
vaeVAEThe VAE that turns pictures and clips into latents.
set_nameSTRINGThe training set to learn from.
nameSTRINGfunpack_loraFile name of the finished LoRA (no extension). An earlier file is never overwritten.
useCOMBOnormalnormal: liked results and your own media. avoid: only the disliked results, for a LoRA you apply at negative strength. all: everything.
stepsINT5001–100000How many training steps.
learning_rateFLOAT01e-7–1How big each learning step is. Lower is safer and slower.
rankINT161–128How much the LoRA can learn. Higher holds more detail and makes a bigger file.
algorithmCOMBOLoRAThe adapter kind. LoRA is the common one.
optimizerCOMBOAdamWHow the weights are updated.
lossCOMBOMSEHow the error is measured.
batch_sizeINT11–64Samples per step. Models that train one sample at a time (H3) lower it to 1.
grad_accumulationINT11–256Steps added up before the weights change: a bigger batch for less memory.
resolutionINT51264–2048Training size in pixels per side. Each item is fitted to about this area, keeping its shape.
aspect_bucketsBOOLEANfalseKeep each picture's own shape (a few size groups) instead of one shape for all. Not used for H3.
framesINT331–1025Frames taken from each clip, for video models. H3 rounds to its own grid (17 x n + 5).
fpsFLOAT0.00–120Frames per second to read the clips at. 0 uses each clip's own rate (H3: 24).
startCOMBOstartWhere in a clip to take the frames from.
triggerSTRINGThe prefix: text put at the start of every caption, for example a word to call the LoRA up later.
seedINT00–18446744073709550000Seed for the noise and the LoRA's starting weights.
training_dtypeCOMBObf16Precision used while training. bf16 is right for nearly everything.
lora_dtypeCOMBObf16Precision the LoRA is stored in.
gradient_checkpointingBOOLEANtrueTrades speed for a lot less memory.
offloadingBOOLEANfalseKeeps model weights in system memory while training: slower, for cards that cannot hold the model.
bypassBOOLEANfalseApply the LoRA by hooks instead of changing weights. For quantized models.
model_nameSTRINGThe diffusion model file to train on, as the loader lists it. The trainer loads it itself, once, with no loader node in front.
weight_dtypeCOMBOdefaultHow the model file's weights are stored when it is loaded here.
compute_dtypeCOMBOdefaultWhat the maths runs in when the model is loaded here.
postfixSTRINGText put at the end of every caption.
swap_blocksINT00–128How many transformer blocks keep their weights in system memory, fetched one layer at a time: slower, and each one frees about a block's weight on the card. 0 keeps the whole model on the card.
preview_everyINT00–100000Pause every this many steps so the pipeline can make a preview with the LoRA so far. 0 never pauses.
save_everyINT00–100000Save a copy of the LoRA so far to the loras folder every this many steps, named <name>_step<N>. 0 saves only the finished one.
resumeSTRINGThe name of a paused run to carry on. Empty starts a new run.
modeloptMODELA model already loaded to train on. Leave empty and give model_name to have the trainer load the file itself, once.
audio_vaeoptVAEOnly for models that learn sound with the picture (H3): turns the clips' sound into latents.

Outputs (1)

NameTypeDescription
loraSTRING—