mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-13 18:47:29 +08:00
Defensively truncate/pad nested noise components to match latent
When noise.is_nested with a different number of components than latent_image, truncate extras or pad missing components with torch.zeros_like, mirroring the denoise_mask handling pattern below. Addresses CodeRabbit nitpick on #13318.
This commit is contained in:
parent
2beca418ad
commit
0388ac4309
@ -1008,7 +1008,10 @@ class CFGGuider:
|
|||||||
if latent_image.is_nested:
|
if latent_image.is_nested:
|
||||||
li_tensors = latent_image.unbind()
|
li_tensors = latent_image.unbind()
|
||||||
if noise.is_nested:
|
if noise.is_nested:
|
||||||
n_tensors = noise.unbind()
|
# Truncate extra noise components, pad missing ones with zeros
|
||||||
|
n_tensors = list(noise.unbind()[:len(li_tensors)])
|
||||||
|
for i in range(len(n_tensors), len(li_tensors)):
|
||||||
|
n_tensors.append(torch.zeros_like(li_tensors[i]))
|
||||||
else:
|
else:
|
||||||
# Noise only covers video -- pad remaining components (audio) with zeros
|
# Noise only covers video -- pad remaining components (audio) with zeros
|
||||||
n_tensors = [noise]
|
n_tensors = [noise]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user