← See All Custom Node Packs

ComfyUI-FluxTrainer

1150

Run ComfyUI Easily with InstaSD

Skip the complex setup. InstaSD helps creative professionals build workflows and deploy them to the world:

  • One-click deployment
  • Any model, any node
  • Powerful GPUs for rapid iteration
Get Started

FluxTrainLoop

FluxTrainLoop Node Documentation

Overview

The FluxTrainLoop node is a component of the ComfyUI FluxTrainer, a wrapper around slightly modified kohya's training scripts for training models using Flux. This node is specifically responsible for iterating through the training process on a defined step basis. It is part of an experimental framework that supports LoRA training and full model fine-tuning, providing users with a familiar UI environment if they are already using ComfyUI.

Functionality

The FluxTrainLoop node operates the core training loop. It takes in a network trainer that has already been initialized and advances the training by a specified number of steps. This node is integral to the training process, allowing for continued batch processing and optimization of model parameters based on the defined network trainer configuration.

Inputs

The node accepts the following inputs:

  1. network_trainer: This is a required input representing the NETWORKTRAINER object. It contains the training configuration, state, and associated methods to continue training from the current state.

  2. steps: This is an integer input with a default value of 1. The steps input defines the number of training steps to execute in this iteration. It must be at least 1 and can go up to 10,000 steps. The specified number of steps determines how far the training will advance in a single run.

Outputs

The FluxTrainLoop node produces two outputs:

  1. network_trainer: The updated NETWORKTRAINER object is returned after completing the specified number of training steps. This object retains all information necessary for further training or evaluation in subsequent workflow nodes or iterations.

  2. steps: The node returns the total number of steps completed, represented as an integer. This value is useful for tracking progress within the ComfyUI workflows, especially when further processing or decisions are made based on step counts.

Usage in ComfyUI Workflows

The FluxTrainLoop node is commonly used within ComfyUI workflows where iterative model training is necessary. It is typically part of a sequence including model setup, dataset configuration, optimizer selection, and other training configurations.

Once the network trainer object is initialized with all the necessary parameters and datasets, the FluxTrainLoop node will be used repeatedly to incrementally train the model. Users can incorporate this node in cycles with validation, saving, and other nodes to create a structured and comprehensive training pipeline.

This node can easily be integrated into training workflows where a specific number of training steps are desired, and it provides flexibility to pause, inspect, and adjust parameters before resuming training.

Special Features or Considerations

  • Progress Integration: The node includes a progress bar in the form of comfy.utils.ProgressBar, providing visual feedback on the advancement of training steps, enhancing usability and monitoring.

  • Experimental Nature: Given that the framework is experimental and subject to change, it's critical to keep in mind that behaviors and available features may evolve, sometimes requiring updates to workflows when new versions are released.

  • Disk Space Requirements: It is important to monitor available disk space since sufficient storage is necessary for saving intermediate model states and other training data.

  • Training Environment Compatibility: Ensure that all dependencies, such as torch, are correctly installed and compatible with the FluxTrainer version to avoid runtime issues.