Optimize WAN pipelines: Reduce host overhead, hoist transposes, and fix Cache bugs#432
Open
Perseus14 wants to merge 1 commit into
Open
Optimize WAN pipelines: Reduce host overhead, hoist transposes, and fix Cache bugs#432Perseus14 wants to merge 1 commit into
Perseus14 wants to merge 1 commit into
Conversation
Perseus14
force-pushed
the
wan-cleanup
branch
6 times, most recently
from
June 29, 2026 12:25
da2175c to
c89f07c
Compare
ninatu
reviewed
Jul 1, 2026
Collaborator
not needed, since magcache is not implemented in wan animate and in wan-vace at the moment. But we it would be great to have magcache implemented in wan-vace as well! |
Perseus14
marked this pull request as ready for review
July 16, 2026 09:59
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR introduces several performance optimizations and bug fixes to the Wan 2.1 and 2.2 pipelines (both T2V and I2V), significantly reducing host overhead during the denoising loop and ensuring stability under data-parallel configurations.
Key Optimizations
conditiontensors outside of the main denoising loop in the I2V pipelines (wan_pipeline_i2v_2p1.py,wan_pipeline_i2v_2p2.py) to eliminate redundantjnp.transposeandjnp.concatenatechurn on every inference step.Bug Fixes & Cleanups
use_cfg_cacheifbatch_size % data_shards != 0. Previously,cfg_cacheevaluated only the unconditional branch (dropping the batch size to 1), which caused aValueErrorinulysses_attention'sshard_mapif the user configureddata_shards > 1.print()statements withmax_logging.log()across the pipelines for cleaner distributed logging.ruffandpyinkto clean up linter warnings and unused imports.