Select Latents π₯π ₯π π ’(SelectLatents)
This node takes a dictionary containing multiple latent representation samples as input.
Select Latents
The Select Latents π₯π ₯π π ’ node receives a dictionary containing multiple latent representation samples as input.
The Select Latents node is a tool for filtering specific frames from a set of latent representations. Its core function is to extract corresponding parts from the input latent batch based on user-specified indexes and output a new latent batch. This operation is similar to "selecting shots" in video editing, allowing users precise control over the frame sequence for subsequent processing.
Node Function
This node receives a dictionary containing multiple latent representation samples as input. Its internal mechanism parses the index string provided by the user, converts it into a specific index list, and then extracts corresponding data slices from each tensor in the input dictionary based on these indexes. It supports flexible index formats, including single numbers, comma-separated lists, and range representations (e.g., 0-5,10), and can handle potential index out-of-bounds issues.
Node Parameter Description - Select Latents π₯π ₯π π ’
Connection Inputs (Inputs)
| Parameter Name | Data Type | Required | Default Value | Value Range/Options | Description |
|---|---|---|---|---|---|
latent | LATENT | Yes | - | - | latent (Input Parameter): The input latent batch to be filtered, typically from outputs such as VAE encoding or other generation nodes. |
Control Parameters (Parameters)
| Parameter Name | Data Type | Required | Default Value | Value Range/Options | Description |
|---|---|---|---|---|---|
indexes | STRING | Yes | 0 | - | e.g., 1,3,5 or 0-4. Indexes start from 0. |
err_if_missing | BOOLEAN | Yes | True | - | err_if_missing (Input Parameter): When set to True, the node will report an error if a specified index is out of the input range; when set to False, out-of-bounds indexes are ignored. |
err_if_empty | BOOLEAN | Yes | True | - | err_if_empty (Input Parameter): When set to True, the node will report an error if the filtered result based on the indexes is empty; when set to False, empty outputs are allowed. |
Output
| Parameter Name | Data Type | Description |
|---|---|---|
| LATENT | LATENT | LATENT (Output Parameter): The output filtered latent batch, containing only the frames corresponding to the specified indexes. |
Usage Scenarios
This node is very useful in video generation or editing workflows. For example, after using a node that generates latent representations in batches (such as "VAE Encode (for Batches)") to create a latent sequence for a video, you can use this node to select only the highest quality or most critical frames. The filtered results can then be sent to the next sampling or decoding node, allowing you to focus on processing the selected segments, thereby improving workflow efficiency or achieving specific effects.
Notes
Please note that indexes start from 0. If error checking is enabled, the node will throw an exception and stop workflow execution when a specified index exceeds the actual range of the input latent representations or when the final filtered result is empty. This helps quickly locate issues in complex workflows.
Select Latents π₯π ₯π π ’ Node Source Code Link
The Select Latents π₯π ₯π π ’ node is from the ComfyUI-VideoHelperSuite node package.
Comments
Sign in with GitHub to join the discussion.