From 8ccd4ca886c68a7821297b11334948cbfe95a8a8 Mon Sep 17 00:00:00 2001 From: comfyanonymous <121283862+comfyanonymous@users.noreply.github.com> Date: Thu, 20 Nov 2025 18:15:44 -0500 Subject: [PATCH] Allow any number of input frames in VAE. --- comfy/ldm/hunyuan_video/vae_refiner.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comfy/ldm/hunyuan_video/vae_refiner.py b/comfy/ldm/hunyuan_video/vae_refiner.py index baa01cfa4..3445a8b67 100644 --- a/comfy/ldm/hunyuan_video/vae_refiner.py +++ b/comfy/ldm/hunyuan_video/vae_refiner.py @@ -232,8 +232,8 @@ class Encoder(nn.Module): if self.refiner_vae: xl = [x[:, :, :1, :, :]] - if x.shape[2] > 1: - xl += torch.split(x[:, :, 1:, :, :], self.ffactor_temporal, dim=2) + if x.shape[2] > self.ffactor_temporal: + xl += torch.split(x[:, :, 1: 1 + ((x.shape[2] - 1) // self.ffactor_temporal) * self.ffactor_temporal, :, :], self.ffactor_temporal, dim=2) x = xl else: x = [x]