Nodes/ComfyUi-MpiNodes/Mpi Packer 2
ComfyUI Node

Mpi Packer 2

Two values, one wire, no empty sockets

By MadPonyInteractive·Created 11 months ago·Updated 4 days ago· 3
Mpi Packer 2
  • any_1
  • any_2
  • pack

Most of a ComfyUI workflow isn't generation, it's plumbing - and the plumbing exists to fight two problems: the same value repeated in five places, and a graph too big to read. Bundling values onto one wire is the second problem's answer. MpiPacker does it with five slots, MpiPacker10 with ten, and MpiPacker2 does it with two.

That's the whole node, and it's the one you'll actually use most, because the pair is the common case. Width and height. An image and its mask. A latent and the seed that made it. A value and the boolean that gates it. With the 5-slot packer you spend three empty sockets on a pair - and an empty socket reads as something the author forgot to connect, which is a worse lie than a socket that was never there.

How it works

Wire any two values into any_1 and any_2 - literally any type, since both slots are declared as the wildcard * - and the node emits one MPI_PACK on a single wire.

Under the hood a pack is just a list. Two consequences follow, and they're both useful:

  • Packs nest. Put a pack into another packer's slot and you're carrying 25 values on one wire from five 5-packs, or 4 from two 2-packs. There's nothing special about the container; it's a list in a list.
  • The format is shared. MpiPacker2 is a straight _count = 2 subclass of the 5-slot node, so a 2-pack goes into any unpacker and any packer's slot exactly like a 5-pack does. You're not locked into a pair-shaped corner of the pack.

Slots are read by name, not by order - the node looks up any_1 and any_2 explicitly rather than trusting the order ComfyUI hands arguments over, which follows the prompt JSON and not the input declarations. So the order you packed in is the order you unpack in, reliably.

Inputs and output

any_1 and any_2 - both optional, both wildcard. An unconnected slot isn't an error; it packs as empty, and an empty slot comes out of the unpacker blocking downstream execution. That's the safety property: a half-wired pair doesn't feed a None into a sampler, it stops the branch.

pack (output, MPI_PACK) - the bundle. That's it. One wire in, one wire out.

Why you'd bother

Two wires instead of one isn't a dramatic saving. The reason to reach for it is where the pair has to travel. MpiAspectRatio outputs its width and height as a 2-slot pack for exactly this reason - dimensions go a long way through a graph, always in pairs, and two wires crossing fifteen nodes is where a graph stops being readable. A pack makes the pair one object that arrives intact.

The trade to keep in mind is the one every context-bus-style node makes: a single wire that carries several values hides which value is inside it, so a mismatch is invisible in the layout. With two explicit wires you can see at a glance that the height isn't connected. With a pack, the connection is present and the contents are wrong. Use packs where the pair genuinely travels together; keep values on separate wires in the region you're actively iterating on.

Install

Part of MadPonyInteractive/ComfyUi-MpiNodes - ComfyUI Manager → search ComfyUi-MpiNodes (registry publisher mad-pony-interactive), or:

cd ComfyUI/custom_nodes
git clone https://github.com/MadPonyInteractive/ComfyUi-MpiNodes

Restart, then search "Mpi Packer 2" - it's under MpiNodes/Logic. No requirements.txt, no model files, nothing to download; the pack has been AGPL-3.0 since v1.2.7 (MIT up to v1.2.6).

Where people get burned

Unpacking into the wrong node. MPI_PACK is this pack's own type, so the other end has to be MpiUnpacker, MpiUnpacker2, MpiUnpacker10 or MpiComparePacks. A core node won't accept it.

Wondering why the branch died. An unconnected slot blocks downstream by design. If a graph stops with no error and no output, check whether you packed a pair but only connected one half.

Thinking of it as a typed pipe. There's no validation. Pack a string where the consumer wants an image and nothing will warn you until the node that uses it fails - the wildcard accepts anything, and the sanity check is on you.

CategoryMpiNodes/Logic

Inputs (2)

NameTypeDefaultDescription
any_1opt*Any value. Unconnected slots come out of Mpi Unpacker blocked.
any_2opt*Any value. Unconnected slots come out of Mpi Unpacker blocked.

Outputs (1)

NameTypeDescription
packMPI_PACK