Append a new guide attention entry to conditioning metadata. Called by guide-adding nodes after appending tokens. Args: conditioning: ComfyUI conditioning list. pre_filter_count: Token count for this guide (before grid_mask filtering). latent_shape: [F, H, W] of the
(
conditioning,
pre_filter_count,
latent_shape,
attention_strength=1.0,
attention_mask=None,
)
| 20 | |
| 21 | |
| 22 | def append_guide_attention_entry( |
| 23 | conditioning, |
| 24 | pre_filter_count, |
| 25 | latent_shape, |
| 26 | attention_strength=1.0, |
| 27 | attention_mask=None, |
| 28 | ): |
| 29 | """Append a new guide attention entry to conditioning metadata. |
| 30 | |
| 31 | Called by guide-adding nodes after appending tokens. |
| 32 | |
| 33 | Args: |
| 34 | conditioning: ComfyUI conditioning list. |
| 35 | pre_filter_count: Token count for this guide (before grid_mask filtering). |
| 36 | latent_shape: [F, H, W] of the pre-dilation guide latent. |
| 37 | attention_strength: Scalar in [0, 1]. 1.0 = full attention (default). |
| 38 | attention_mask: Optional pixel-space mask tensor, shape (1, 1, F, H, W). |
| 39 | |
| 40 | Returns: |
| 41 | Updated conditioning. |
| 42 | """ |
| 43 | existing_entries = _get_guide_attention_entries(conditioning) |
| 44 | entries = [*existing_entries] |
| 45 | entries.append( |
| 46 | { |
| 47 | "pre_filter_count": pre_filter_count, |
| 48 | "strength": attention_strength, |
| 49 | "pixel_mask": attention_mask, |
| 50 | "latent_shape": latent_shape, |
| 51 | } |
| 52 | ) |
| 53 | return _set_guide_attention_entries(conditioning, entries) |
| 54 | |
| 55 | |
| 56 | def normalize_mask(mask): |
no test coverage detected