feat(diffusion): add Wan2.2 T2V-A14B two-stage finetuning support#2284
Open
linnanwang wants to merge 4 commits into
Open
feat(diffusion): add Wan2.2 T2V-A14B two-stage finetuning support#2284linnanwang wants to merge 4 commits into
linnanwang wants to merge 4 commits into
Conversation
Signed-off-by: linnan wang <linnanw@nvidia.com>
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?
Adds end-to-end finetuning and inference support for Wan2.2-T2V-A14B, a two-stage text-to-video diffusion model whose denoising pipeline routes between a high-noise
transformerand a low-noisetransformer_2across a configurable timestep boundary.Changelog
NeMoAutoDiffusionPipeline.from_pretrained: newactive_transformerkwarg ("transformer"|"transformer_2"); when set on a two-transformer pipeline the unused transformer is dropped before device placement / FSDP2 wrapping so only one ~14B model occupies GPU memory.TrainDiffusionRecipe(recipes/diffusion/train.py): readsmodel.stage(high_noise|low_noise) andmodel.boundary_ratio(falls back topipe.config.boundary_ratio); derivesflow_matching.sigma_min/sigma_maxfrom the stage + boundary so each stage only trains on its own noise range; threadsactive_transformerinto the pipeline loader; suffixes the wandb run name with the stage.examples/diffusion/finetune/wan2_2_t2v_flow.yaml: new finetune config — A14B hub path, stage knob,boundary_ratio: 0.875, bumpeddp_size, explicit activation checkpointing.examples/diffusion/generate/configs/generate_wan22.yaml: new inference config — A14B hub path, two optional checkpoint paths,guidance_scale_2, VAE cpu offload defaulted on.examples/diffusion/generate/generate.py:load_checkpoint_into_pipelineacceptsmodel.checkpoint_high_noise/model.checkpoint_low_noise(both optional, mutually exclusive with the legacy singlemodel.checkpoint) and loads each into the matchingpipe.transformer/pipe.transformer_2attribute.tools/diffusion/processors/wan.py: newWan22Processorsubclass registered aswan2.2; defaults toWan-AI/Wan2.2-T2V-A14B-Diffusers, marks cache files withmodel_version: "wan2.2"so Wan2.1 and Wan2.2 caches can coexist.tools/diffusion/preprocessing_multiprocess.py:wan2.2added to the--processorchoices.tools/diffusion/processors/__init__.py: exportWan22Processor.Before your PR is "Ready for review"
Pre checks:
If you haven't finished some of the above items you can still open "Draft" PR.
Additional Information
--processor wan2.2, run finetuning twice (model.stage: high_noiseandmodel.stage: low_noise) with distinctcheckpoint.checkpoint_dirper stage, then pointgenerate_wan22.yamlat the two resulting consolidated checkpoint dirs (either or both optional — missing stages fall back to hub-pretrained weights).