← 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

InitSD3LoRATraining

InitSD3LoRATraining Node Documentation

Overview

The InitSD3LoRATraining node is a component of the ComfyUI-FluxTrainer, designed to facilitate the initialization and configuration of LoRA training for the SD3 model. This node is part of an experimental framework for model training within the ComfyUI interface, making it accessible to users familiar with ComfyUI's environment. The node is specifically crafted to handle the setup of training parameters and environment preparation to ensure an efficient training process.

Functionality

The primary function of the InitSD3LoRATraining node is to initialize the training environment for SD3 LoRA models. It configures the necessary parameters and settings to start the training process. By inputting training attributes such as models, datasets, and other configurations, it prepares the training setup and invokes the training loop with the defined settings.

Inputs

The InitSD3LoRATraining node accepts several inputs that allow users to configure the training environment. Here are the required and optional inputs:

Required Inputs

  • sd3_models: This represents the pretrained SD3 models necessary for LoRA training.
  • dataset: A JSON structured input detailing the datasets to be used for training.
  • optimizer_settings: Settings for the optimizer, such as learning rate and other optimization parameters.
  • output_name: The name of the output file where the trained model will be saved.
  • output_dir: Specifies the directory path for output storage.
  • network_dim: Indicates the dimension size for the network.
  • network_alpha: Sets the network alpha value for the training configuration.
  • learning_rate: The learning rate for training.
  • max_train_steps: Maximum number of training steps allowed.
  • cache_latents: Option to cache text encoder outputs, which can be to disk, memory, or disabled.
  • cache_text_encoder_outputs: Similar to cache_latents, this controls caching of text encoder outputs.
  • training_shift: Determines the shift value for the training distribution of timesteps.
  • highvram: A boolean indicating if high VRAM is to be used for training.
  • blocks_to_swap: Governs memory use reduction by swapping blocks.
  • fp8_base: Whether to use fp8 for the base model.
  • gradient_dtype: The data type used for gradient computations.
  • save_dtype: The data type used for saving checkpoints.
  • attention_mode: Sets the mode for memory-efficient attention.
  • train_text_encoder: Specifies if and which text encoders are to be trained.
  • clip_l_lr, clip_g_lr, T5_lr: Learning rates for the text encoders.
  • sample_prompts: Prompts for validation samples.
  • gradient_checkpointing: Whether gradient checkpointing is enabled.

Optional Inputs

  • additional_args: Extra arguments for the training command.
  • resume_args: Arguments to resume a previous training session.
  • block_args: Arguments to limit the blocks used in the LoRA.
  • loss_args: Loss-related arguments.

Hidden Inputs

  • prompt: A hidden prompt input used internally.
  • extra_pnginfo: Hidden metadata input.

Outputs

The InitSD3LoRATraining node produces three main outputs which are essential for proceeding with the training workflow:

  • network_trainer: The initialized network trainer object that contains the configuration and parameters for the training session.
  • epochs_count: The number of epochs the training session is set to run.
  • args: The arguments used in configuring the training session, often used for further inspection or debugging.

Usage in ComfyUI Workflows

The InitSD3LoRATraining node is integrated into ComfyUI workflows to streamline the process of setting up and conducting LoRA training sessions. Users can easily drag and drop this node into their workflow, configure the required inputs, and seamlessly initiate the training process.

Example Usage

  1. Model Selection: Use the SD3ModelSelect node to specify and load the models required for training.
  2. Dataset Preparation: Configure your datasets to be used by the dataset input.
  3. Optimizer Setup: Adjust optimizer settings via optimizer_settings.
  4. Configure Training: Set parameters like learning rate and maximum steps to optimize performance.
  5. Start Training: The output from this node will be used to start and manage the training loop, typically with the SD3TrainLoop node.

Special Features and Considerations

  • Optimization and Efficiency: This node features options such as caching, precision settings, and memory management that optimize training for efficiency and performance.
  • Flexible Configuration: Users can adjust a wide array of parameters, allowing for flexible and customizable training setups.
  • Integration with ComfyUI: Designed to fit seamlessly within ComfyUI workflows, leveraging a familiar UI for those already accustomed to ComfyUI.

Important Considerations

  • Experimental Nature: As with any experimental feature, expect changes as the repository updates. It is crucial to refer to the latest documentation and GitHub updates.
  • Prerequisites: Ensure that necessary dependencies and model checkpoints are in place prior to initiating training.
  • Default Settings: The default configuration may not be optimal for all datasets or training conditions, users should tailor inputs to their specific needs.

For more details and examples, visit the ComfyUI-FluxTrainer GitHub repository.