ComfyUI Node

K2 Compose

K2 Compose is the node that turns Krea 2 region boxes into a working graph

By ping1979ping·Created 6 months ago·Updated about a month ago· 0
K2 Compose
  • model
  • clip
  • regions
  • loras
  • emphasis
  • projector
  • tuning
  • model
  • positive
  • negative
  • latent
  • mask
  • plan
  • compiled_prompt
  • report
global_prompt
negative_prompt
width1024
height1024
batch_size1

K2 Compose is the middle of the K2 Lab, the part of comfyui-FVMtools that makes Krea 2 do regional prompting the same way the standalone K2Lab desktop app does. If you're coming from the multi-character LoRA problem - two characters, two LoRAs, one image, and the model keeps blending them - this is the node that takes your hand-drawn boxes, your per-box prompts, and your regional LoRAs, and compiles them into something a plain KSampler can run.

Krea 2 is a single-stream MMDiT: text and image tokens travel through the same blocks in one [text | image] sequence. There's no second conditioning branch to hang a second person on, which is exactly why the old "two prompts" trick fails. K2 Compose works around that by patching the attention instead. It takes every enabled region prompt, compiles them into one unified Krea prompt with explicit location clauses, tokenizes it so each clause knows its token span, installs the spatial attention router on the model branch, mounts your regional LoRAs as unfused, token-gated forward adapters, and applies the projector delta if one is connected. The image-to-image attention is deliberately left alone, so you don't get tile seams at box borders. Everything runs in one denoising pass - no crop compositing, no second sampler.

The inputs that matter

  • model and clip - the Krea 2 MODEL and a CLIP loaded with type krea2 (Qwen3-VL). The model is cloned and patched; your incoming branch stays untouched.
  • global_prompt - this one's a trap. It's the scene-wide description, and the tooltip spells out why you must keep people out of it: image tokens outside every region see only this text, so a person mentioned here gets drawn there. The author measured it - a scene-only prompt gave 2 faces, "…a woman standing…" gave 3, "group portrait…" gave 5. Describe the subjects in their boxes, describe the scene here.
  • width / height - output size and the coordinate system for every region box. Changing them moves all the boxes.
  • negative_prompt - global negative. Worth knowing: Krea 2 Turbo runs CFG-free, so this only does anything when you sample with CFG > 1.

Optional inputs chain the region, LoRA, emphasis, projector, and tuning objects from the other K2 nodes. Without regions connected, this behaves like a plain prompt encode.

What comes out

The outputs are deliberately boring, standard ComfyUI types: patched model, positive / negative CONDITIONING, an empty latent, a mask (the region union), plus plan, the compiled prompt string, and a JSON report. Because the patched model is still a normal MODEL, you can feed it through ControlNet, guiders, FreeU, or any sampler. Wire the model, positive, negative, and latent into K2 Regional Sampler (not a plain KSampler) when you've enabled late-step relaxation or LoRA-delta adaptation - that's the only node that reports denoising progress back to the router.

Install and gotchas

Clone the pack into ComfyUI/custom_nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/ping1979ping/comfyui-FVMtools

Then restart ComfyUI. The K2 suite needs no extra Python dependencies (just numpy, which ComfyUI already ships), but you do need the actual Krea 2 files - Turbo or RAW transformer, the Qwen3-VL-4B encoder, and the Qwen-Image VAE - in your models/ folders. The tested combo is krea2_turbo_int8_convrot + qwen3vl_4b_int8_convrot + qwen_image_vae. Krea 2 Turbo wants 8 steps, CFG 1.0, euler/simple.

One hard rule: the router claims ComfyUI's optimized_attention_override, so don't put a second node using that same hook on the same model branch. And don't disable spatial_enabled while a regional LoRA is active - its text delta would turn into shared scene conditioning and leak into every box. If a generation looks wrong, check the report first: spatial_attention.main_stream_attention_calls must be greater than zero, and warnings should be empty.

CategoryFVM Tools/K2

Inputs (12)

NameTypeDefaultDescription
modelMODELKrea 2 MODEL. It is cloned and patched; the incoming branch stays untouched.
clipCLIPCLIPLoader with type 'krea2' (Qwen3-VL).
global_promptSTRINGScene-wide description — keep people OUT of it. Regional clauses are appended after it. Image tokens outside every region see only this text, so a person mentioned here is drawn there. Measured with two regions: scene-only → 2 faces, '…a woman standing…' → 3, 'group portrait…' → 5.
negative_promptSTRINGGlobal negative. Krea 2 Turbo runs CFG-free, so this only matters with CFG > 1.
widthINT102464–16384Output width AND the coordinate system for every region box. Changing it moves all boxes.
heightINT102464–16384Output height and vertical box coordinate system.
batch_sizeINT11–64Region and LoRA routing is broadcast across the batch.
regionsoptK2_REGIONRegion chain. Without it this behaves like a plain prompt encode.
lorasoptK2_LORALoRA assignments from K2 Regional LoRA.
emphasisoptK2_EMPHASISPhrase emphases.
projectoroptK2_PROJECTORProjector delta.
tuningoptK2_TUNINGSpatial tuning. Defaults are used when nothing is connected.

Outputs (8)

NameTypeDescription
modelMODEL
positiveCONDITIONING
negativeCONDITIONING
latentLATENT
maskMASK
planK2_PLAN
compiled_promptSTRING
reportSTRING