ADd wan2 modular video to video - #14720
Open
lucasruan1618 wants to merge 3 commits into
Open
Conversation
# Conflicts: # src/diffusers/modular_pipelines/modular_pipeline.py # src/diffusers/modular_pipelines/wan/__init__.py # src/diffusers/modular_pipelines/wan/encoders.py
Contributor
|
Hi @lucasruan1618, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. Please note that PRs without a linked issue are likely to be automatically closed 10 days after this notice. Once the PR links an issue (or gets the |
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.
What does this PR do?
This PR adds video-to-video support for Wan2.1 through the Diffusers modular pipeline.
The new
WanVideoToVideoBlocksworkflow:strength;The implementation supports both official Wan2.1 T2V checkpoints:
Wan-AI/Wan2.1-T2V-1.3B-DiffusersWan-AI/Wan2.1-T2V-14B-DiffusersWan2.1 I2V checkpoints are not compatible because their transformers use a different image-conditioning input interface.
Example
For lower-memory GPUs, replace
pipe.to("cuda")withpipe.enable_model_cpu_offload().Testing
WanVideoToVideoPipeline.Wan-AI/Wan2.1-T2V-14B-Diffusersat 480x720 on a 48 GB RTX 6000 Ada GPU.Self-review
Verdict: READY
Resolved blocking issues
WanVideoVaeEncoderStepnow forwards the pipeline generator toencode_vae_image, preserving per-sample VAE encoding when a generator list is supplied. The intermediatevideo_latentsare now identical between single and batched execution. The test uses the existing Wan-specific2e-3tolerance for small CUDA differences introduced by later model and decoder operations. (src/diffusers/modular_pipelines/wan/encoders.py:621)src/diffusers/modular_pipelines/wan/encoders.py:604)Non-blocking issues
latentsAPI. The assembled pipeline advertises optionallatents, butvideoandvideo_latentsremain required. A latent-only call fails withRequired input 'video' is missing, while passing both performs an unnecessary VAE encode before ignoringvideo_latents. Confirm the intended modular API with the reviewer. (src/diffusers/modular_pipelines/wan/before_denoise.py:645)WanVideoToVideoBlocksandWanVideoToVideoModularPipelineAPIs without a corresponding usage page or example underdocs/orexamples/. Per.ai/review-rules.md, new public behavior should update usage documentation._wan_v2v_map_fnalways returns one class and can use_create_default_map_fn("WanVideoToVideoModularPipeline"), as prescribed for checkpoint variants in.ai/modular.md. (src/diffusers/modular_pipelines/modular_pipeline.py:110)Dead-code analysis
wan/encoders.py:WanVideoVaeEncoderStepWanVideoToVideoBlocks; producesvideo_latents.wan/before_denoise.py: video-to-video timestep and latent stepsWanVideoToVideoCoreDenoiseStep; their outputs feed the Wan denoising loop.wan/modular_blocks_wan_v2v.py: blocksetsWanVideoToVideoModularPipeline.modular_pipeline.py:_wan_v2v_map_fnMODULAR_PIPELINE_MAPPING; the standard constant mapping helper can replace it.No likely-dead inference path was found. This PR adds pipeline blocks rather than a new model, so there is no new model
forwardpath to trace.Validation performed
pytest tests/modular_pipelines/wan/test_modular_pipeline_wan.py -k VideoToVideo -q: 22 passed, 1 skipped.utils/check_forward_call_docstrings.py: passed.utils/modular_auto_docstring.pyon the new blockset: up to date.git diff --check: passed.Fix before submitting: none. Leave for the actual review: agree on latent-only behavior and documentation scope.
Before submitting
self-reviewskill on the diff?Who can review?