← 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

FluxTrainSaveModel

FluxTrainSaveModel Node Documentation

Overview

The FluxTrainSaveModel node is part of the ComfyUI-FluxTrainer, a wrapper for modified versions of Kohya's training scripts used for machine learning model training. This specific node is responsible for saving the state of a neural network model being trained in a Flux environment. It offers options to save the model to a specified directory and to end the training session if desired.

Functionality

The primary function of the FluxTrainSaveModel node is to save the current state of the training model during a training process. This allows users to preserve training progress and, if desired, finalize the training process. It can also copy the saved model into a designated ComfyUI model folder, facilitating easier access and use within the ComfyUI environment.

Inputs

The FluxTrainSaveModel node accepts the following inputs:

  • network_trainer: This input expects an object representing the ongoing training session. It includes all relevant information about the current state of the model and training parameters.

  • copy_to_comfy_model_folder: A boolean input that, when set to True, will copy the saved model file to the designated ComfyUI model folder for easy access and use within ComfyUI.

  • end_training: A boolean input allowing users to terminate the training process after saving the model. When set to True, training will be concluded following the save operation.

Outputs

The FluxTrainSaveModel node produces the following outputs:

  • network_trainer: Returns the network trainer object, which may have updated information after saving the model.

  • model_path: A string output indicating the path to the saved model file. This provides users with the location where the model file is stored, facilitating easy retrieval.

  • steps: An integer indicating the number of training steps completed before the model was saved. This information is crucial for tracking progress and evaluating training effectiveness.

Usage in ComfyUI Workflows

Within ComfyUI workflows, the FluxTrainSaveModel node is typically used as part of a training loop where regular saving of model checkpoints is necessary. It allows users to:

  1. Periodically save the state of the model during lengthy training sessions to prevent loss of progress due to unforeseen interruptions.
  2. Copy saved models to ComfyUI's dedicated model folder, making them easily available for future inference tasks or further training.
  3. Conclude training sessions when a predetermined condition is met, such as reaching a target number of epochs or steps.

Special Features and Considerations

  • Integration with ComfyUI: The ability to copy the saved model to the ComfyUI model folder streamlines the workflow by reducing the manual steps needed to access the model for future tasks.

  • Training Termination: The end_training option provides a convenient way to gracefully end a training session, ensuring that resources are freed up and progress is suitably recorded.

  • Checkpointing: Saving models at regular intervals (using this node alongside other nodes in a training loop) can be vital for projects where iterative refinement or interrupted trains are common.

By adhering to these features and considerations, users can effectively manage and maintain their machine learning workflows within the ComfyUI-FluxTrainer environment.