Nodes/ComfyUI-gen2/Prepare Flux2 Fun Control
ComfyUI Node

Prepare Flux2 Fun Control

The node that packs your control image into Flux.2 Fun's exact 260-channel token soup

By petmycat·Created 7 months ago·Updated 20 days ago· 23
Prepare Flux2 Fun Control
  • vae
  • control_image
  • mask
  • inpaint_image
  • target_latent
  • control_context

If Gen2_LoadFlux2FunControlNet is the front door, this is the prep kitchen. Gen2_PrepareFlux2FunControl takes your control image, your mask, and your inpaint image and turns them into the exact 260-channel control context the Fun ControlNet expects. It's the node where "wait, why does my control look wrong" usually starts, because it's also where the sizes have to line up.

What it's actually building

The Fun ControlNet consumes a packed latent context made of three stacked chunks:

  • 128 channels of control latents - your control image encoded through ComfyUI's Flux.2 VAE
  • 4 channels of preserved-mask tokens - the mask, reshaped into the 4-channel token space the Fun models use
  • 128 channels of inpaint latents - for the inpaint mode's base image

128 + 4 + 128 = 260. That's the "2602" in the checkpoint name and the reason this pack insists on exact packing rather than the heuristic tensor reshaping some older ControlNet ports get away with. The mask itself is binary (0.5 threshold) and repainted into the token grid; the VAE contract is checked too - it needs the Flux.2 VAE with latent_channels=128 and downscale_ratio=16, so don't wire in an SDXL VAE and expect mercy.

The inputs you'll actually set

Only vae is required - the Flux.2 VAE, same one you use to decode your samples. Everything else is optional, and which ones you fill decides the mode:

  • control_image - your condition (canny/depth/pose/etc. or a plain reference image). Leave it disconnected and the control branch gets zero-valued latents.
  • mask - the region to repaint. White means "repaint here."
  • inpaint_image - the base image for inpaint mode.
  • target_latent - this is the one people miss. Wire the LATENT output of your sampler's input (the empty latent, or the latent you're sampling) into it so the control canvas exactly matches the sampled main-image size. Mismatched sizes are the #1 cause of "the control did nothing / the image exploded."

The single output, control_context, goes into Gen2_ApplyFlux2FunControl.

Install

ComfyUI Manager: search ComfyUI-gen2. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/petmycat/ComfyUI-gen2.git
cd ComfyUI-gen2
pip install -r requirements.txt

Restart, and make sure you're on ComfyUI v0.28.0+ - the Flux2 Fun section is pinned to a specific recent commit and won't behave on older runtimes. No extra model downloads here beyond the Flux.2 Dev stack itself (VAE included); the ControlNet file itself loads in the other node.

The gotcha that costs an afternoon

The target_latent wiring. The README is blunt: "Connect the sampling LATENT to target_latent so the control canvas exactly matches the main image tokens." If you skip it, the node builds context at whatever resolution the VAE spits out, and the apply step downstream can't reconcile it with your actual sample size. A clean mental model: this node is the control equivalent of VAEEncode - you're building a latent from an image, and it must share the geometry of the latent you're actually sampling. Also note the pack's honest caveat applies here too: real-weight parity is not yet claimed, so if a control comes back mushy, it may be the young implementation, not your inputs.

CategoryGen2/Flux2 Fun ControlNet

Inputs (5)

NameTypeDefaultDescription
vaeVAE
control_imageoptIMAGE
maskoptMASK
inpaint_imageoptIMAGE
target_latentoptLATENT

Outputs (1)

NameTypeDescription
control_contextFLUX2_FUN_CONTEXT