How wan-video/wan-animate-2 works
Wan-Animate-2 is a video character-animation inference system: the user supplies a reference image, driving video, and text prompt, then chooses base or distilled inference and receives generated video. The inference pipeline prepares conditioning, runs distributed diffusion with the animation transformer and video VAE, and decodes the result. The README also documents Gradio demos and Diffusers integration; those branches are represented at the supported directory level. Relationships below follow explicit README statements or the sampled pipeline imports and calls; unsampled subsystems are not connected speculatively.
Main entry points: wan_animate_2_pipeline.py Inference pipeline · wan_animate_2_demo.py CLI inference · eval_i2v.py I2V evaluation helpers · clip.py CLIP encoder
Components 23
Inference interfaces
- CLI inference
infer/wan_animate_2_demo.py - Gradio demos
infer - Diffusers integration
Animation inference
- Image, video, prompt
- Inference pipeline
pipelines/wan_animate_2_pipeline.py - Pipeline base
core/base_inference_pipeline.py - Generated video
Model components
- Animation transformer
wanxiang/models/wan_animate_2_model.py - Attention kernels
wanxiang/models/attention.py - Video VAE
wanxiang/models/vae.py - CLIP encoder
wanxiang/models/clip.py - T5 encoder
wanxiang/models/t5.py - XLM-R encoder
wanxiang/models/xlm_roberta.py - Flow solvers
wanxiang/utils/fm_solvers.py
Distributed execution
- FSDP sharding
wanxiang/distributed/fsdp.py - Distributed operations
wanxiang/ops/distributed.py
Conditioning and utilities
- I2V evaluation helpers
wanxiang/eval_i2v.py - Video preparation
pipelines/utils/human_video_omni_utils.py - Multi-clip handling
pipelines/utils/multiclip_utils.py - Tokenizers
wanxiang/utils/tokenizers.py - Tensor and video utilities
wanxiang/utils/utils.py
Other components
- User
- Torch distributed
Connections 28
- User → CLI inference: runs inference
README.md - User → Gradio demos: opens demo
README.md - User → Diffusers integration: calls pipeline
README.md - CLI inference → Image, video, prompt: provides inputs
README.md - CLI inference → Inference pipeline: builds pipeline
README.md - Gradio demos → Inference pipeline: uses inference
- Diffusers integration → Image, video, prompt: accepts inputs
README.md - Diffusers integration → Generated video: returns frames
README.md - Inference pipeline → Pipeline base: inherits from
pipelines/wan_animate_2_pipeline.py - Inference pipeline → Animation transformer: runs model
pipelines/wan_animate_2_pipeline.py - Inference pipeline → Video VAE: uses encoder
pipelines/wan_animate_2_pipeline.py - Inference pipeline → CLIP encoder: uses encoder
pipelines/wan_animate_2_pipeline.py - Inference pipeline → I2V evaluation helpers: uses helpers
pipelines/wan_animate_2_pipeline.py - Inference pipeline → Flow solvers: uses solver
pipelines/wan_animate_2_pipeline.py - Inference pipeline → FSDP sharding: uses sharding
pipelines/wan_animate_2_pipeline.py - Inference pipeline → Video preparation: uses preparation
pipelines/wan_animate_2_pipeline.py - Inference pipeline → Multi-clip handling: uses clips
pipelines/wan_animate_2_pipeline.py - Inference pipeline → Tensor and video utilities: uses utilities
pipelines/wan_animate_2_pipeline.py - Animation transformer → Attention kernels: calls kernels
wanxiang/models/wan_animate_2_model.py - CLIP encoder → Attention kernels: uses attention
wanxiang/models/clip.py - I2V evaluation helpers → CLIP encoder: constructs encoder
wanxiang/eval_i2v.py - I2V evaluation helpers → Tokenizers: uses tokenizer
wanxiang/eval_i2v.py - Inference pipeline → T5 encoder: initializes encoder
- Inference pipeline → XLM-R encoder: initializes encoder
- FSDP sharding → Torch distributed: shards across
wanxiang/distributed/fsdp.py - Distributed operations → Torch distributed: wraps collectives
wanxiang/ops/distributed.py - Inference pipeline → Distributed operations: uses collectives
pipelines/wan_animate_2_pipeline.py - Inference pipeline → Generated video: returns result
README.md