ComfyUI Node

模型配置

The glue node that turns a model path into a training config

By TianDongL·Created 11 months ago·Updated 7 months ago· 69
模型配置
  • model_path
  • model_config
model_typediffusion
dtypebfloat16
diffusion_transformer_dtypebfloat16
timestep_sample_methodlogit_normal

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 - diffusion or transformer. Pick transformer for the newer transformer-based models (Flux, Qwen-Image, Wan2.x).
  • dtype - bfloat16 (default), float16, or float32. 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 to float8 or float8_e5m2 to 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) or uniform. 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.

CategoryDiffusion-Pipe/Config

Inputs (5)

NameTypeDefaultDescription
model_pathmodel_path模型路径,根据不同的模型,选择不同的模型路径,具体查看注释
model_typeCOMBOdiffusion选择模型格式类型 (diffusion / transformer)
dtypeCOMBObfloat16基础数据类型
diffusion_transformer_dtypeCOMBObfloat16Transformer特定数据类型(支持float8用于LoRA训练)
timestep_sample_methodCOMBOlogit_normal时间步采样方法,通常为logit_normal

Outputs (1)

NameTypeDescription
model_configmodel_config