Rather check is_nested

This commit is contained in:
kijai 2026-01-09 09:12:12 +02:00
parent 04c0dd0737
commit 69603be5d2
3 changed files with 4 additions and 4 deletions

View File

@ -753,7 +753,7 @@ class SamplerCustom(io.ComfyNode):
noise_mask = latent["noise_mask"]
x0_output = {}
callback = latent_preview.prepare_callback(model, sigmas.shape[-1] - 1, x0_output, shape=latent_image.shape)
callback = latent_preview.prepare_callback(model, sigmas.shape[-1] - 1, x0_output, shape=latent_image.shape if latent_image.is_nested else None)
disable_pbar = not comfy.utils.PROGRESS_BAR_ENABLED
samples = comfy.sample.sample_custom(model, noise, cfg, sampler, sigmas, positive, negative, latent_image, noise_mask=noise_mask, callback=callback, disable_pbar=disable_pbar, seed=noise_seed)
@ -944,7 +944,7 @@ class SamplerCustomAdvanced(io.ComfyNode):
noise_mask = latent["noise_mask"]
x0_output = {}
callback = latent_preview.prepare_callback(guider.model_patcher, sigmas.shape[-1] - 1, x0_output, shape=latent_image.shape)
callback = latent_preview.prepare_callback(guider.model_patcher, sigmas.shape[-1] - 1, x0_output, shape=latent_image.shape if latent_image.is_nested else None)
disable_pbar = not comfy.utils.PROGRESS_BAR_ENABLED
samples = guider.sample(noise.generate_noise(latent), latent_image, sampler, sigmas, denoise_mask=noise_mask, callback=callback, disable_pbar=disable_pbar, seed=noise.seed)

View File

@ -122,7 +122,7 @@ def prepare_callback(model, steps, x0_output_dict=None, shape=None):
if x0_output_dict is not None:
x0_output_dict["x0"] = x0
if x0.ndim == 3:
if shape is not None:
cut = math.prod(shape[1:])
x0 = x0[:, :, :cut].reshape([x0.shape[0]] + list(shape)[1:])

View File

@ -1504,7 +1504,7 @@ def common_ksampler(model, seed, steps, cfg, sampler_name, scheduler, positive,
if "noise_mask" in latent:
noise_mask = latent["noise_mask"]
callback = latent_preview.prepare_callback(model, steps, shape=latent_image.shape)
callback = latent_preview.prepare_callback(model, steps, shape=latent_image.shape if latent_image.is_nested else None)
disable_pbar = not comfy.utils.PROGRESS_BAR_ENABLED
samples = comfy.sample.sample(model, noise, steps, cfg, sampler_name, scheduler, positive, negative, latent_image,
denoise=denoise, disable_noise=disable_noise, start_step=start_step, last_step=last_step,