Shard video_condition to prevent OOM in WAN 2.2 I2V #313
Merged
Conversation
Collaborator
|
@prishajain1 can you do one run on multihost to ensure it works. Thanks! |
Collaborator
Author
|
entrpn
approved these changes
Jan 21, 2026
Perseus14
pushed a commit
that referenced
this pull request
Jan 22, 2026
* sharding before call to vae encoder * sharding before call to vae encoder * ruff check * pyink checks * pyink check
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.
This change is needed to resolve the OOM issues faced when running the WAN 2.2 I2V pipeline for 720px for higher batch sizes.
Files changed:
wan_pipeline.py: In prepare_latents_i2v_base, added an explicit JAX sharding constraint to the video_condition tensor before it is passed to the VAE encoder.Changes were made only to prepare_latents_i2v_base which is called only by I2V pipelines, hence tested the I2V pipelines.
Tested: