Allow regular single image Empty Latent Image node to be used with H3. (#15677)

This commit is contained in:
comfyanonymous
2026-08-16 18:34:39 -07:00
committed by GitHub
parent b963f4ad21
commit 0696f61dce
2 changed files with 21 additions and 1 deletions

View File

@@ -45,7 +45,7 @@ def prepare_empty_noise(latent_image):
def fix_empty_latent_channels(model, latent_image, downscale_ratio_spacial=None, downscale_ratio_temporal=None):
if latent_image.is_nested:
return latent_image
latent_format = model.get_model_object("latent_format") #Resize the empty latent image so it has the right number of channels
latent_format = model.get_model_object("latent_format")
is_empty = torch.count_nonzero(latent_image) == 0
if is_empty:
if latent_format.latent_channels != latent_image.shape[1]:
@@ -64,6 +64,9 @@ def fix_empty_latent_channels(model, latent_image, downscale_ratio_spacial=None,
new_t = max(1, round(latent_image.shape[2] * ratio))
latent_image = comfy.utils.repeat_to_batch_size(latent_image, new_t, dim=2)
if is_empty:
latent_image = latent_format.fix_empty_latent(latent_image)
return latent_image
def prepare_sampling(model, noise_shape, positive, negative, noise_mask):