BlehAdvancedAttentionSampler
Rules-based attention switching mid-sample
- sampler
- op_0
- op_1
- op_2
- op_3
- op_4
- op_5
- op_6
- op_7
- op_8
- op_9
- SAMPLER
This is the least-documented node in the whole pack. It doesn't get a mention anywhere in the README's prose - only BlehSageAttentionSampler and BlehGlobalSageAttention are named for SageAttention support - and the node's own description field in ComfyUI just says "TBD." What follows is reconstructed entirely from the node's own default configuration, which happens to double as the closest thing this node has to a spec. Worth knowing that going in: this is an advanced, source-reading node, not a beginner's Saturday-afternoon add-on.
Shape-wise, it's a sampler wrapper like BlehSageAttentionSampler - but instead of a single on/off attention swap across a time window, it evaluates a list of rules and picks which attention function applies based on where you are, on multiple axes at once: time (as a percent or a sigma value, via time_mode), which numbered call to attention this is within a single model evaluation (call_indexes - the schema's comment notes negative indexes count from the end, but only after a full pass through the model), and even which items in the batch get the rule applied (batch_slice - null for everything, or cond/uncond/a list).
Each rule in the list names an attn_function (the default config shows both default and sageattn as examples, and the tooltip says these values get "passed directly to the SageAttention function" much like the simpler sampler node) and can optionally set a blend_mode and blend to mix the new attention result against whatever the previous rule produced, rather than hard-switching between them. The schema's own comment spells out what the default blend actually computes: sageattn + (defaultattn - sageattn) * 2.
Inputs: sampler (required - wraps any SAMPLER), yaml_parameters (required, and genuinely worth reading even if you never touch this node - the widget ships pre-filled with a complete example covering verbose, start_time/end_time, time_mode, call_indexes, batch_slice, min_cond_batch, and a full rules list, which is the clearest documentation of this concept anywhere in the pack). There are also ten optional slots, op_0 through op_9, each taking a LATENT_OPERATION - presumably applied per matching rule, though nothing in the schema or README explains exactly how they map onto the rules list. Output is a SAMPLER.
The honest gap here is real: there's no worked example beyond the default YAML, no README section, and nothing findable in the wider community discussing it by name. If what you actually want is SageAttention scoped to a time window, BlehSageAttentionSampler is the documented, supported path and it'll get you there with far less guesswork. Reach for this node specifically if you need per-call-index or per-batch-item attention control that the simpler node doesn't expose - and expect to spend time reading the default YAML comments closely before your first rule does what you expect.
Install is standard for the pack: ComfyUI Manager, or a manual clone plus restart. If a rule names sageattn, you'll also need SageAttention manually installed into your Python environment - same install caveat as the other SageAttention-adjacent nodes in this pack.
Inputs (12)
| Name | Type | Default | Description |
|---|---|---|---|
| sampler | SAMPLER | — | |
| yaml_parameters | STRING | verbose: false start_time: 0.0 end_time: 1.0 # One of: percent, sigma time_mode: percent # .inf means match everything. Whole float values exclude an index. I.E 2.0 # Call index as in the Nth call to attention this model evaluation. # Negative indexes count from the end but can only match after a pass through the model. call_indexes: [.inf] # Can be set to null (everything), cond, uncond or a list. batch_slice: null # Requires cond batch information to be passed and at least this many items. min_cond_batch: 0 rules: # Passed as sageattn_function unless set to default. # Keys not in this list are passed through like with the SageAttention node: # attn_function, blend_mode, blend - attn_function: default # You can set whatever other keys you want here. - attn_function: sageattn # Blends target the last attention result and are ignored # if it's missing. # The default blend means: # sageattn + (defaultattn - sageattn) * 2 blend_mode: cfg blend: 2.0 | Allows specifying custom parameters via YAML. These are mostly passed directly to the SageAttention function with no error checking. Must be empty or a YAML object. |
| op_0opt | LATENT_OPERATION | — | |
| op_1opt | LATENT_OPERATION | — | |
| op_2opt | LATENT_OPERATION | — | |
| op_3opt | LATENT_OPERATION | — | |
| op_4opt | LATENT_OPERATION | — | |
| op_5opt | LATENT_OPERATION | — | |
| op_6opt | LATENT_OPERATION | — | |
| op_7opt | LATENT_OPERATION | — | |
| op_8opt | LATENT_OPERATION | — | |
| op_9opt | LATENT_OPERATION | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| SAMPLER | SAMPLER | — |