Nodes/ComfyUI-TrainTools-MZ/MinusZone - KohyaSS_KohakuBlueleaf_HYHiDLoraTrain
ComfyUI Node

MinusZone - KohyaSS_KohakuBlueleaf_HYHiDLoraTrain

The Hunyuan DiT LoRA trainer via KohakuBlueleaf's Kohya fork

By MinusZoneAI·Created 2 years ago·Updated 5 months ago· 67
MinusZone - KohyaSS_KohakuBlueleaf_HYHiDLoraTrain
  • workspace_config
  • advanced_config
  • caption_completed_flag
    unet_pathauto
    vae_ema_pathauto
    text_encoder_pathauto
    tokenizer_pathauto
    t5_encoder_pathnone
    train_config_template
    max_train_steps0
    max_train_epochs100
    save_every_n_epochs10
    learning_rate1e-5
    base_loralatest
    sample_generateenable
    sample_prompt

    MZ_KohyaSS_KohakuBlueleaf_HYHiDLoraTrain is the payoff node of the KohakuBlueleaf path: it trains a LoRA for Tencent's Hunyuan DiT image model using KohakuBlueleaf's fork of sd-scripts. It's structured like MZ_KohyaSSLoraTrain - same workspace config, same template dropdown, same base_lora resume trick - with one big addition: it takes the Hunyuan model component paths (unet, VAE, text encoder, tokenizer, mT5) that the fork needs, because the fork doesn't assume you have a plain checkpoint.

    Hunyuan DiT is the forgotten-models case study - released mid-2024 to a +352 reception, added to kohya within weeks, then buried by Flux. If you're here, you already picked the niche model on purpose: it's good at composition and prompt adherence, less good at photorealism, and it's the kind of thing nobody trains for you. This node is the most maintained way to train it inside ComfyUI.

    How it works

    The chain is: MZ_KohyaSS_KohakuBlueleaf_HYHiDInitWorkspace → MZ_KohyaSSDatasetConfig → this node. The node builds the sd-scripts config from a template (lora_hunyuan1_1 or lora_hunyuan1_2 are the relevant ones in the dropdown, alongside the SD templates), merges the hunyuan_models_config built from the model path inputs, and runs training in-process with the fork's Python on your sys.path.

    The model path inputs are the distinctive part:

    • unet_path, vae_ema_path, text_encoder_path, tokenizer_path - all default to auto, which resolves to weights the pack downloads into ComfyUI/models/hunyuan/. So the first run with defaults pulls several GB of Hunyuan DiT components. text_encoder_path/tokenizer_path here mean CLIP.
    • t5_encoder_path - defaults to none on this path. The KohakuBlueleaf fork trains with CLIP only, so leave it unless you know the fork expects mT5 for your version.

    The rest is the standard kohya flow: train_config_template (use the hunyuan one), max_train_steps / max_train_epochs, save_every_n_epochs, learning_rate (string like "1e-5"), base_lora (latest resumes from the newest .safetensors in the workspace output - handy since Hunyuan runs are long), and sample_generate + sample_prompt to render progress samples. Optional inputs: advanced_config from MZ_KohyaSSAdvConfig, and a caption_completed_flag (* type) to sequence a captioning node before training.

    Install & troubleshooting

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

    The first run downloads model weights via auto - that's the slow part, and it hits ModelScope, so a flaky connection means retry. The fork needs its own dependency set installed; training in-process means a missing bitsandbytes or a torch mismatch fails at startup, and the console output is your only error surface. Also remember the model-licensing angle: Hunyuan weights are under Tencent's community license, which excludes the EU, UK, and South Korea from the territory. Training for personal use is fine; think before you build a product on it or redistribute derived weights.

    CategoryMinusZone - TrainTools/kohya_ss_HYDiT_kohakublueleaf

    Inputs (16)

    NameTypeDefaultDescription
    unet_pathCOMBOauto1 options: auto
    vae_ema_pathCOMBOauto1 options: auto
    text_encoder_pathCOMBOauto1 options: auto
    tokenizer_pathCOMBOauto1 options: auto
    t5_encoder_pathCOMBOnone2 options: none, auto
    workspace_configMZ_TT_SS_WorkspaceConfig
    train_config_templateCOMBO5 options: lora_hunyuan1_1, lora_hunyuan1_2, lora_sdxl, lora_sd1_5, controlnet_sd1_5
    max_train_stepsINT00–2147483647
    max_train_epochsINT1000–2147483647
    save_every_n_epochsINT10
    learning_rateSTRING1e-5
    base_loraCOMBOlatest2 options: latest, empty
    sample_generateCOMBOenable2 options: enable, disable
    sample_promptSTRING
    advanced_configoptMZ_TT_SS_AdvConfig
    caption_completed_flagopt*

    Outputs (0)

    No outputs