ComfyUI Node

Model Test

A debug console bolted onto your model, handle with care

By spacepxl·Created 3 years ago·Updated 8 months ago· 293
Model Test
  • model
    coded = model.model.model_config.unet_config for k in d.keys(): print(k, d[k])

    This one isn't for generating images - it's a debugging tool, and an unusually blunt one: it hands you a live Python code box wired directly to your loaded model object. Drop it in, hit run, and whatever code is in the box executes against model. The default snippet prints out the UNet config keys, which is a genuinely useful "what am I actually looking at" check when you've loaded a checkpoint and want to know its architecture at a glance - channel counts, resolution, all the stuff normally buried in the checkpoint's config.

    What it's for

    Checkpoint architecture isn't always obvious from the filename. Is this actually SDXL-shaped under the hood, or a weird merge? What does this UNet expect? The default code -

    d = model.model.model_config.unet_config
    for k in d.keys():
        print(k, d[k])
    
    • dumps exactly that straight to the console. Beyond the default, since it's arbitrary code, you can inspect anything reachable from the model object: layer shapes, parameter counts, whatever you need while debugging a custom node, a merge, or a conversion.

    Inputs and outputs that matter

    • model - the model you want to inspect.
    • code - a multiline string field, defaulting to the UNet-config dump above. This is genuinely arbitrary Python, executed with model in scope.

    No outputs - it's an output node in the ComfyUI sense (it runs as a terminal action), but nothing flows onward from it. The result is whatever your code prints to the console, not anything visible in the graph.

    Installing it

    ComfyUI Manager: search ComfyUI Image Filters. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/spacepxl/ComfyUI-Image-Filters
    

    Restart. Nothing to download for this specific node - it's a debug utility, not a model or filter with its own dependencies. The pack as a whole leans on opencv though, and if you hit import errors on startup from a conflicting opencv install elsewhere, run import_error_install.bat from the repo, or manually reinstall just opencv-contrib-python after removing the other opencv variants.

    Where people get burned

    The real risk here isn't a bug, it's the design: this node executes arbitrary Python against your running ComfyUI process. That's fine when you wrote the code yourself. It's not fine if you load a workflow from somewhere you don't fully trust that happens to contain a Model Test node with a modified code field - ComfyUI workflow JSON carries node values along with the graph, so a shared workflow can absolutely ship a payload in that box. Treat this node the way you'd treat any "paste and run" code snippet from a stranger: read it before you execute it, and don't assume a workflow you downloaded is safe just because the rest of the graph looks normal.

    Less dramatically: if your code errors out, check that you're actually reaching the right attribute path for your model type - model.model.model_config assumes a fairly standard ComfyUI model wrapper, and some custom loaders or heavily patched models won't have exactly that shape. A quick print(dir(model)) is a reasonable first move if the default snippet throws an AttributeError.

    CategoryImage-Filters/utils

    Inputs (2)

    NameTypeDefaultDescription
    modelMODEL
    codeSTRINGd = model.model.model_config.unet_config for k in d.keys(): print(k, d[k])

    Outputs (0)

    No outputs