Nodes/ComfyUI Flux Trainer/Flux Train Save LoRA
ComfyUI Node

Flux Train Save LoRA

Write the LoRA to disk (and straight into ComfyUI)

By kijai·Created 2 years ago·Updated about a year ago· 1,157
Flux Train Save LoRA
  • network_trainer
  • network_trainer
  • lora_path
  • steps
save_statefalse
copy_to_comfy_lora_folderfalse

This is the node that actually turns your training run into a .safetensors file. Everything upstream in ComfyUI-FluxTrainer builds and runs the training loop as a graph; FluxTrainSave is the "commit" step that grabs the current weights and writes them out. Without it, you spend GPU hours and end up with nothing on disk.

The nice part is the timing. Because you drop this into the middle of a running graph, you decide when it fires - every N steps, at the end, or both. That matters more than it sounds: the last checkpoint of a LoRA run is very often not the best one, so you want to save intermediate versions and compare them, not just keep whatever the final step produced.

How it works

FluxTrainer keeps the whole training session alive as a single object that gets passed from node to node - the NETWORKTRAINER type you'll see threading through the graph. FluxTrainSave takes that live trainer, tells kohya's underlying save routine (this pack is a wrapper around kohya-ss/sd-scripts) to serialize the LoRA weights at their current state, then hands the same trainer straight back out so training can continue. Nothing stops; it's a tap on the pipe, not a valve.

The inputs that matter

There are only three inputs and two of them are the ones you'll actually touch:

  • save_state - off by default. Flip it on and the node also writes the full optimizer/training state, not just the LoRA weights. That's a much bigger file, and you only need it if you plan to resume this run later (that's what FluxTrainResume reads back). If you're just saving finished LoRAs to test, leave it off.
  • copy_to_comfy_lora_folder - also off by default, and honestly the one you want on. It drops the saved LoRA into your ComfyUI/models/loras folder so you can wire up a normal LoRA loader and test the result in the same session, no file-shuffling required.

The third input, network_trainer, is just the live training session coming in from upstream.

Outputs: network_trainer (chain it onward if you're still training or validating), lora_path (a string with where the file actually landed - handy to feed into a loader or a text display), and steps (the step count at save time, useful for labelling checkpoints).

Installing ComfyUI-FluxTrainer

FluxTrainSave ships in kijai's ComfyUI-FluxTrainer pack. Easiest path is ComfyUI Manager: Install Custom Nodes, search "ComfyUI Flux Trainer", install, restart. Manual:

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

Restart ComfyUI afterwards. Torch 2.4.0 or newer is strongly recommended - this is training code, not inference, and older torch will bite you. The example LoRA workflow in the pack's examples folder also pulls in a couple of nodes from ComfyUI-KJNodes, so grab that too.

Common issues

The big gotcha is save_state: if you forget to enable it and your run dies at step 2,000, there's no state to resume from - you start over. Decide up front whether this run is disposable or something you might want to continue, and set it accordingly. The flip side is disk: state files are large, so don't leave save_state on for every intermediate save unless you actually mean to keep all those resume points.

Beyond that, this node is downstream plumbing - if training itself is fine, saving rarely fails. If the LoRA writes but looks baked or lifeless, that's a training-config or dataset problem, not a save problem. And a reminder worth repeating: this whole pack is explicitly experimental, and kijai's own README says the default settings aren't necessarily good - they're just the last ones that worked for his dataset. Save intermediates, test them, and trust your eyes over the defaults.

CategoryFluxTrainer

Inputs (3)

NameTypeDefaultDescription
network_trainerNETWORKTRAINER
save_stateBOOLEANfalsesave the whole model state as well
copy_to_comfy_lora_folderBOOLEANfalsecopy the lora model to the comfy lora folder

Outputs (3)

NameTypeDescription
network_trainerNETWORKTRAINER
lora_pathSTRING
stepsINT