Force width, height, and num frames to always be the proper sizes for Wan 2.2 models

This commit is contained in:
Jaret Burkett
2025-08-25 10:33:28 -06:00
parent ea01a1c7d0
commit 119653c3f2

View File

@@ -73,6 +73,14 @@ class Wan22Pipeline(WanPipeline):
if isinstance(callback_on_step_end, (PipelineCallback, MultiPipelineCallbacks)):
callback_on_step_end_tensor_inputs = callback_on_step_end.tensor_inputs
if num_frames % self.vae_scale_factor_temporal != 1:
num_frames = num_frames // self.vae_scale_factor_temporal * self.vae_scale_factor_temporal + 1
num_frames = max(num_frames, 1)
width = width // (self.vae.config.scale_factor_spatial * 2) * (self.vae.config.scale_factor_spatial * 2)
height = height // (self.vae.config.scale_factor_spatial * 2) * (self.vae.config.scale_factor_spatial * 2)
# unload vae and transformer
vae_device = self.vae.device