模型配置
The glue node that turns a model path into a training config
- model_path
- model_config
ModelConfig is the least glamorous node in this pack and one of the most important. The model pickers (SDXL, Wan2.2, Qwen-Image, all the rest) just hand you a model_path - a little dictionary that says "I'm this model type, my weights live here." This node takes that dictionary, stamps the training-relevant settings onto it, and hands the merged result to GeneralConfig, which folds it into the TOML that Train actually runs.
If you look at the pack's example workflow, every model picker feeds a ModelConfig before anything reaches the training config. It's the required middleman.
How it works
ModelConfig receives the model_path dictionary from your model node, then merges in three settings: dtype (base compute precision), diffusion_transformer_dtype (precision for the transformer specifically), and timestep_sample_method. The output model_config is a dict with the model's own fields plus those three merged in - so the model picker stays a pure "which model and where" node, and all the numeric fiddling happens here.
One detail worth knowing: if model_path is a plain string instead of a dict (you wired a path directly), it falls back to treating it as checkpoint_path. And diffusion_transformer_dtype maps to diffusion_model_dtype or transformer_dtype depending on your model_type choice.
The inputs that matter
model_path- from whatever model node you picked (SDXLModelNode, Wan22ModelNode, etc.). This is the required wiring.model_type-diffusionortransformer. Picktransformerfor the newer transformer-based models (Flux, Qwen-Image, Wan2.x).dtype-bfloat16(default),float16, orfloat32. Leave it on bf16 unless you have a specific reason; it's the modern default for training these models.diffusion_transformer_dtype- this is the interesting one. Set it tofloat8orfloat8_e5m2to train the transformer in 8-bit, which the tooltip notes is supported for LoRA training. That's your VRAM savings knob.timestep_sample_method-logit_normal(default) oruniform. The tooltip's advice is basically "usually logit_normal". It is.
Output: model_config, which you wire into GeneralConfig alongside your optimizer_config and dataset config.
Install
Same story as every node in this pack - ComfyUI Manager, search "Diffusion_pipe_in_ComfyUI", or:
cd ComfyUI/custom_nodes
git clone --recurse-submodules https://github.com/TianDongL/Diffusion_pipe_in_ComfyUI.git
cd Diffusion_pipe_in_ComfyUI
git submodule init && git submodule update
pip install -r requirements.txt
Linux/WSL2 only, and it pulls deepspeed plus the whole diffusers stack. Restart ComfyUI after installing.
Where people get burned
The classic mistake is skipping this node and wiring the model picker straight into GeneralConfig - the types don't line up and the run won't start. Also note the model_type switch: on a transformer model (Flux, Wan, Qwen-Image) leaving it on diffusion means your diffusion_transformer_dtype setting lands in the wrong config key. And if you're chasing VRAM headroom, float8 on the transformer is the lever you want - it's there specifically so you can LoRA-train big models that wouldn't otherwise fit.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| model_path | model_path | 模型路径,根据不同的模型,选择不同的模型路径,具体查看注释 | |
| model_type | COMBO | diffusion | 选择模型格式类型 (diffusion / transformer) |
| dtype | COMBO | bfloat16 | 基础数据类型 |
| diffusion_transformer_dtype | COMBO | bfloat16 | Transformer特定数据类型(支持float8用于LoRA训练) |
| timestep_sample_method | COMBO | logit_normal | 时间步采样方法,通常为logit_normal |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| model_config | model_config | — |