Nodes/Lora-Training-in-Comfy/Lora Training in ComfyUI
ComfyUI Node

Lora Training in ComfyUI

Train a LoRA without ever leaving the graph

By LarryJane491·Created 3 years ago·Updated 2 years ago· 544
Lora Training in ComfyUI
      ckpt_name
      data_pathInsert path of image folders
      batch_size1
      max_train_epoches10
      save_every_n_epochs10
      output_nameDesired name for LoRA.
      clip_skip2
      output_dirmodels/loras

      Most LoRA trainers make you leave ComfyUI: export a dataset, run a separate script or GUI, wait, then import the result back in. This node skips that dance. It runs kohya-style LoRA training as a node in your graph - hit Queue Prompt, and the finished LoRA lands straight in models/loras by default, ready to select after a refresh. No copying files around, no second app to babysit.

      Under the hood it isn't reinventing training - it's a repackaged version of the community's lora-scripts launcher (the same lineage that spawned the Kohya GUI everyone's guides are written against), stripped of its own UI and wired into ComfyUI's node system instead. The author's own words: "I took that project, got rid of the UI, translated this launcher script into Python, and adapted it to ComfyUI." That matters for expectations - this is classic SD 1.5/SD 2.0/SD Turbo/LCM training, the README never confirms SDXL, and nothing here targets Flux or Z-Image; those run on separate recipes with newer trainers. If you're training against an SD 1.5 or SD 2.0 checkpoint, though, this is about as low-friction as it gets.

      How it works

      Point it at a captioned image folder and a base checkpoint, set a few knobs, and queue the prompt - it kicks off a full kohya-derived training run in the background, with progress scrolling by in your ComfyUI console like any other job. There's no output socket to wire anywhere; this node is the endpoint, and the "output" is a .safetensors file written to disk.

      The inputs that matter

      Most of the required fields exist so you can set-and-forget them; three are worth actually thinking about:

      • ckpt_name - the base checkpoint you're training on top of. Pick the SD 1.5/2.0/Turbo/LCM model whose style or behavior you want the LoRA to build on. Confirmed on this trio by the author personally.
      • data_path - this is the one everyone trips over, so read it twice. Your images (with matching caption .txt files) need to live in a folder named like [repeats]_[anything], e.g. 5_myconcept. data_path is not that folder - it's the folder above it. If your images are in C:/database/5_myconcept, data_path is C:/database. Get this backwards and training either errors out immediately or silently trains on nothing.
      • output_name - whatever you type here is the LoRA's filename. Pick something you'll recognize in a dropdown six months from now.

      The rest: batch_size (leave at 1 unless you know you have VRAM to spare), max_train_epoches (full passes over your dataset - 10 is a reasonable start for a small character set), save_every_n_epochs (checkpoints along the way - the last epoch isn't always the best one, so compare a couple), clip_skip (2 is standard, and what anime-style checkpoints expect), and output_dir (defaults to models/loras, which is why refresh-and-test works out of the box).

      How to install it

      Two paths, both standard for custom nodes:

      • 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 the requirements file (requirements_win.txt on Windows) and restart. If your ComfyUI setup uses a venv, activate it before running the install - this is the single most common install mistake.

      By the author's own admission this was their first node with real dependencies, and it can conflict with other custom nodes that pin different versions of the same libraries - not unique to this pack, it's the standard failure mode of ComfyUI's shared, unisolated Python environment, but worth knowing if your custom_nodes folder is already crowded.

      Common issues & troubleshooting

      "No module X found." Requirements didn't install, or installed into the wrong Python environment. If ComfyUI runs inside a venv, that's almost always the culprit - activate it, then reinstall requirements.

      CUDA errors on startup / "cuda.dll" missing. PyTorch wasn't installed with the right CUDA build for your setup. Grab the correct install command from pytorch.org (pick your CUDA version) and run it inside your ComfyUI environment.

      Training hangs or errors on "caching latents" / "loading text encoder." Shows up a lot on older or lower-VRAM cards - people on GTX 1660-class hardware hit different failure points than the RTX 3060 the author develops on. Check your console for mentions of cuda or xformers; a missing or mismatched xformers install is the most common cause.

      Data path errors, or training that "bricked" ComfyUI. Nine times out of ten the data path issue is the parent-folder mixup above, not a real bug. The rarer "it bricked my install" reports trace back to the dependency-conflict issue, not the node's own logic - check what changed in your Python environment before assuming it's broken, and the GitHub issues page is actively read.

      Want more control than these eight fields give you? That's what the Advanced node in this same pack is for.

      CategoryLJRE/LORA

      Inputs (8)

      NameTypeDefaultDescription
      ckpt_nameCOMBO0 options:
      data_pathSTRINGInsert path of image folders
      batch_sizeINT1
      max_train_epochesINT10
      save_every_n_epochsINT10
      output_nameSTRINGDesired name for LoRA.
      clip_skipINT2
      output_dirSTRINGmodels/loras

      Outputs (0)

      No outputs