MinusZone - KohyaSS_KohakuBlueleaf_HYHiDLoraTrain
The Hunyuan DiT LoRA trainer via KohakuBlueleaf's Kohya fork
- workspace_config
- advanced_config
- caption_completed_flag
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 toauto, which resolves to weights the pack downloads intoComfyUI/models/hunyuan/. So the first run with defaults pulls several GB of Hunyuan DiT components.text_encoder_path/tokenizer_pathhere mean CLIP.t5_encoder_path- defaults tononeon 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.
Inputs (16)
| Name | Type | Default | Description |
|---|---|---|---|
| unet_path | COMBO | auto | 1 options: auto |
| vae_ema_path | COMBO | auto | 1 options: auto |
| text_encoder_path | COMBO | auto | 1 options: auto |
| tokenizer_path | COMBO | auto | 1 options: auto |
| t5_encoder_path | COMBO | none | 2 options: none, auto |
| workspace_config | MZ_TT_SS_WorkspaceConfig | — | |
| train_config_template | COMBO | 5 options: lora_hunyuan1_1, lora_hunyuan1_2, lora_sdxl, lora_sd1_5, controlnet_sd1_5 | |
| max_train_steps | INT | 00–2147483647 | — |
| max_train_epochs | INT | 1000–2147483647 | — |
| save_every_n_epochs | INT | 10 | — |
| learning_rate | STRING | 1e-5 | — |
| base_lora | COMBO | latest | 2 options: latest, empty |
| sample_generate | COMBO | enable | 2 options: enable, disable |
| sample_prompt | STRING | — | |
| advanced_configopt | MZ_TT_SS_AdvConfig | — | |
| caption_completed_flagopt | * | — |
Outputs (0)
No outputs