https://github.com/mithamunda/ComfyUI-SD3.5-Latent-Size-Picker
https://github.com/mithamunda/ComfyUI-SD3.5-Latent-Size-Picker
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mithamunda/ComfyUI-SD3.5-Latent-Size-Picker
- Owner: mithamunda
- Created: 2024-10-29T11:54:01.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-10-29T12:04:37.000Z (8 months ago)
- Last Synced: 2024-10-29T13:35:28.646Z (8 months ago)
- Language: Python
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-comfyui - **SD3.5 Empty Latent Size Picker** - compatible resolutions. This node allows for custom batch sizes, width/height overrides, and inverting aspect ratios, ensuring flexibility and compatibility in ComfyUI workflows. (All Workflows Sorted by GitHub Stars)
README
# 🔧 SD3.5 Empty Latent Size Picker
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.
## Features
- **Supported Resolutions**: Choose from a predefined list of Stable Diffusion v3.5-compatible resolutions.
- **Batch Size Control**: Set a batch size to create multiple latent tensors at once.
- **Width and Height Overrides**: Use custom width and height values as needed, while maintaining Stable Diffusion compatibility constraints.
- **Ratio Inversion Option**: Quickly swap width and height to experiment with alternate aspect ratios.
- **Multiple of 64 Constraint**: Ensures output width and height are multiples of 64, which Stable Diffusion requires for optimal performance.## Parameters
- **resolution**: A dropdown list of pre-configured resolutions for Stable Diffusion v3.5, with a default of `"1024x1024 (1.0)"`.
- **batch_size**: Integer value defining the number of latent tensors to generate. Default is `1`.
- **width_override** and **height_override**: Optional custom dimensions. When set above 0, these values override the selected `resolution` dimensions.
- **invert_ratios**: Option to invert width and height for alternative aspect ratios.## Output
The node returns:
- **LATENT**: A tensor with dimensions `[batch_size, 4, height // 8, width // 8]`, representing empty latent samples ready for further processing.
- **width**: Effective width, accounting for overrides and constraints.
- **height**: Effective height, accounting for overrides and constraints.## Example Code
Here’s an example of how to use this node programmatically:
```python
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}")
```## Installation
To use this node in ComfyUI:
1. Clone the repository into the `custom_nodes` folder in ComfyUI:```bash
git clone https://github.com/mithamunda/ComfyUI-SD3.5-Latent-Size-Picker.git
```2. Restart ComfyUI to enable the node in the interface.
## License
This code is released under the MIT License, allowing for free use, distribution, and modification. See the `LICENSE` file for more details.