From ed13fd9aed8f6bdc0a78ec126d679c0f729fda15 Mon Sep 17 00:00:00 2001 From: wunianze666-netizen Date: Thu, 13 Aug 2026 14:05:43 +0800 Subject: [PATCH] Log WanAnimate interpolation resizing as a warning --- .../pipelines/wan/pipeline_wan_animate.py | 2 +- tests/pipelines/wan/test_wan_animate.py | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/diffusers/pipelines/wan/pipeline_wan_animate.py b/src/diffusers/pipelines/wan/pipeline_wan_animate.py index 5806032c0142..a923219a7550 100644 --- a/src/diffusers/pipelines/wan/pipeline_wan_animate.py +++ b/src/diffusers/pipelines/wan/pipeline_wan_animate.py @@ -569,7 +569,7 @@ def prepare_prev_segment_cond_latents( latent_height = height // self.vae_scale_factor_spatial latent_width = width // self.vae_scale_factor_spatial if segment_height != height or segment_width != width: - print( + logger.warning( f"Interpolating prev segment cond video from ({segment_width}, {segment_height}) to ({width}, {height})" ) # Perform a 4D (spatial) rather than a 5D (spatiotemporal) reshape, following the original code diff --git a/tests/pipelines/wan/test_wan_animate.py b/tests/pipelines/wan/test_wan_animate.py index da46417629f5..a5c0d91c824a 100644 --- a/tests/pipelines/wan/test_wan_animate.py +++ b/tests/pipelines/wan/test_wan_animate.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import logging + import pytest import torch from PIL import Image @@ -178,6 +180,28 @@ def test_inference_replacement(self): video = pipe(**inputs).frames[0] assert video.shape == self.output_shape + def test_prepare_prev_segment_cond_latents_logs_interpolation_warning(self, caplog): + pipe = self.get_pipeline() + prev_segment_cond_video = torch.zeros((1, 3, 1, 8, 8), dtype=torch.float32) + + with caplog.at_level(logging.WARNING, logger="diffusers.pipelines.wan.pipeline_wan_animate"): + pipe.prepare_prev_segment_cond_latents( + prev_segment_cond_video=prev_segment_cond_video, + batch_size=1, + segment_frame_length=5, + height=16, + width=16, + prev_segment_cond_frames=1, + task="animate", + dtype=torch.float32, + device=torch.device("cpu"), + ) + + assert any( + "Interpolating prev segment cond video from (8, 8) to (16, 16)" in record.message + for record in caplog.records + ) + @pytest.mark.skip( reason="Setting the Wan Animate latents to zero at the last denoising step does not guarantee that the output" " will be zero. I believe this is because the latents are further processed in the outer loop where we loop"