FL PixelGen Train
Real LoRA training inside the node graph, with a live loss chart and validation samples in the widget
- model
- text_encoder
- config
- lora_path
- status
This is the ambitious node in the pack - and the reason the author's training background matters. It runs a full REPA LoRA training loop from inside the ComfyUI graph, with a real-time widget showing a live loss chart, epoch progress, validation samples, and a lightbox preview, all pushed over a WebSocket. No separate script, no Kohya clone, no CLI. You configure FL PixelGen Training Config, point this node at a folder of images, and it trains.
The mechanism, from the source: it loads your dataset, pre-encodes every caption through the Qwen3 text encoder once (cached - the single biggest speed lever in modern training, same as every current trainer), resizes and center-crops images to resolution, then injects PEFT LoRA adapters into the denoiser's target modules (qkv_x, kv_y, proj, w12, w3, qkv). Around that sits the REPA loss stack - four terms: flow-matching velocity MSE, cosine feature alignment against DINOv2, LPIPS perceptual loss, and DINO multi-layer feature matching. The DINOv2 and LPIPS backbones are frozen; only the LoRA (and a small projection head) train. Gradient accumulation, warmup, and a cosine schedule manage the actual optimization, checkpoints save every N epochs, and if you set a validation_prompt it runs real inference at each save and shows you the samples in the widget.
Inputs that matter:
model+text_encoder+config- the trio from the loaders and config node. No shortcuts; it wants all three.image_dir- a folder of images with matching.txtcaption sidecars. Format:image_001.png+image_001.txtcontaining e.g. "A photo of a sunset over the ocean." PNG/JPG/JPEG/WebP/BMP supported. Caption quality decides everything - this is a Qwen3 encoder, so write natural sentences, not danbooru tags.lora_name- output subfolder name; defaults tomy_pixelgen_lora.resolution- 128–1024, default 512. Training at 512 is the VRAM-sane default; higher eats memory fast.caption_ext(.txt),resume_from(path to resume),validation_prompt+validation_steps(default 20).
Outputs: lora_path (the checkpoint directory, ready to paste into the LoRA Loader's lora_path field - the two nodes are designed to hand off) and status (a human-readable message). Both are strings; lora_path is the one you actually want.
Install: the pack story - Manager search "FL PixelGen", or clone + pip install -r requirements.txt. The first training run downloads extra weights (DINOv2, LPIPS, plus the Qwen3 encoder) from HuggingFace, so give it time and bandwidth.
Troubleshooting - grounded in what's really in there: "Error: No images found in dataset directory" means your image_dir path or naming is off - check the folder exists and the extensions match. If it fails with "PEFT not installed. Run: pip install peft," the requirements didn't take (or you're on an environment where they were skipped); pip install peft fixes it. The README wants 12GB+ VRAM for bf16 training - under that, drop resolution to 512 and raise gradient_accumulation instead of batch_size. And set expectations: this is real training, so hours, not minutes, and a small clean dataset beats a big noisy one every time. Validate with the widget, don't just watch the loss number.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| model | PIXELGEN_MODEL | — | |
| text_encoder | PIXELGEN_TEXT_ENCODER | — | |
| config | PIXELGEN_TRAINING_CONFIG | — | |
| image_dir | STRING | — | |
| lora_name | STRING | my_pixelgen_lora | — |
| resolution | INT | 512128–1024 | — |
| caption_extopt | STRING | .txt | — |
| resume_fromopt | STRING | — | |
| validation_promptopt | STRING | A high quality photograph | — |
| validation_stepsopt | INT | 205–50 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| lora_path | STRING | — |
| status | STRING | — |