Krea 2 Scanline Attention
Krea 2 scanline attention: every DiT block head uses a scanline block mask (global text prefix, image tokens attend +/- window//2 latent rows) via flex_attention. Pair with the scanline-distilled Krea 2 LoRA.
Krea 2 Scanline Attention
ComfyUI custom node that swaps the attention in every Krea 2 DiT block for the scanline attention
pattern used to train the scanline-distilled LoRA: text tokens are a global prefix, and each image
token attends only to image tokens within window // 2 latent-token rows. Pair it with the
scanline-distilled Krea 2 LoRA for good results.
Nodes
- Krea 2 Scanline Attention (
advanced/model_patches):MODEL -> MODELenabled— when off, the model is returned unpatched.window— odd number of latent rows each image token attends to (default 11).tile_aligned— admit every valid pair inside an active 128x128 tile, matching the trained graph.
Non-Krea 2 models raise an error. Calls with extra tokens (reference latents) fall back to dense attention.
Requirements
- ComfyUI >= 0.32.0 (Krea 2 model support, comfy-kitchen attention override contract)
- CUDA (uses
torch.nn.attention.flex_attention)
Install
ComfyUI-Manager: search for "Krea 2 Scanline", or comfy node install krea2-scanline.
An example text-to-image workflow is in workflows/krea2_scanline_t2i.json.