From 793386d754a6c3085fee5472f63efa6b210a7599 Mon Sep 17 00:00:00 2001 From: Rattus Date: Thu, 19 Mar 2026 13:14:00 +1000 Subject: [PATCH] ltx: vae: Automate truncation for encoder Other VAEs just truncate without error. Do the same. --- comfy/ldm/lightricks/vae/causal_video_autoencoder.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/comfy/ldm/lightricks/vae/causal_video_autoencoder.py b/comfy/ldm/lightricks/vae/causal_video_autoencoder.py index 035f1ff36..a2c59dc84 100644 --- a/comfy/ldm/lightricks/vae/causal_video_autoencoder.py +++ b/comfy/ldm/lightricks/vae/causal_video_autoencoder.py @@ -1265,9 +1265,7 @@ class VideoVAE(nn.Module): return config def encode(self, x): - frames_count = x.shape[2] - if ((frames_count - 1) % 8) != 0: - raise ValueError("Invalid number of frames: Encode input must have 1 + 8 * x frames (e.g., 1, 9, 17, ...). Please check your input.") + x = x[:, :, :max(1, 1 + ((x.shape[2] - 1) // 8) * 8), :, :] means, logvar = torch.chunk(self.encoder(x), 2, dim=1) return self.per_channel_statistics.normalize(means)