Model Layers
Read your network's mind — every layer, indented, as text
- model
- layers_str
CdlModelLayers prints your model's entire architecture as an indented tree of layers, straight from PyTorch's named_modules(). Wire in a cdlModel and you get back a STRING where every line is one module - root at the top, children indented under it - so you can finally see what you built without guessing. For a pack built on the Dive into Deep Learning textbook, this is the node that turns "I connected some nodes" into "oh, that's a two-conv-block CNN with a classifier head on top."
It's the natural partner to Model Info (counts) and Model Params (weights) in ComfyDL's read-only Model Utils trio. Layers answers the structural question: what is this network actually composed of, in what order? If you built a CdlLeNet, this node shows you the LazyConv2d → Sigmoid → AvgPool2d blocks exactly as the textbook describes them - which is genuinely the best way to learn what a sequential CNN looks like.
How it works
The node walks model.named_modules(), and for each module writes a line with its name and class, indented by its depth in the hierarchy. The depth is derived from the number of dots in the module's name path, so nested containers render as nested indentation. The result is a plain multi-line string - no fancy diagram, but reliably readable.
Inputs and output
model- the only input, anycdlModel.
The single output is layers_str, a STRING, which you'll want to wire into a text display node to actually read. Expect lines like:
(root): Sequential
(0): LazyConv2d
(1): Sigmoid
...
Installing ComfyDL
It's part of the ComfyDL 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 missing from the built-in list (the pack isn't on the official registry yet), use Install via Git URL with the repo link.
Common issues
The one real trap is timing it right: on a network with Lazy layers, the tree is complete structurally but some shapes aren't materialized until the first Model Forward pass - the layer names are all there, so you won't be misled, but if you were hoping to see shapes in the output, this node doesn't print them anyway (that's Model Params' job). Otherwise, about the only annoyance is the same as any string-output node: an unwired STRING output may not display anywhere on some frontends, so wire it to a text/preview node or you'll be looking at nothing.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| model | cdlModel | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| layers_str | STRING | — |