Nodes/RES4LYF/ClownStyle_Block_MMDiT
ComfyUI Node Runs on cloud

ClownStyle_Block_MMDiT

Full transformer-block control for style transfer on MMDiT models

By ClownsharkBatwing·Created 2 years ago·Updated 21 days ago· 1,222
ClownStyle_Block_MMDiT
  • mask
  • blocks
  • blocks
modescattersort
apply_toimg+txt
block_typesingle
block_listall
block_weights1.0
attn_norm0.00
attn_norm_mod0.00
attn0.00
attn_gated0.00
attn_res0.00
ff_norm0.00
ff_norm_mod0.00
ff0.00
ff_gated0.00
ff_res0.00
tile_h128
tile_w128
invert_maskfalse

Where ClownStyle_Attn_MMDiT only taps the attention math inside an MMDiT block, this node steps back and gives you the whole block - both the attention sublayer and the feedforward sublayer, each broken into five tap points. It's for the same job as the rest of the ClownStyle_* family (chained into ClownStyle_UNet's blocks input to push style-transfer control deeper into Flux, SD3.5, HiDream, AuraFlow or Chroma), just at a coarser, whole-block grain than the attention-only node.

How it works

A modern DiT-style block is built as two sublayers, each following the same shape: a normalization step (sometimes modulated by the model's conditioning, AdaLN-style), the sublayer's core operation, an optional gate, and a residual add back into the stream. This node exposes exactly that structure twice - once for attention, once for feedforward: attn_norm/attn_norm_mod/attn/attn_gated/attn_res for the attention sublayer, and ff_norm/ff_norm_mod/ff/ff_gated/ff_res for the feedforward sublayer. Nine floats total, each a weight for how strongly the chosen mode (the same style-matching algorithms as ClownStyle_UNet) applies at that specific point in the block.

The inputs and outputs that matter

  • mode - the style-matching algorithm (scattersort, AdaIN, WCT, etc.) applied wherever a tap is nonzero.
  • apply_to (img / img+txt / img,txt / txt) and block_type (double / double,single / single) - same meaning as on ClownStyle_Attn_MMDiT: which token stream and which block family to target.
  • block_list (default "all") / block_weights (default "1.0") - narrow to specific blocks and weight them individually.
  • The nine floats - attn_norm, attn_norm_mod, attn, attn_gated, attn_res, ff_norm, ff_norm_mod, ff, ff_gated, ff_res - all default to 0. If you just want "style transfer at this whole block, roughly evenly," turning on attn and ff alone gets you most of the way there before you start reaching for the norm/gate/residual taps individually.
  • mask + invert_mask restrict spatially; tile_h/tile_w only matter for tiled_ modes.
  • blocks (optional in/out) chains with the rest of the ClownStyle_* family, ultimately into ClownStyle_UNet.

How to install it

Via ComfyUI Manager, search "RES4LYF". Or:

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

then restart.

Common issues & troubleshooting

Nine floats is a lot to reason about at once - don't turn them all on together. Start with attn and ff, the two "main operation" taps, before layering in the norm/gated/residual variants; each one compounds with the others, and it's hard to tell what's doing what if you enable all nine simultaneously.

This sits between ClownStyle_Attn_MMDiT and ClownStyle_UNet in granularity. If attention-only control feels too narrow and the top-level node's proj_in/proj_out feels too broad, this is the middle rung - reach for it when you want "this whole block, both halves" rather than one specific projection.

Same block-list gotcha as the rest of the family: a malformed block_list string silently fails to select what you meant. Leave it at "all" until the floats are dialed in, then narrow.

CategoryRES4LYF/sampler_extensions

Inputs (20)

NameTypeDefaultDescription
modeCOMBOscattersort10 options: none, scattersort_dir, scattersort_dir2, scattersort, tiled_scattersort, AdaIN, +4
apply_toCOMBOimg+txt4 options: img, img+txt, img,txt, txt
block_typeCOMBOsingle3 options: double, double,single, single
block_listSTRINGall
block_weightsSTRING1.0
attn_normFLOAT0.00-100–100Strength of effect on layer; skips extra calculation if set to 0.0. Skips interpolation if set to 1.0.
attn_norm_modFLOAT0.00-100–100Strength of effect on layer; skips extra calculation if set to 0.0. Skips interpolation if set to 1.0.
attnFLOAT0.00-100–100Strength of effect on layer; skips extra calculation if set to 0.0. Skips interpolation if set to 1.0.
attn_gatedFLOAT0.00-100–100Strength of effect on layer; skips extra calculation if set to 0.0. Skips interpolation if set to 1.0.
attn_resFLOAT0.00-100–100Strength of effect on layer; skips extra calculation if set to 0.0. Skips interpolation if set to 1.0.
ff_normFLOAT0.00-100–100Strength of effect on layer; skips extra calculation if set to 0.0. Skips interpolation if set to 1.0.
ff_norm_modFLOAT0.00-100–100Strength of effect on layer; skips extra calculation if set to 0.0. Skips interpolation if set to 1.0.
ffFLOAT0.00-100–100Strength of effect on layer; skips extra calculation if set to 0.0. Skips interpolation if set to 1.0.
ff_gatedFLOAT0.00-100–100Strength of effect on layer; skips extra calculation if set to 0.0. Skips interpolation if set to 1.0.
ff_resFLOAT0.00-100–100Strength of effect on layer; skips extra calculation if set to 0.0. Skips interpolation if set to 1.0.
tile_hINT12816–10000Tile size for tiled modes. Lower values will transfer composition more effectively. Dimensions of image must be divisible by this value.
tile_wINT12816–10000Tile size for tiled modes. Lower values will transfer composition more effectively. Dimensions of image must be divisible by this value.
invert_maskBOOLEANfalse
maskoptMASK
blocksoptBLOCKS

Outputs (1)

NameTypeDescription
blocksBLOCKS