From 8691b0d4f2e935791708503ea512b61f5c57fac8 Mon Sep 17 00:00:00 2001 From: "huangyitong.hyt" Date: Tue, 29 Jul 2025 12:54:11 +0800 Subject: [PATCH] fix the frame num calculation for i2v --- wan/image2video.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wan/image2video.py b/wan/image2video.py index 957aaeb..659564c 100644 --- a/wan/image2video.py +++ b/wan/image2video.py @@ -279,14 +279,14 @@ class WanI2V: seed_g.manual_seed(seed) noise = torch.randn( 16, - 21, + (F - 1) // self.vae_stride[0] + 1, lat_h, lat_w, dtype=torch.float32, generator=seed_g, device=self.device) - msk = torch.ones(1, 81, lat_h, lat_w, device=self.device) + msk = torch.ones(1, F, lat_h, lat_w, device=self.device) msk[:, 1:] = 0 msk = torch.concat([ torch.repeat_interleave(msk[:, 0:1], repeats=4, dim=1), msk[:, 1:] @@ -316,7 +316,7 @@ class WanI2V: torch.nn.functional.interpolate( img[None].cpu(), size=(h, w), mode='bicubic').transpose( 0, 1), - torch.zeros(3, 80, h, w) + torch.zeros(3, F - 1, h, w) ], dim=1).to(self.device) ])[0]