santa hat
deerdeer nosedeer glow
Sign In

ComfyUI - Guide to Stacker Nodes

ComfyUI - Guide to Stacker Nodes

This article is about Stacker Nodes and how to use them in workflows. It is intended for both new and advanced users of ComfyUI.

Stacker nodes are a new type of ComfyUI node that open the door to a range of new workflow possibilities.

What are stacker nodes?

  • Stacker nodes store lists of data but do not process data other than doing data validation.

  • Stacker nodes usually look like tables or list and have the same input and output.

  • They are generally paired with an 'Apply' node that processes the items in the table or list.

Advantages of Stacker Nodes

  • They are very extensible. If you need more items in your stack then just chain another stacker node of the same type. For example you can chain three CR LoRA Stack nodes to hold a list of 9 LoRAs.

  • Some stacker nodes may include a switch attribute that allows you to turn each item On/Off. This is very useful for retaining configurations in your workflow, and for rapidly switching configurations.

  • Stacker nodes work well with schedulers.

  • Stackers can also store local attributes that apply to all item in the stacker node.

  • They are compact and help reduce complexity in workflows. For example the CR Multi-Control Stack can be used used to replace six separate nodes.

  • Stack nodes do not need to be located lose to the point where they are applied in a workflow. They can be located in a control panel and connected to the apply node via a single connector. This facilitates modularization of workflows.

Node Packs including Stacker Nodes

Types of Stacker Node

There are several types of stacker nodes. These include:

  • Tabular Stackers

    • These nodes are similar to tables and hold a list of items with associated attributes.

    • In the LoRA Stack node the list of items is the LoRA names, and the attributes are the switch, model_weight, and clip_weight.

    • The output from these nodes is a list or array of tuples.

    • Examples include

      • CR LoRA Stack, CR Multi-ControlNet Stack, and CR Model Stack

      • CR Model List and CR LoRA List

  • List Stackers

    • These nodes simply hold a list of items

    • Examples include

    • CR Prompt List, CR Image List, and CR Text List

  • Non-Tabular Stackers

    • Examples include Control Net Stacker in Efficiency Nodes

Using Local Attributes

Local attributes can be placed at the top of stacker lists.

Examples include CR Animation Stack. In this node, keyframe_interval and loop attributes apply to all the items in the table. Each item has five attributes (including the two local attributes).

Efficiency Loader

The Efficiency Loader node is a special case node that includes inputs for two types of stack.

  • lora-stack accepts inputs from LoRA Stacker or CR LoRA Stack

  • cnet-stack accepts inputs from Control Net Stacker or CR Multi-ControlNet Stack

How to Make A Stacker Node

Stacker nodes are very easy to code in python, but apply nodes can be a bit more difficult.

Stacker Node

First define the inputs

Then set the return types, return names, function name, and set the category for the ComfyUI Add Node pop-up menu

Then define the function

  • Inititialise the list

  • Extend or append the items from any input stacks

  • Extend or append the items from the node

  • Return the list

Apply Node

First define the inputs

Then set the return types, return names, function name, and set the category for the ComfyUI Add Node pop-up menu

Then define the function

  • Inititialise the attributes list

  • Extend or append the items from the incoming stacks

  • Loop through each item in the list

    • expand each tuple if using a tuple list

    • do something

  • Return the output from doing something

FAQ

Q. Are stacker nodes only useful in specific situations?

A. No, they can be used in most workflows substituting for other frequently used nodes.

  • For example Load LoRA can be substituted with CR LoRA Stack and CR Apply LoRA

Examples of Stacker Nodes

CR LoRA Stack

  • tabular

  • LORA_STACK tuple data type

CR Multi-ControlNet Stack

  • tabular

  • CONTROLNET_STACK tuple data types

  • applied using CR Apply Multi-ControlNet

CR Model Stack

  • tabular

  • MODEL_STACK tuple data types

  • applied using CR Apply Model Merge

CR Prompt List

  • list

  • PROMP_LIST string data type

  • applied using CR Prompt List Keyframes

CR Animation Stack

  • tabular

  • local attributes

    • keyframe_interval

    • loops

  • ANIMATION_STACK tuple data type

  • applied using CR Animation Stack Keyframes

49

Comments