Skip to content

fix: use variable frame_num instead of hardcoded 81 in FLF2V mask#583

Open
wishhyt wants to merge 1 commit intoWan-Video:mainfrom
wishhyt:fix/flf2v-hardcoded-frame-num
Open

fix: use variable frame_num instead of hardcoded 81 in FLF2V mask#583
wishhyt wants to merge 1 commit intoWan-Video:mainfrom
wishhyt:fix/flf2v-hardcoded-frame-num

Conversation

@wishhyt
Copy link
Copy Markdown

@wishhyt wishhyt commented Mar 18, 2026

Summary

The mask tensor in WanFLF2V.generate() (wan/first_last_frame2video.py, line 231) was hardcoded with 81 frames:

  • Before: msk = torch.ones(1, 81, lat_h, lat_w, device=self.device)
  • After: msk = torch.ones(1, F, lat_h, lat_w, device=self.device)

This causes a tensor dimension mismatch error when frame_num is set to any value other than 81.

The same bug was previously fixed in image2video.py via PR #533, but first_last_frame2video.py was missed.

Reproduction

Run FLF2V generation with --frame_num 41 (or any value != 81) → crash due to tensor shape mismatch.

Test plan

  • Verified that the fix matches the pattern used in image2video.py (line 210)
  • Run FLF2V generation with default frame_num=81 to confirm no regression
  • Run FLF2V generation with non-default frame_num (e.g., 41) to confirm fix

The mask tensor in WanFLF2V.generate() was hardcoded with 81 frames
instead of using the `F` (frame_num) variable. This causes a tensor
dimension mismatch when frame_num is changed from the default 81.

The same bug was previously fixed in image2video.py (PR Wan-Video#533) but
was missed in first_last_frame2video.py.

Made-with: Cursor
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