From c5a6d87db7e3600ae527d4064c36f78313cf9c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BE=8E=E9=B9=8F?= Date: Wed, 30 Apr 2025 14:44:10 +0800 Subject: [PATCH] fix frame size bug --- wan/first_last_frame2video.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wan/first_last_frame2video.py b/wan/first_last_frame2video.py index 4f300ca..1a1bb86 100644 --- a/wan/first_last_frame2video.py +++ b/wan/first_last_frame2video.py @@ -13,6 +13,7 @@ import numpy as np import torch import torch.cuda.amp as amp import torch.distributed as dist +import torchvision import torchvision.transforms.functional as TF from tqdm import tqdm @@ -206,7 +207,12 @@ class WanFLF2V: round(last_frame_size[1] * last_frame_resize_ratio), ] # 2. center crop - last_frame = TF.center_crop(last_frame, last_frame_size) + transform = torchvision.transforms.Compose([ + torchvision.transforms.Resize((last_frame_size[0], last_frame_size[1])), + torchvision.transforms.CenterCrop((first_frame_size[0], first_frame_size[1])) + ]) + + last_frame = transform(last_frame) max_seq_len = ((F - 1) // self.vae_stride[0] + 1) * lat_h * lat_w // ( self.patch_size[1] * self.patch_size[2])