ComfyUI Node Runs on cloud

Latent Batch

Merge two latents into one batch before the expensive part

By WASasquatch·Created 3 years ago·Updated about a year ago· 1,812
Latent Batch

      WAS documents an Image Batch node for combining multiple image tensors into one batch; Latent Batch is the equivalent operation one step earlier in the pipeline, working on latents instead. It takes two (or more) latent inputs and combines them into a single batched latent - the same idea, applied before the VAE decode instead of after it.

      Why batching latents specifically matters

      Latents are what sit between your sampler and your VAE decode, and batching them isn't just bookkeeping - it changes how the GPU actually does the work. Running one KSampler pass over a batch of four is meaningfully more efficient than running four separate sampler calls one after another, because the GPU can process the batch in parallel rather than paying the overhead of four independent passes. The same goes for VAE Decode and any other latent-space operation downstream.

      The practical case: two branches of a workflow produce different latents - maybe two different seeds you're comparing, or two different conditioning setups - and you want to merge them back into a single batch before a shared, expensive step like an upscale or a refinement pass, instead of duplicating that whole back half of the graph to run it twice.

      How it works

      Feed it two (or more) LATENT inputs, get back a single LATENT, batched. Wire the output into a KSampler, VAE Decode, Latent Upscale, or anywhere else downstream that expects a batched latent.

      The one hard requirement: the latents being combined need matching spatial dimensions in latent space - you can't batch a latent from a 512×512 image with one from a 768×768 image without resizing one first. If your two branches generated at different resolutions, run one through WAS's Latent Upscale by Factor (or the core Latent Upscale node) to bring them into alignment before this node, not after.

      Installing it

      Part of the full WAS Node Suite pack:

      • ComfyUI Manager - search WAS Node Suite, install, restart.
      • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/WASasquatch/was-node-suite-comfyui/, then pip install -r requirements.txt from inside that folder, then restart ComfyUI.

      Common issues

      Dimension mismatches are the main failure mode - if this node errors or produces a malformed batch, check that both latents you're feeding in came from the same resolution, since latent space dimensions are a direct function of the pixel dimensions that produced them (downscaled by the VAE's fixed factor). Resize before you batch, not after.

      And the pack-wide caveat: WAS Node Suite has been unmaintained since December 2023, and "Import Failed" errors after a ComfyUI update are a real, recurring complaint tied to older pinned dependencies colliding with newer ones. Reinstalling requirements.txt inside your ComfyUI venv is the usual fix if the whole suite stops loading.

      Categoryx

      Inputs (0)

      No inputs

      Outputs (0)

      No outputs