Nodes/ComfyUI-Debug/Debug: Model Architecture
ComfyUI Node

Debug: Model Architecture

Model Architecture dumps the whole thing

By liusida·Created 2 years ago·Updated 2 years ago· 14
Debug: Model Architecture
  • model
    output

    If Debug: Model Metrics (the other node in this pack) is the summary receipt, this is the raw autopsy. Plug a MODEL into it, run the graph, and it prints the entire underlying network - every submodule, every parameter name, every tensor shape and dtype, straight from PyTorch's own representation of the model. It's the debug node equivalent of opening the engine and counting the pistons.

    You reach for it when "it's an SDXL" isn't enough. Say you're trying to figure out whether a custom ControlNet or an ADetailer model will actually mate with the checkpoint in front of you - the layer shapes in this dump tell you exactly what you're working with. Or you want to understand why a model eats so much VRAM, or whether two supposedly-identical checkpoints are structurally the same. And honestly? A lot of people install it because they're just curious what a diffusion model actually looks like under the hood. That's a valid reason.

    How it works

    The mechanism is barely more than a print statement. ComfyUI's MODEL object wraps the real neural network inside it, and this node grabs model.model.diffusion_model - the actual nn.Module - then captures its string representation. For an SD 1.5/SDXL checkpoint that's the UNet: encoder, mid-block, decoder, every conv layer with its channel counts and resolutions. For a Flux or SD3.5-class model it's the transformer - the DiT blocks, the timestep embeddings, the final projection, each with exact shapes.

    The code is defensive where it matters: if the wrapped model has no diffusion_model attribute it prints "No diffusion_model attribute found" instead of crashing, and if there's no model at all it tells you so. It's output-node-only (OUTPUT_NODE, no return types), so it terminates the branch - it's a probe, not a pass-through.

    Same UI quirk as its sibling: the output widget is a required-looking STRING field, but you don't type into it. The pack's tiny JavaScript extension listens for ComfyUI's executed event and writes the dump into that widget after each run. Leave it blank and let the machine do the typing.

    Install

    It ships in the same pack as Debug: Model Metrics, so one install gets you both. Easiest path is ComfyUI Manager: Install Custom Nodes → search ComfyUI-Debug (author liusida - plain "debug" matches half the registry). Or clone it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/liusida/ComfyUI-Debug
    

    Restart ComfyUI and you're done. There's no requirements.txt - the whole pack is pure standard-library Python plus a few lines of JS. No model downloads, no version pins, no dependency conflicts waiting to bite you on the next update. MIT-licensed and stable since April 2024.

    Where people get burned

    • The output is enormous. For a Flux-class model, the architecture dump can run to tens of thousands of characters. The widget will be a wall of text - copy the whole thing out of the node rather than trying to scroll inside it, and Ctrl+F for the layer you actually care about.
    • It fills in only after a run, so "it's blank" usually means you haven't queued the graph yet.
    • The dump reflects the model as loaded - shapes can shift if you're using a quantized GGUF or an fp8 variant, because those change the dtype reported on every tensor. That's information, not a bug; it's how you confirm the quant actually applied.

    If all you need is "what architecture, what size, what precision" in five lines, use Debug: Model Metrics instead - it's the fast path. This node is for when you need to see the machinery itself. For a pack this old and this small, it does that one job surprisingly well.

    Categoryutils

    Inputs (2)

    NameTypeDefaultDescription
    modelMODEL
    outputSTRING

    Outputs (0)

    No outputs