mirror of
https://github.com/Comfy-Org/rfcs.git
synced 2026-11-05 00:17:38 +00:00
[PR #24] [CLOSED] RFC: ComfyUI Training Modules #16
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/rfcs#16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Comfy-Org/rfcs/pull/24
Author: @yoland68
Created: 3/2/2025
Status: ❌ Closed
Base:
main← Head:main📝 Commits (2)
2176c57Create 0000-trainer.md RFCa49d920Add details 0000-trainer.md📊 Changes
1 file changed (+245 additions, -0 deletions)
View changed files
➕
rfcs/0000-trainer.md(+245 -0)📄 Description
RFC: ComfyUI Training Modules
Summary
This RFC proposes the addition of training capabilities to ComfyUI, enabling users to create and fine-tune LoRA (Low-Rank Adaptation) models directly through the ComfyUI interface. The proposal includes a set of node implementations for loading image datasets, training LoRAs, visualizing training progress, and saving trained models.
Basic example
The basic workflow would allow users to:
Load an image dataset:

Train a LoRA on these images:

Save the resulting LoRA:

Visualize training loss:

Motivation
Currently, users who want to create custom LoRA models need to:
Adding training capabilities directly to ComfyUI would:
Detailed design
The implementation consists of four main components:
1. Image Dataset Loading
Two nodes are proposed for loading image datasets:
LoadImageSetNode: Loads individual images selected by the userLoadImageSetFromFolderNode: Loads all images from a specified folderThese nodes offer options for handling images of different sizes (stretch, crop, pad) and prepare the images for training.
2. LoRA Training Node
The
TrainLoraNodeis the core component that handles the training process:The training process:
3. Model Saving Node
The
SaveLoRAnode enables users to save their trained LoRA models:The node saves the LoRA weights in SafeTensors format, with a filename that includes the number of training steps and a timestamp.
4. Training Visualization Node
The
LossGraphNodevisualizes the training progress:This node generates a graph showing the training loss over time, providing visual feedback on the training process.
Supporting Components
The implementation also includes several support classes:
TrainSampler: A custom sampler that performs gradient updates during the sampling processLoraDiffandBiasDiff: Weight wrapper classes that apply LoRA adaptations to model weightsDrawbacks
Adoption strategy
EXPERIMENTAL = Trueflag to indicate the developing nature of the featureUnresolved questions
Implementation Plan
Phase 1: Basic LoRA Training
Initial implementation of the nodes described in this RFC.
Phase 2: Enhanced Features
Phase 3: Workflow Integration
Phase 4: Model Format
Links
Full Rendered Proposal
Discussion Thread
Important: Do NOT comment on this PR. Please use the discussion thread linked above to provide feedback, as it provides branched discussions that are easier to follow. This also makes the edit history of the PR clearer.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.