Skip to content

Conversation

@MackinationsAi
Copy link

Fixed a tensor reshaping error in WanVideoAnimateEmbeds that occurred when processing videos w/ frame counts not divisible by 4. The fix trims excess frames (max 3) to ensure proper alignment w/ the 4-frame latent processing pipeline.

Issue

WanVideoAnimateEmbeds fails w/ RuntimeError: shape '[1, X, 4, H, W]' is invalid for input of size Y when processing videos where the frame count is not divisible by 4 b/c some videos can have arbitrary frame counts (e.g., 77, 83, 165 frames).

Fix

Added frame alignment check before reshaping:

  • Calculates the largest frame count divisible by 4
  • Trims excess frames w/ minimal data loss (≤3 frames regardless of video length)
  • Logs the operation for transparency
  • Ensures tensor reshaping occurs & prevents crashes for videos with non-aligned frame counts
  • Maintains backward compatibility for properly aligned videos

Fixed a tensor reshaping error in WanVideoAnimateEmbeds that occurrs when processing videos with frame counts not divisible by 4. The fix trims excess frames (max 3) to ensure proper alignment with the 4-frame latent processing pipeline.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant