ComfyUI-EmptyHunyuanLatent

ComfyUI-EmptyHunyuanLatent
★ 10

Hunyuan兼容空latent生成图像与视频自动对齐16倍数
生成与Hunyuan模型兼容的空latent张量(图像/视频),提供常见固定纵横比选择并自动对齐为16的倍数,方便在ComfyUI中快速构建标准化的latent输入。
💡 在ComfyUI中快速创建与Hunyuan兼容的空白图像或视频latent作为生成起点。
🍴 3 Forks💻 Python🔄 2024-12-29
📦
网盘下载
复制链接后前往夸克网盘下载
https://pan.quark.cn/s/8f9eee5e2cdb
nodes
video
image
📄 README

ComfyUI Hunyuan Latent Nodes

Custom nodes for ComfyUI to generate empty latent space compatible with Hunyuan models for both image and video generation.

For video

For Images

Features

  • Fixed aspect ratio selection from common formats (1:1, 16:9, 9:16, etc.)
  • Support for both image and video latent generation
  • All dimensions are automatically adjusted to be multiples of 16
  • Maintains compatibility with Hunyuan model tensor format
  • Available Nodes

    EmptyHunyuanLatentForImage

    Creates an empty latent space for image generation with the following parameters:

  • resolution: Dropdown selection of common aspect ratios and resolutions
  • batch_size: Number of images to generate in parallel (default: 1)
  • EmptyHunyuanLatentForVideo

    Creates an empty latent space for video generation with the following parameters:

  • resolution: Same resolution options as image node
  • frames: Number of frames to generate (default: 16, range: 1-256)
  • batch_size: Number of videos to generate in parallel (default: 1)
  • Supported Resolutions

    The nodes support various standard resolutions with their aspect ratios:

  • Portrait formats:
  • 576×1024 (9:16)
  • 704×1408 (1:2)
  • 768×1344 (4:7)
  • And more…
  • Square format:
  • 1024×1024 (1:1)
  • Landscape formats:
  • 1024×576 (16:9)
  • 1344×704 (16:9)
  • 1408×704 (2:1)
  • And more…
  • Installation

    Install from ComfyUI Manager

    or

    cd ComfyUI/custom_nodes

    Clone this repository:

    git clone https://github.com/ShmuelRonen/ComfyUI-Hunyuan-Latent.git

    Restart ComfyUI

    The nodes will appear in the node menu under:

  • latent for EmptyHunyuanLatentForImage
  • latent/video for EmptyHunyuanLatentForVideo
  • Usage

  • Right-click in the ComfyUI workspace
  • Navigate to:
  • latent → EmptyHunyuanLatentForImage for image generation
  • latent/video → EmptyHunyuanLatentForVideo for video generation
  • Select desired resolution from the dropdown
  • Connect to other nodes in your workflow
  • Node Output Format

    Both nodes output a latent dictionary with the key “samples” containing a torch tensor with the following dimensions:

  • Image: [batch_size, 4, 1, height//8, width//8]
  • Video: [batch_size, 4, frames, height//8, width//8]
  • Requirements

  • ComfyUI
  • PyTorch
  • Hunyuan model dependencies
  • Latest Hunyuan models from HuggingFace

    https://huggingface.co/Comfy-Org/HunyuanVideo_repackaged/tree/main/split_files/text_encoders

    I recomended this hunyuan_video_720_cfgdistill_fp8_e4m3fn model for fast operation:

    https://drive.google.com/file/d/1BvGHjR4Mb60ZPx9tqzA1AabAwZc47ctx/view?usp=sharing

    License

    MIT

    Contributing

    Contributions are welcome! Please feel free to submit a Pull Request.