Nodes/Diffusion_pipe_in_ComfyUI/高级训练配置
ComfyUI Node

高级训练配置

The optional panel for when the stock training settings aren't enough

By TianDongL·Created 11 months ago·Updated 7 months ago· 69
高级训练配置
    • advanced_config
    max_steps0
    force_constant_lr0
    lr_schedulerconstant
    pseudo_huber_c0.0
    map_num_proc0
    compilefalse
    steps_per_print1
    x_axis_examplesfalse
    save_every_n_steps0
    eval_every_n_steps0
    checkpoint_every_n_epochs0
    partition_split
    reentrant_activation_checkpointingfalse

    AdvancedTrainConfig is the "I know what I'm doing" drawer of this pack. Everything on it is optional - the node can sit with every field at its default and it does nothing. You wire its ADVANCED_TRAIN_CONFIG output into the advanced_config input on GeneralConfig only when the standard settings on that hub node aren't giving you what you want. If you're a first-timer, skip it entirely; it's there for the second or third run, when you actually know which knob is hurting you.

    What the inputs actually do

    Almost every field here is a zero-means-off control, so the defaults are deliberately inert. The ones worth knowing:

    • max_steps (default 0) - caps training at a step count instead of running the full epochs from GeneralConfig. 0 means "ignore this, use epochs."
    • lr_scheduler (default constant) - the learning-rate schedule. linear is the other option; if you switch to it, make sure you understand warmup (which GeneralConfig handles separately) or you can torch your loss curve.
    • checkpoint_every_n_epochs (default 0) - the tooltip says it plainly: the author recommends enabling this, "otherwise you may lose part of your training progress." Diffusion-Pipe's own checkpointing writes a run directory you can resume from, and an occasional epoch checkpoint is cheap insurance. This one's easy to sleep on, and you'll regret it on a 20-hour run that OOMs at hour 19.
    • compile (default off) - wraps the model in torch.compile. The author's own caveat: "not tested on all models." Try it on your setup with a short run first; when it works it's a free speedup, when it doesn't it's a confusing crash.
    • map_num_proc (default 0) - how many parallel processes to use when caching the dataset. If you have many cores (or multiple GPUs), raising this can noticeably cut the one-time dataset-caching wall. 0 = let diffusion-pipe pick.
    • partition_split - a manual layer-partition string like "10,20" meaning layers 0–9 on GPU 0, 10–19 on GPU 1, the rest on GPU 2. This is deep pipeline-parallel territory; most people never touch it.
    • reentrant_activation_checkpointing - enable when pipeline_stages > 1 in GeneralConfig (i.e. you're splitting the model across GPUs). Off by default because it costs a bit of speed.

    There are also a few niche ones: pseudo_huber_c (a robust-loss constant, only applies to models using the default loss function), save_every_n_steps / eval_every_n_steps (step-based alternatives to the epoch-based saves and evals on GeneralConfig), x_axis_examples (plot training progress against samples seen instead of steps in TensorBoard/WandB), force_constant_lr, and steps_per_print (log frequency).

    How it fits in

    Mechanically it's the same trick as every config node here: it serializes your choices into a dict and hands them to GeneralConfig, which folds everything into the TOML the real diffusion-pipe trainer consumes. The node itself never launches anything - the Train node does that. So nothing here is dangerous by itself; worst case you make a training run slower or worse, then revert.

    Getting the pack installed

    Same story as every node in this pack - it's a Linux/WSL2-only custom node, installed by cloning with submodules and running the requirements file (deepspeed is the heavyweight). The quick version:

    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
    

    Then restart ComfyUI and import the example workflow from example_workflows/ to see how AdvancedTrainConfig plugs into GeneralConfig.

    Common gotchas

    Because this node is inert by default, the #1 "problem" is people expecting it to do something and seeing no change - that's by design. When it does misbehave, it's usually compile on an unsupported model (turn it off and rerun) or max_steps fighting your epochs setting (whichever comes first wins, so set one of them to 0). And remember the WSL2 path convention from the pack: Windows drive-letter paths like F:/..., not /mnt/f/....

    CategoryDiffusion-Pipe/Config

    Inputs (13)

    NameTypeDefaultDescription
    max_stepsoptINT00–100000最大训练步数,0表示不限制(使用epochs)
    force_constant_lroptFLOAT00–1强制使用恒定学习率,0.0表示不使用
    lr_scheduleroptCOMBOconstant学习率调度器类型
    pseudo_huber_coptFLOAT0.00–10伪Huber损失常数c,0.0表示不使用,仅适用于默认损失函数的模型
    map_num_procoptINT00–64缓存数据集时的并行进程数,0表示使用默认值,如果你有很多内核和多个GPU,提高这一点可以提高吞吐量
    compileoptBOOLEANfalse使用torch.compile编译模型以加速训练,没有在所有模型上测试过
    steps_per_printoptINT11–1000每N步打印一次日志
    x_axis_examplesoptBOOLEANfalse在TensorBoard/WandB中使用样本数作为X轴而非步数
    save_every_n_stepsoptINT00–10000每N步保存一次模型,0表示禁用,不同于save_every_n_epochs,这个是基于步数保存
    eval_every_n_stepsoptINT00–10000每N步评估一次,0表示禁用,不同于eval_every_n_epochs,这个是基于步数评估
    checkpoint_every_n_epochsoptINT00–100每N个epoch保存检查点,0表示禁用,建议启用,否则可能丢失部分训练进度
    partition_splitoptSTRING手动分区分割点,如'10,20'表示层0-9在GPU0,10-19在GPU1,其余在GPU2
    reentrant_activation_checkpointingoptBOOLEANfalse使用可重入激活检查点方法,当使用分布式训练时启用(pipelinestage>1)

    Outputs (1)

    NameTypeDescription
    advanced_configADVANCED_TRAIN_CONFIG