Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/diffusers/pipelines/wan/pipeline_wan_animate.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand Down
24 changes: 24 additions & 0 deletions tests/pipelines/wan/test_wan_animate.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -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
Expand DownExpand Up@@ -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"
Expand Down
Loading