Nodes/ComfyUI Flux Trainer/Flux Kohya Inference Sampler
ComfyUI Node

Flux Kohya Inference Sampler

Test your trained LoRA with Kohya's own sampler

By kijai·Created 2 years ago·Updated about a year ago· 1,157
Flux Kohya Inference Sampler
  • flux_models
  • image
lora_name
lora_method
steps20
width512
height512
guidance_scale3.50
seed42
use_fp8true
apply_t5_attn_masktrue
promptillustration of a kitten

Once you've got a trained Flux LoRA, you want to see it work - and FluxKohyaInferenceSampler lets you do that using Kohya's own inference code, the same code path the training pipeline uses internally, rather than ComfyUI's normal sampler. That's the point of it: it renders your LoRA under conditions closest to how it was trained and validated, which is the most apples-to-apples test you can run.

For everyday use you'd load the finished LoRA in a regular Flux generation workflow. This node is the specialist tool for checking the LoRA in Kohya's world before you trust it in yours.

How it works

It loads your Flux models plus a trained LoRA and generates an image. The inputs:

  • flux_models (TRAIN_FLUX_MODELS) - from a FluxTrainModelSelect node, the same model bundle you trained with.
  • lora_name - a dropdown of your trained LoRA files.
  • lora_method (apply or merge) - whether to apply the LoRA as an adapter at inference or merge it into the weights. apply is the normal path.
  • prompt - what to generate (defaults to the pack's cheerful "illustration of a kitten").
  • steps (default 20), guidance_scale (default 3.5), width / height (default 512×512), seed - standard Flux generation controls. Note the 3.5 guidance default, which is the usual Flux value.
  • use_fp8 (default true) - run the base in fp8 to save VRAM.
  • apply_t5_attn_mask (default true) - matches the T5 masking used in training.

The single output is an image (IMAGE) you wire to a Preview or Save node.

When you'd use it

Reach for this to sanity-check a freshly trained LoRA under training-faithful conditions - same sampler lineage, same masking, same model bundle. If it looks right here and wrong in your normal Comfy workflow, the difference is in your graph's settings, which is useful to know. For actual production generation, though, use a standard Flux workflow; this is a verification tool.

Installing the pack

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

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

Torch 2.4.0+ recommended, plus kijai's ComfyUI-KJNodes for the example workflows.

Common issues

512×512 default looks soft. The defaults render at 512 for speed. Flux looks better at 1024; bump width/height up when you want a real look at quality rather than a quick check.

Your LoRA isn't in the dropdown. The lora_name list reads from your LoRA folder. If the file you just trained isn't there, it's in the trainer's output directory - copy it into ComfyUI's loras folder (FluxTrainSaveModel's copy_to_comfy_model_folder toggle does this for you) and refresh.

It doesn't match your normal workflow's output. That's expected - this uses Kohya's inference path, not ComfyUI's sampler. Treat divergence as a clue about your regular graph's settings (guidance, sampler, resolution), not as a broken LoRA.

CategoryFluxTrainer

Inputs (11)

NameTypeDefaultDescription
flux_modelsTRAIN_FLUX_MODELS
lora_nameCOMBOThe name of the LoRA.
lora_methodCOMBOwhether to apply or merge the lora weights
stepsINT201–256sampling steps
widthINT51264–4096image width
heightINT51264–4096image height
guidance_scaleFLOAT3.501–32guidance scale
seedINT420–18446744073709550000
use_fp8BOOLEANtrueuse fp8 weights
apply_t5_attn_maskBOOLEANtrueuse t5 attention mask
promptSTRINGillustration of a kittenprompt

Outputs (1)

NameTypeDescription
imageIMAGE