Commit ecb6f53
committed
fix(wan): apply patchify fix in consumers, keep signature
Per @xiuyuan18 review: the bug should be fixed in forward (and the
other tuple-unpacking consumers), not by changing patchify's return
signature. This matches the official Wan 2.1 implementation, which
also flattens x in forward, not in patchify.
Reverts patchify back to returning just `x` (post-Conv3d tensor shape
(B, dim, f, h, w)). Adds the flatten + (f, h, w) extraction at each
tuple-unpacking consumer:
- wan_video_dit.py: WanModel.forward
- xdit_context_parallel.py: usp_dit_forward
- wan_video.py: model_fn_wans2v (two sites: main x and ref_latents)
WanToDance callers in wan_video.py (lines 1412/1414) continue to work
unchanged because they always wanted the raw post-Conv3d tensor and
do their own flattening downstream.
Pre-existing S2V double-embedding pattern at model_fn_wans2v (caller
pre-runs patch_embedding, then patchify re-runs patch_embedding
internally) is preserved as-is — out of scope for this PR.
Refs #10631 parent 5d8a8bf commit ecb6f53
3 files changed
Lines changed: 15 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
498 | 498 | | |
499 | 499 | | |
500 | 500 | | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
| 501 | + | |
508 | 502 | | |
509 | 503 | | |
510 | 504 | | |
| |||
533 | 527 | | |
534 | 528 | | |
535 | 529 | | |
536 | | - | |
537 | | - | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
538 | 534 | | |
539 | 535 | | |
540 | 536 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1658 | 1658 | | |
1659 | 1659 | | |
1660 | 1660 | | |
1661 | | - | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
1662 | 1664 | | |
1663 | 1665 | | |
1664 | 1666 | | |
1665 | | - | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
1666 | 1670 | | |
1667 | 1671 | | |
1668 | 1672 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
| |||
0 commit comments