ComfyUI-FluxTrainer
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
Available Nodes
InitFluxLoRATraining
Documentation for InitFluxLoRATraining Node
Overview
The InitFluxLoRATraining node is part of the ComfyUI-FluxTrainer repository, which provides a framework for LoRA (Low-Rank Adaptation) training built upon Kohya's training scripts. The purpose of this node is to initialize a LoRA training process using the specified settings and configurations. This node allows users to set up an environment where a machine learning model can be fine-tuned or trained from scratch using a combination of datasets and LoRA methodology.
Functionality
This node is responsible for setting up and initiating a LoRA training process. It handles the configuration of various components that are necessary for training, such as models, datasets, optimizers, outputs, and additional training parameters. The node ensures that all required components are available and properly configured before starting the training.
Accepted Inputs
Required Inputs
- Flux Models: Specifies the models to be used during training.
- Dataset: The dataset configuration in JSON format specifying the data to be used.
- Optimizer Settings: Configuration settings for the optimizer used during training.
- Output Name: The name that will be used for the output files.
- Output Directory: Directory where output will be saved.
- Network Dim: Defines the dimensionality of the network.
- Network Alpha: Specifies the network alpha parameter.
- Learning Rate: Sets the learning rate for training.
- Max Train Steps: Maximum number of steps for training.
- Apply T5 Attn Mask: Boolean indicating whether to apply T5 attention mask.
- Cache Latents: Indicates how to cache text encoder outputs.
- Cache Text Encoder Outputs: Specifies how text encoder outputs are cached.
- Blocks to Swap: Number of blocks to swap for memory management.
- Weighting Scheme: Method to apply weighting to the training process.
- Logit Mean: Mean to use in the logit_normal weighting scheme.
- Logit Std: Standard deviation for the logit_normal weighting scheme.
- Mode Scale: Scale of mode weighting scheme.
- Timestep Sampling: Method for timestep sampling during training.
- Sigmoid Scale: Scale factor for sigmoid timestep sampling.
- Model Prediction Type: How the model prediction is interpreted and processed.
- Guidance Scale: Guidance scale for Flux training.
- Discrete Flow Shift: Configuration for the Euler Discrete Scheduler.
- High VRAM: Indicates high VRAM mode.
- FP8 Base: Specifies if fp8 is used for the base model.
- Gradient Dtype: Specifies the data type for gradient computation.
- Save Dtype: Determines the data type used for saving checkpoints.
- Attention Mode: Memory-efficient attention mode.
- Sample Prompts: Validation sample prompts for generating examples.
Optional Inputs
- Additional Args: Extra arguments to pass to training command.
- Resume Args: Arguments related to resuming a prior training session.
- Train Text Encoder: Information on which text encoders to train.
- Clip_l LR: Learning rate for the text encoder.
- T5 LR: Learning rate for T5 text encoding.
- Block Args: Arguments to limit blocks used in LoRA.
- Gradient Checkpointing: Option for using gradient checkpointing.
- Loss Args: Additional arguments for loss functions.
- Network Config: Additional configurations for networks.
Hidden Inputs
- Prompt: Contains the training prompt.
- Extra PNG Info: Additional PNG metadata.
Outputs Produced
- Network Trainer: The initialized network trainer object ready for training.
- Epochs Count: Number of epochs that will be computed during the training.
- Kohya Args: The arguments passed to the underlying training scripts.
Usage in ComfyUI Workflows
The InitFluxLoRATraining node plays a fundamental role in starting a LoRA training process in a ComfyUI workflow. It is one of the initial nodes used to configure and initiate this process. Users can use this node to define their entire training setup and ensure that their datasets, models, and other parameters are correctly specified before commencing the training loop. This node can be part of a larger workflow where nodes for dataset preparation, optimizer configuration, and loss monitoring follow the initialization step to manage and refine training processes effectively.
Special Features and Considerations
- Modular Configuration: Users can specify a wide range of options to tailor the training to their specific needs, including model configurations, optimizers, data caching strategies, and more.
- Flexibility for Advanced Configurations: By allowing additional arguments and configurations like network, optimizer, and dataset settings, this node supports complex and customized setups for training.
- Resource Management: Features like
Cache Latents,Blocks to Swap, andHigh VRAMgive users control over memory usage for better resource management. - Experimental and Continual Support: As an experimental node, features and implementations are subject to change, and users are advised to be aware of potential updates in underlying scripts and methodologies.
When using this node, users should ensure that they have adequate system resources and storage, especially as training large datasets can be resource-intensive. Overall, the InitFluxLoRATraining node is a robust tool for setting up LoRA-specific training sessions within the ComfyUI framework, offering extensive customization to support diverse training requirements.