Nodes/ComfyDL/Model Info
ComfyUI Node

Model Info

How big is that model? Total params, trainable params, and a summary

By Cynthia-lxx·Created 2 months ago·Updated 2 days ago· 6
Model Info
  • model
  • summary
  • total_params
  • trainable_params

CdlModelInfo is the "what did I just build?" node. Feed it any cdlModel and it tells you how many parameters the model has, how many of those are trainable, what its top-level submodules are, and how many modules it contains in total. For anyone learning deep learning in ComfyDL - and that's the pack's whole audience - this is the node that turns an abstract "network" into a number you can wrap your head around. "Wait, LeNet only has 60k parameters?" Yes. That's the point.

It's also a genuinely useful sanity check in the middle of a workflow. Did your model actually come out the way you expected? Did a layer not get its weights because you forgot a forward pass on a Lazy module? CdlModelInfo will often tell you before the model does. In the pack's Model Utils family it's the read-only sibling of Model Layers (the architecture tree) and Model Params (the full parameter listing) - Info is the quick version, the one you wire up first.

How it works

It walks the model's modules and parameters: counts every module (including the root), collects the names of the top-level children, and tallies total and trainable parameter counts. "Trainable" means requires_grad=True - the number you actually care about when you're thinking about what an optimizer will update. The summary is returned as a human-readable multi-line string.

Inputs and output

  • model - the only input, any cdlModel.

The node has three outputs, which is what makes it flexible:

  • summary - a STRING with the model type, submodule names, module count, and both parameter counts. Wire it into a text display node.
  • total_params - an INT. This one's useful wired into math or text nodes.
  • trainable_params - an INT, the count of parameters with requires_grad=True.

All three come from the same inspection, so you can show the human-readable summary while also feeding the numbers somewhere programmatic.

Installing ComfyDL

It ships with the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/Cynthia-lxx/ComfyDL
pip install -r ComfyDL/requirements.txt

Restart ComfyUI. The only extra dependency is matplotlib; torch comes with ComfyUI. ComfyUI Manager users: search "ComfyDL", and if it's not in the built-in list (the pack isn't published to the official Comfy Registry yet), use Install via Git URL with the repo link.

Common issues

The main gotcha is the Lazy module subtlety: a network with LazyConv2d/LazyLinear layers (like CdlLeNet) reports its true parameter count only after a Model Forward pass has initialized the shapes. Check the numbers before running the model and they can look oddly small or empty; run one forward and re-inspect and the real structure shows up. And don't over-read the total_params output for ranking - parameter counts stopped tracking capability years ago even in image models, but here the numbers are small and textbook-shaped, which is exactly the point of the pack.

Categoryd2l/Model Utils

Inputs (1)

NameTypeDefaultDescription
modelcdlModel

Outputs (3)

NameTypeDescription
summarySTRING
total_paramsINT
trainable_paramsINT