通用训练设置
The hub node — every training run in this pack flows through here
- optimizer_config
- model_config
- dataset_config
- adapter_config
- advanced_config
- eval_dataset_config
- sampler_config
- train_config
- output_dir
- config_path
If the model nodes are the engine and the dataset nodes are the fuel, GeneralConfig is the dashboard you sit at before you turn the key. It's the node that collects every other config - model, dataset, optimizer, adapter, eval - and turns them into the actual TOML file the diffusion-pipe trainer runs. The whole pack is shaped like a funnel, and this node is the neck. Understand it and you understand the pack.
What it takes
Four required inputs are wire-in, not type-in: optimizer_config (from OptimizerConfigNode), model_config (from any model node), and dataset_config (from GeneralDatasetConfig). Plus output_folder_name - the name of the folder created under ComfyUI's output/ directory for this run's artifacts.
Then the hyperparameters. The ones you'll actually touch as a beginner:
epochs(default 50) - training rounds. Keep it but watch your eval curve; more isn't automatically better.micro_batch_size_per_gpu(default 2) - the smallest batch unit, per GPU. This is the knob you lower when you OOM. Modern architectures dislike tiny effective batches (the KB's Flux-2-era note: "Klein 9b hates small batch sizes"), so combine it with gradient accumulation rather than just dropping it to 1.gradient_accumulation_steps(default 1) - effective batch = micro batch × accumulation × GPUs. Raise this to grow effective batch without OOM.number_of_gpusandpipeline_stages(both default 1) - set GPUs to your hardware;pipeline_stagesis how many GPUs the model is split across and should match your GPU count for pipeline parallelism.blocks_to_swap(default 20) - how many transformer blocks get offloaded to CPU RAM to save VRAM. Bigger swap = lower VRAM, slower training. Tune against your OOM errors.activation_checkpointing(default on) - recomputes activations to save memory; the tooltip says "usually enable." Leave it on.warmup_steps(default 500),gradient_clipping(1),save_dtype(bfloat16),partition_method(parameters) - set once, rarely revisit.
The optional inputs are where the rest of the pack hooks in: adapter_config (from AdapterConfigNode - required for any LoRA run!), advanced_config (from AdvancedTrainConfig), eval_dataset_config (from EvalDatasetConfig), sampler_config, and the eval-frequency and save-frequency controls (eval_every_n_epochs, save_every_n_epochs, checkpoint_every_n_minutes, caching_batch_size, video_clip_mode, and friends).
What comes out
Three outputs. train_config (type TRAIN_CONFIG) and config_path both feed the Train node - the config_path is the written trainconfig.toml the trainer actually reads. output_dir (a plain STRING) is where your run lands inside ComfyUI's output/ folder.
How it works
Under the hood it's a TOML serializer with an opinionated memory strategy. It creates the output folder, writes every setting into trainconfig.toml, folds in your optimizer/model/dataset/adapter/eval configs, and hands the Train node everything it needs to spawn the real diffusion-pipe subprocess (with TensorBoard monitoring on top). Nothing trains until Train runs - this node just makes sure the config file is coherent first.
Installing the pack
Linux/WSL2 only, submodules mandatory:
cd ComfyUI/custom_nodes/
git clone --recurse-submodules https://github.com/TianDongL/Diffusion_pipe_in_ComfyUI.git
git submodule update
pip install -r Diffusion_pipe_in_ComfyUI/requirements.txt
Common issues
The recurring one from the community: the trainer seems to ignore your settings and uses defaults. That's almost always the config-path wiring - make sure the config_path output actually reaches Train, and remember the pack's WSL2 path convention (Z:/..., not /mnt/z/...) for everything you type. And a missing adapter_config means no adapter - "LoRA not applying" is usually just this.
Inputs (28)
| Name | Type | Default | Description |
|---|---|---|---|
| output_folder_name | STRING | training_output | 输出文件夹名称,将自动创建在 @output/ 目录下 |
| optimizer_config | OPTIMIZER_CONFIG | 优化器配置 | |
| model_config | model_config | 模型配置(来自模型配置节点) | |
| dataset_config | DATASET_CONFIG | 数据集配置(来自数据集配置节点) | |
| epochs | INT | 501–1000 | 训练轮数 |
| micro_batch_size_per_gpu | INT | 21–32 | 每个GPU的微批次大小 |
| number_of_gpus | INT | 11–8 | GPU 数量 |
| pipeline_stages | INT | 11–8 | 管道并行阶段数,将模型拆分到的 GPU 数量,应与 GPU 数量匹配 |
| gradient_accumulation_steps | INT | 11–64 | 梯度累积步数 |
| gradient_clipping | FLOAT | 1.01–10 | 梯度裁剪阈值 |
| warmup_steps | INT | 5000–5000 | 学习率预热步数 |
| blocks_to_swap | INT | 200–80 | 要交换的块数量 |
| activation_checkpointing | BOOLEAN | true | 激活检查点,节省显存,通常启用 |
| save_dtype | COMBO | bfloat16 | 保存模型时的数据类型 |
| partition_method | COMBO | parameters | 分区方法 |
| adapter_configopt | ADAPTER_CONFIG | 适配器配置(可选,用于LoRA等适配器训练) | |
| advanced_configopt | ADVANCED_TRAIN_CONFIG | 高级训练配置(可选,来自AdvancedTrainConfig节点) | |
| eval_every_n_epochsopt | INT | 10–100 | 每N个epoch评估一次,0表示不评估 |
| eval_before_first_stepopt | BOOLEAN | true | 是否在第一步之前评估 |
| eval_micro_batch_size_per_gpuopt | INT | 11–32 | 评估时每个GPU的微批次大小 |
| eval_gradient_accumulation_stepsopt | INT | 11–64 | 评估时的梯度累积步数 |
| save_every_n_epochsopt | INT | 10–100 | 每N个epoch保存一次,0表示禁用 |
| checkpoint_every_n_minutesopt | INT | 1200–1440 | 每N分钟保存检查点,0表示禁用 |
| caching_batch_sizeopt | INT | 11–32 | 预缓存时的批次大小,影响内存使用 |
| disable_block_swap_for_evalopt | BOOLEAN | false | 评估时是否禁用块交换 |
| video_clip_modeopt | COMBO | none | 仅适用于视频模型训练。视频帧提取模式 - none:不使用视频模式, single_beginning:从视频开头提取一个片段, single_middle:从视频中间提取一个片段, multiple_overlapping:提取多个可能重叠的片段覆盖整个视频 |
| eval_dataset_configopt | EVAL_DATASET_CONFIG | 评估数据集配置(可选,来自EvalDatasetConfig节点) | |
| sampler_configopt | SAMPLER_CONFIG | 训练采样器配置(可选,来自TrainingSamplerConfig节点) |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| train_config | TRAIN_CONFIG | — |
| output_dir | STRING | — |
| config_path | config_path | — |