A utility node for generating empty latent tensors in Stable Diffusion v3.5-compatible resolutions. This node allows for custom batch sizes, width/height overrides, and inverting aspect ratios, ensuring flexibility and compatibility in ComfyUI workflows.
A utility node for generating empty latent tensors in Stable Diffusion v3.5-compatible resolutions. This node allows for custom batch sizes, width/height overrides, and inverting aspect ratios, ensuring flexibility and compatibility in ComfyUI workflows.
"1024x1024 (1.0)"
.1
.resolution
dimensions.The node returns:
[batch_size, 4, height // 8, width // 8]
, representing empty latent samples ready for further processing.Here’s an example of how to use this node programmatically:
import torch
from ComfyUI-SD3.5-Latent-Size-Picker.sd3_5_empty_latent import SD3_5EmptyLatent
# Initialize the SD3_5EmptyLatent node
latent_picker = SD3_5EmptyLatent()
# Set parameters
resolution = "1024x1024 (1.0)"
batch_size = 2
width_override = 768
height_override = 0
invert_ratios = "No"
# Execute to generate the latent tensor
latent_output, width, height = latent_picker.execute(
resolution=resolution,
batch_size=batch_size,
width_override=width_override,
height_override=height_override,
invert_ratios=invert_ratios
)
print(f"Latent Shape: {latent_output['samples'].shape}, Width: {width}, Height: {height}")
To use this node in ComfyUI:
Clone the repository into the custom_nodes
folder in ComfyUI:
git clone https://github.com/mithamunda/ComfyUI-SD3.5-Latent-Size-Picker.git
Restart ComfyUI to enable the node in the interface.
This code is released under the MIT License, allowing for free use, distribution, and modification. See the LICENSE
file for more details.