Nodes/ComfyUI-TrainTools-MZ/MinusZone - KohyaSSTrain(old version)
ComfyUI Node

MinusZone - KohyaSSTrain(old version)

The old training main thread — where Kohya actually runs inside ComfyUI

By MinusZoneAI·Created 2 years ago·Updated 5 months ago· 67
MinusZone - KohyaSSTrain(old version)
  • train_config
  • has_no_effect
    base_loralatest
    sample_generateenable
    sample_prompt

    MZ_KohyaSSTrain is the old-version training node, and it's where the pack finally stops preparing and actually trains. It's an output node: you wire in a train_config (from MZ_KohyaSSUseConfig, or base_lora resuming), hit queue, and sd-scripts runs in-process using ComfyUI's own Python. When it's done, your LoRA is sitting in the workspace's output/ folder and ComfyUI displays the sample generations it produced along the way.

    It's part of the v1 chain - InitWorkspace → Dataset → UseConfig → Train - which the newer MZ_KohyaSSLoraTrain replaces by folding the config step in. If you're building fresh, use that one. If you've got an old workflow or you specifically want the separation between "build config" and "run," this is still here.

    How it works

    The node merges the train_config fields into a full sd-scripts invocation, adds your base_lora / sample settings, and hands it to the cloned kohya_ss_lora toolchain. First real run also triggers the pack's lazy install: it auto-pips toml, imagesize, voluptuous, diffusers, and accelerate into whatever Python runs ComfyUI. You'll see pip chatter in the console on the first train - that's normal.

    The base_lora dropdown is the interesting bit:

    • latest - resume from the most recently modified .safetensors in the workspace's output/. This is the pack's resume mechanism: keep training an existing LoRA, and kohya sets network_weights + dim_from_weights (so rank/alpha are read from the loaded weights, and any network_dim/alpha in the config are ignored).
    • empty - start from scratch.
    • Plus every .safetensors found in the workspace outputs and your ComfyUI models/loras/, sorted by recency.

    sample_generate (default enable) runs a text-to-image pass at each saved epoch using sample_prompt and shows you the images - the closest thing this pack has to a progress bar, and genuinely useful for spotting collapse early.

    Inputs worth knowing

    • train_config - the assembled config from MZ_KohyaSSUseConfig. This node doesn't take a workspace config directly; the chain matters.
    • base_lora - see above. "latest" is the resume trick.
    • sample_generate / sample_prompt - your sample generation trigger and the prompt to use for it.

    There's also an optional has_no_effect input typed * - a throwaway connection slot some workflows use for ordering. Ignore it.

    Install & troubleshooting

    cd ComfyUI/custom_nodes
    git clone https://github.com/MinusZoneAI/ComfyUI-TrainTools-MZ
    # restart ComfyUI
    

    First train is where the install pain lands. The auto-pip list covers the basics, but if you selected an 8-bit optimizer in MZ_KohyaSSAdvConfig, bitsandbytes is not auto-installed and training will fail at startup - install it for your torch/CUDA combo yourself. Since training runs in ComfyUI's Python, anything that breaks the ComfyUI environment (an incompatible diffusers downgrade, a bnb/torch mismatch) breaks training too; it's the classic kohya dependency stack, now embedded in your graph. If a run dies mid-epoch, your workspace data survives - fix the env and re-queue, and base_lora = latest will pick up where the last save left off.

    CategoryMinusZone - TrainTools/kohya_ss/v1

    Inputs (5)

    NameTypeDefaultDescription
    train_configMZ_TT_SS_TrainConfig
    base_loraCOMBOlatest2 options: latest, empty
    sample_generateCOMBOenable2 options: enable, disable
    sample_promptSTRING
    has_no_effectopt*

    Outputs (0)

    No outputs