Nodes/Comfyui_CharaConsist/Reference Condition Combine
ComfyUI Node

Reference Condition Combine

Stack five references into one batched conditioning

By thatname·Created 10 months ago·Updated 9 months ago· 1
Reference Condition Combine
  • reference_condition1
  • reference_condition2
  • reference_condition3
  • reference_condition4
  • reference_condition5
  • target_condition
  • condition
  • condition_mask
num_targets

ReferenceConditionCombine is the plumbing node of CharaConsist's batched workflow. It exists for one job: take up to five reference conditions plus one target condition and mash them into a single CONDITIONING tensor that a batched sampler can consume, alongside a mask that says which text tokens belong to which image in the batch. If you've ever fought with conditioning for multi-image batches - different prompts per image, different lengths, CLIP padding everything to the longest - this is the node that does that fighting for you.

It matters because the batched route through BatchedMaskedReferenceGen samples references and targets together, and attention masking needs to know token ownership. This node produces the ownership map. On its own it does nothing visible; as part of the batch flow it's essential.

How it works

Each CONDITIONING input is a text-embedding tensor, and they're all different lengths. The node computes the longest sequence, pads every reference and target embedding to that length, and stacks them into one tensor with shape [num_references + num_targets, max_seq_len, embed_dim]. The condition_mask output is the ledger: a row per image in the batch, with 1s marking the tokens that are real and 0s marking padding.

One wrinkle worth knowing: pooled output is only carried through for Flux. Chroma's text encoder has no pooled output, so on Chroma that field is None and everything downstream just doesn't use it. The node handles both, but it's the kind of model-specific behavior that surprises you if you swap backends mid-workflow.

Inputs and outputs that matter

Required: num_targets (INT) - how many target images you're generating alongside the references. That's the only required input, and it's the one beginners forget to set. Optional: reference_condition1 through reference_condition5 (CONDITIONING) - your reference subjects' prompts, one per subject - and target_condition (CONDITIONING), the prompt for the target image.

Outputs: condition (CONDITIONING) - the padded, batched stack you feed to the sampler - and condition_mask (MASK), which you feed to BatchedMaskedReferenceGen so it knows where the real tokens are. That's the loop: combine → mask → batched generation.

Install and troubleshooting

Same pack install as the rest: ComfyUI Manager → search "Comfyui_CharaConsist", or git clone https://github.com/thatname/Comfyui_CharaConsist.git into custom_nodes, restart, look under chara_consist. No pip deps; Flux, Chroma, and Qwen-Image models only.

Two practical notes. First, num_targets being wrong is the classic error - too low and the batch is short, too high and you're sampling empty target rows. Second, this node pads rather than truncates, so a very long reference prompt stretches every row in the batch to its length; that's RAM and compute you're paying for on every image. Keep reference prompts lean. It's an unglamorous utility node, the kind nobody upvotes, but the batched multi-subject workflow doesn't run without it - and now you know exactly which of its two outputs goes where.

Categorychara_consist

Inputs (7)

NameTypeDefaultDescription
num_targetsINT
reference_condition1optCONDITIONING
reference_condition2optCONDITIONING
reference_condition3optCONDITIONING
reference_condition4optCONDITIONING
reference_condition5optCONDITIONING
target_conditionoptCONDITIONING

Outputs (2)

NameTypeDescription
conditionCONDITIONING
condition_maskMASK