ofirab commited on
Commit
bee9822
·
verified ·
1 Parent(s): 498a6cb

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +91 -0
  2. .gitignore +74 -0
  3. .vscode/launch.json +435 -0
  4. .vscode/settings.json +4 -0
  5. OUTPUTS/i2v-A14B_832*480_8_A_flock_of_birds_flies_gracefully_across_the_sky_a_20260614_161600.mp4 +3 -0
  6. OUTPUTS/i2v-A14B_832*480_8_A_flock_of_birds_flies_gracefully_across_the_sky_a_20260614_161734.mp4 +3 -0
  7. OUTPUTS/i2v-A14B_832*480_8_A_flock_of_birds_flies_gracefully_across_the_sky_a_20260614_161909.mp4 +3 -0
  8. OUTPUTS/i2v-A14B_832*480_8_A_flock_of_birds_flies_gracefully_across_the_sky_a_20260614_162043.mp4 +3 -0
  9. OUTPUTS/i2v-A14B_832*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_164913.mp4 +3 -0
  10. OUTPUTS/i2v-A14B_832*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_165047.mp4 +3 -0
  11. OUTPUTS/i2v-A14B_832*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_165221.mp4 +3 -0
  12. OUTPUTS/i2v-A14B_832*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_165355.mp4 +3 -0
  13. OUTPUTS/i2v-A14B_832*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_165956.mp4 +3 -0
  14. OUTPUTS/i2v-A14B_832*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_170130.mp4 +3 -0
  15. OUTPUTS/i2v-A14B_832*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_170304.mp4 +3 -0
  16. OUTPUTS/i2v-A14B_832*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_170438.mp4 +3 -0
  17. OUTPUTS/t2v-A14B_832*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260612_144341.mp4 +3 -0
  18. OUTPUTS/t2v-A14B_832*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260612_144942.mp4 +3 -0
  19. OUTPUTS/t2v-A14B_832*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260614_152023.mp4 +3 -0
  20. OUTPUTS/t2v-A14B_832*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260614_152155.mp4 +3 -0
  21. OUTPUTS/t2v-A14B_832*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260614_152327.mp4 +3 -0
  22. OUTPUTS/t2v-A14B_832*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260614_152459.mp4 +3 -0
  23. OUTPUTS/t2v-A14B_832*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260614_152631.mp4 +3 -0
  24. README.md +135 -3
  25. Wan2.2_phi-noise/.gitignore +7 -0
  26. Wan2.2_phi-noise/INSTALL.md +55 -0
  27. Wan2.2_phi-noise/LICENSE.txt +201 -0
  28. Wan2.2_phi-noise/Makefile +5 -0
  29. Wan2.2_phi-noise/README.md +507 -0
  30. Wan2.2_phi-noise/assets/comp_effic.png +3 -0
  31. Wan2.2_phi-noise/assets/logo.png +0 -0
  32. Wan2.2_phi-noise/assets/moe_2.png +3 -0
  33. Wan2.2_phi-noise/assets/moe_arch.png +0 -0
  34. Wan2.2_phi-noise/assets/performance.png +3 -0
  35. Wan2.2_phi-noise/assets/vae.png +3 -0
  36. Wan2.2_phi-noise/examples/Five Hundred Miles.MP3 +3 -0
  37. Wan2.2_phi-noise/examples/Five Hundred Miles.png +3 -0
  38. Wan2.2_phi-noise/examples/i2v_input.JPG +3 -0
  39. Wan2.2_phi-noise/examples/pose.mp4 +3 -0
  40. Wan2.2_phi-noise/examples/pose.png +3 -0
  41. Wan2.2_phi-noise/examples/sing.MP3 +3 -0
  42. Wan2.2_phi-noise/examples/talk.wav +3 -0
  43. Wan2.2_phi-noise/examples/wan_animate/animate/image.jpeg +3 -0
  44. Wan2.2_phi-noise/examples/wan_animate/animate/video.mp4 +3 -0
  45. Wan2.2_phi-noise/examples/wan_animate/replace/image.jpeg +3 -0
  46. Wan2.2_phi-noise/examples/wan_animate/replace/video.mp4 +3 -0
  47. Wan2.2_phi-noise/examples/zero_shot_prompt.wav +3 -0
  48. Wan2.2_phi-noise/generate.py +728 -0
  49. Wan2.2_phi-noise/pyproject.toml +66 -0
  50. Wan2.2_phi-noise/requirements.txt +16 -0
.gitattributes CHANGED
@@ -33,3 +33,94 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ OUTPUTS/i2v-A14B_832\*480_8_A_flock_of_birds_flies_gracefully_across_the_sky_a_20260614_161600.mp4 filter=lfs diff=lfs merge=lfs -text
37
+ OUTPUTS/i2v-A14B_832\*480_8_A_flock_of_birds_flies_gracefully_across_the_sky_a_20260614_161734.mp4 filter=lfs diff=lfs merge=lfs -text
38
+ OUTPUTS/i2v-A14B_832\*480_8_A_flock_of_birds_flies_gracefully_across_the_sky_a_20260614_161909.mp4 filter=lfs diff=lfs merge=lfs -text
39
+ OUTPUTS/i2v-A14B_832\*480_8_A_flock_of_birds_flies_gracefully_across_the_sky_a_20260614_162043.mp4 filter=lfs diff=lfs merge=lfs -text
40
+ OUTPUTS/i2v-A14B_832\*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_164913.mp4 filter=lfs diff=lfs merge=lfs -text
41
+ OUTPUTS/i2v-A14B_832\*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_165047.mp4 filter=lfs diff=lfs merge=lfs -text
42
+ OUTPUTS/i2v-A14B_832\*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_165221.mp4 filter=lfs diff=lfs merge=lfs -text
43
+ OUTPUTS/i2v-A14B_832\*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_165355.mp4 filter=lfs diff=lfs merge=lfs -text
44
+ OUTPUTS/i2v-A14B_832\*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_165956.mp4 filter=lfs diff=lfs merge=lfs -text
45
+ OUTPUTS/i2v-A14B_832\*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_170130.mp4 filter=lfs diff=lfs merge=lfs -text
46
+ OUTPUTS/i2v-A14B_832\*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_170304.mp4 filter=lfs diff=lfs merge=lfs -text
47
+ OUTPUTS/i2v-A14B_832\*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_170438.mp4 filter=lfs diff=lfs merge=lfs -text
48
+ OUTPUTS/t2v-A14B_832\*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260612_144341.mp4 filter=lfs diff=lfs merge=lfs -text
49
+ OUTPUTS/t2v-A14B_832\*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260612_144942.mp4 filter=lfs diff=lfs merge=lfs -text
50
+ OUTPUTS/t2v-A14B_832\*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260614_152023.mp4 filter=lfs diff=lfs merge=lfs -text
51
+ OUTPUTS/t2v-A14B_832\*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260614_152155.mp4 filter=lfs diff=lfs merge=lfs -text
52
+ OUTPUTS/t2v-A14B_832\*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260614_152327.mp4 filter=lfs diff=lfs merge=lfs -text
53
+ OUTPUTS/t2v-A14B_832\*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260614_152459.mp4 filter=lfs diff=lfs merge=lfs -text
54
+ OUTPUTS/t2v-A14B_832\*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260614_152631.mp4 filter=lfs diff=lfs merge=lfs -text
55
+ Wan2.2_phi-noise/assets/comp_effic.png filter=lfs diff=lfs merge=lfs -text
56
+ Wan2.2_phi-noise/assets/moe_2.png filter=lfs diff=lfs merge=lfs -text
57
+ Wan2.2_phi-noise/assets/performance.png filter=lfs diff=lfs merge=lfs -text
58
+ Wan2.2_phi-noise/assets/vae.png filter=lfs diff=lfs merge=lfs -text
59
+ Wan2.2_phi-noise/examples/Five[[:space:]]Hundred[[:space:]]Miles.MP3 filter=lfs diff=lfs merge=lfs -text
60
+ Wan2.2_phi-noise/examples/Five[[:space:]]Hundred[[:space:]]Miles.png filter=lfs diff=lfs merge=lfs -text
61
+ Wan2.2_phi-noise/examples/i2v_input.JPG filter=lfs diff=lfs merge=lfs -text
62
+ Wan2.2_phi-noise/examples/pose.mp4 filter=lfs diff=lfs merge=lfs -text
63
+ Wan2.2_phi-noise/examples/pose.png filter=lfs diff=lfs merge=lfs -text
64
+ Wan2.2_phi-noise/examples/sing.MP3 filter=lfs diff=lfs merge=lfs -text
65
+ Wan2.2_phi-noise/examples/talk.wav filter=lfs diff=lfs merge=lfs -text
66
+ Wan2.2_phi-noise/examples/wan_animate/animate/image.jpeg filter=lfs diff=lfs merge=lfs -text
67
+ Wan2.2_phi-noise/examples/wan_animate/animate/video.mp4 filter=lfs diff=lfs merge=lfs -text
68
+ Wan2.2_phi-noise/examples/wan_animate/replace/image.jpeg filter=lfs diff=lfs merge=lfs -text
69
+ Wan2.2_phi-noise/examples/wan_animate/replace/video.mp4 filter=lfs diff=lfs merge=lfs -text
70
+ Wan2.2_phi-noise/examples/zero_shot_prompt.wav filter=lfs diff=lfs merge=lfs -text
71
+ docs/static/analysis.png filter=lfs diff=lfs merge=lfs -text
72
+ docs/static/icons/huggingface.png filter=lfs diff=lfs merge=lfs -text
73
+ docs/static/logos/lab_logo.png filter=lfs diff=lfs merge=lfs -text
74
+ docs/static/media/comparisons/cut_n_drag/birds/matched_gwtf_Birds.webm filter=lfs diff=lfs merge=lfs -text
75
+ docs/static/media/comparisons/cut_n_drag/birds/matched_original_Birds.webm filter=lfs diff=lfs merge=lfs -text
76
+ docs/static/media/comparisons/cut_n_drag/birds/matched_ours_Birds.webm filter=lfs diff=lfs merge=lfs -text
77
+ docs/static/media/comparisons/cut_n_drag/birds/matched_ttm_Birds.webm filter=lfs diff=lfs merge=lfs -text
78
+ docs/static/media/comparisons/cut_n_drag/birds/matched_wan_Birds.webm filter=lfs diff=lfs merge=lfs -text
79
+ docs/static/media/comparisons/cut_n_drag/humburger/matched_gwtf_Hamburger.webm filter=lfs diff=lfs merge=lfs -text
80
+ docs/static/media/comparisons/cut_n_drag/humburger/matched_ours_Hamburger.webm filter=lfs diff=lfs merge=lfs -text
81
+ docs/static/media/comparisons/cut_n_drag/humburger/matched_ttm_Hamburger.webm filter=lfs diff=lfs merge=lfs -text
82
+ docs/static/media/comparisons/cut_n_drag/monkey/matched_gwtf_Monkey.webm filter=lfs diff=lfs merge=lfs -text
83
+ docs/static/media/comparisons/cut_n_drag/monkey/matched_original_Monkey.webm filter=lfs diff=lfs merge=lfs -text
84
+ docs/static/media/comparisons/cut_n_drag/monkey/matched_ours_Monkey.webm filter=lfs diff=lfs merge=lfs -text
85
+ docs/static/media/comparisons/cut_n_drag/monkey/matched_ttm_Monkey.webm filter=lfs diff=lfs merge=lfs -text
86
+ docs/static/media/comparisons/i2v_motion_transfer/backflip/matched_mc_backflip.webm filter=lfs diff=lfs merge=lfs -text
87
+ docs/static/media/comparisons/i2v_motion_transfer/backflip/matched_ours_backflip.webm filter=lfs diff=lfs merge=lfs -text
88
+ docs/static/media/comparisons/i2v_motion_transfer/backflip/matched_wan_backflip.webm filter=lfs diff=lfs merge=lfs -text
89
+ docs/static/media/comparisons/i2v_motion_transfer/fish/matched_mc_Fish.webm filter=lfs diff=lfs merge=lfs -text
90
+ docs/static/media/comparisons/i2v_motion_transfer/fish/matched_ours_Fish.webm filter=lfs diff=lfs merge=lfs -text
91
+ docs/static/media/comparisons/i2v_motion_transfer/fish/matched_source_svd_Fish.webm filter=lfs diff=lfs merge=lfs -text
92
+ docs/static/media/comparisons/i2v_motion_transfer/fish/matched_wan_Fish.webm filter=lfs diff=lfs merge=lfs -text
93
+ docs/static/media/comparisons/i2v_motion_transfer/fly/matched_mc.webm filter=lfs diff=lfs merge=lfs -text
94
+ docs/static/media/comparisons/i2v_motion_transfer/fly/matched_original.webm filter=lfs diff=lfs merge=lfs -text
95
+ docs/static/media/comparisons/i2v_motion_transfer/fly/matched_ours.webm filter=lfs diff=lfs merge=lfs -text
96
+ docs/static/media/comparisons/i2v_motion_transfer/fly/matched_wan.webm filter=lfs diff=lfs merge=lfs -text
97
+ docs/static/media/comparisons/i2v_motion_transfer/labubu/matched_aa_ours_labubu.webm filter=lfs diff=lfs merge=lfs -text
98
+ docs/static/media/comparisons/i2v_motion_transfer/labubu/matched_mc_labubu.webm filter=lfs diff=lfs merge=lfs -text
99
+ docs/static/media/comparisons/i2v_motion_transfer/labubu/matched_original_labubu.webm filter=lfs diff=lfs merge=lfs -text
100
+ docs/static/media/comparisons/i2v_motion_transfer/labubu/matched_wan_labubu.webm filter=lfs diff=lfs merge=lfs -text
101
+ docs/static/media/comparisons/motion_transfer/car/matched_ditflow.webm filter=lfs diff=lfs merge=lfs -text
102
+ docs/static/media/comparisons/motion_transfer/car/matched_dtm.webm filter=lfs diff=lfs merge=lfs -text
103
+ docs/static/media/comparisons/motion_transfer/car/matched_original.webm filter=lfs diff=lfs merge=lfs -text
104
+ docs/static/media/comparisons/motion_transfer/car/matched_ours.webm filter=lfs diff=lfs merge=lfs -text
105
+ docs/static/media/comparisons/motion_transfer/climbing/matched_ditflow.webm filter=lfs diff=lfs merge=lfs -text
106
+ docs/static/media/comparisons/motion_transfer/climbing/matched_dtm.webm filter=lfs diff=lfs merge=lfs -text
107
+ docs/static/media/comparisons/motion_transfer/climbing/matched_original.webm filter=lfs diff=lfs merge=lfs -text
108
+ docs/static/media/comparisons/motion_transfer/climbing/matched_ours.webm filter=lfs diff=lfs merge=lfs -text
109
+ docs/static/media/comparisons/motion_transfer/dog_jump/matched_ditflow_dog_jump.webm filter=lfs diff=lfs merge=lfs -text
110
+ docs/static/media/comparisons/motion_transfer/dog_jump/matched_dmt_dog_jump.webm filter=lfs diff=lfs merge=lfs -text
111
+ docs/static/media/comparisons/motion_transfer/dog_jump/matched_original_dog_jump.webm filter=lfs diff=lfs merge=lfs -text
112
+ docs/static/media/comparisons/motion_transfer/dog_jump/matched_ours_dog_jump.webm filter=lfs diff=lfs merge=lfs -text
113
+ docs/static/media/comparisons/motion_transfer/fish/matched_mc_fish.webm filter=lfs diff=lfs merge=lfs -text
114
+ docs/static/media/comparisons/motion_transfer/fish/matched_ours_Fish.webm filter=lfs diff=lfs merge=lfs -text
115
+ docs/static/media/comparisons/motion_transfer/fish/matched_source_svd_Fish.webm filter=lfs diff=lfs merge=lfs -text
116
+ docs/static/media/comparisons/motion_transfer/fish/matched_wan_Fish.webm filter=lfs diff=lfs merge=lfs -text
117
+ docs/static/media/phi_noise_vid.mp4 filter=lfs diff=lfs merge=lfs -text
118
+ docs/static/media/results/cnd.gif filter=lfs diff=lfs merge=lfs -text
119
+ docs/static/media/results/i2v.gif filter=lfs diff=lfs merge=lfs -text
120
+ docs/static/media/results/t2v.gif filter=lfs diff=lfs merge=lfs -text
121
+ docs/static/media/teaser.gif filter=lfs diff=lfs merge=lfs -text
122
+ docs/static/method_v1.png filter=lfs diff=lfs merge=lfs -text
123
+ docs/static/teaser_gif.gif filter=lfs diff=lfs merge=lfs -text
124
+ guidance_exmaples/cut_n_drag/birds.mp4 filter=lfs diff=lfs merge=lfs -text
125
+ guidance_exmaples/mt-it2m/woman_turning.mp4 filter=lfs diff=lfs merge=lfs -text
126
+ guidance_exmaples/mt-t2m/duck.mp4 filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # macOS
2
+ .DS_Store
3
+ .AppleDouble
4
+ .LSOverride
5
+
6
+ # Thumbnails
7
+ Thumbs.db
8
+
9
+ # Node
10
+ node_modules/
11
+ npm-debug.log*
12
+ yarn-debug.log*
13
+ yarn-error.log*
14
+ package-lock.json
15
+
16
+ # Logs
17
+ logs
18
+ *.log
19
+
20
+ # Build / output
21
+ dist/
22
+ build/
23
+ coverage/
24
+
25
+ # Python
26
+ __pycache__/
27
+ *.py[cod]
28
+ *.egg-info/
29
+ venv/
30
+ .env
31
+ .env.*.local
32
+
33
+ # IDEs and editors
34
+ .vscode/
35
+ .idea/
36
+ *.sublime-workspace
37
+ *.sublime-project
38
+
39
+ # Project artifacts
40
+ /.history/
41
+ .cache/
42
+ .sass-cache/
43
+
44
+ # Generated media / results
45
+ assets
46
+ # /results/
47
+
48
+ # Misc
49
+ *.tmp
50
+ *.temp
51
+ *.bak
52
+ *.swp
53
+
54
+ # System files
55
+ Thumbs.db
56
+ .DS_Store
57
+
58
+ # Ignore local git config
59
+ .gitconfig.local
60
+
61
+ # Ignore application secrets
62
+ secrets.yml
63
+
64
+ # Ignore uploaded large files
65
+ docs/**/*.mp4
66
+ docs/**/*.mov
67
+ docs/**/*.avi
68
+ docs/**/*.mkv
69
+
70
+ # exclude:
71
+ !docs/static/media/phi_noise_vid.mp4
72
+
73
+ OUTPUTS/
74
+ guidance_exmaples/**/preprocessed*
.vscode/launch.json ADDED
@@ -0,0 +1,435 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "name": "14b_fast_generate-i2v",
9
+ "type": "debugpy",
10
+ "request": "launch",
11
+ "module": "torch.distributed.run",
12
+ "console": "integratedTerminal",
13
+ "args": [
14
+ "--nproc_per_node", "8",
15
+ "--master_port", "29501",
16
+ "Wan2.2_phi-noise/generate.py",
17
+ "--ulysses_size", "8",
18
+ "--task", "i2v-A14B",
19
+ // "--size", "1280*720",
20
+ "--size", "832*480",
21
+ "--sample_steps", "20",
22
+ "--ckpt_dir", "/data/weights/wan/Wan2.2-I2V-A14B",
23
+ "--offload_model", "False",
24
+ "--convert_model_dtype",
25
+ "--dit_fsdp",
26
+
27
+ // "--frame_num", "53",
28
+ "--image",
29
+ // "guidance_exmaples/cut_n_drag/preprocessed_14B-low_81f_birds_ff.png",
30
+ "guidance_exmaples/mt-it2m/cat_in_nature.jpg",
31
+ //"guidance_exmaples/i2v-mt/patrick.png",
32
+ // "guidance_exmaples/ttm/cutdrag_wan_Owl/preprocessed_14B-low_motion_signal_81f_ff.png",
33
+ // "guidance_exmaples/i2v-mt/self_backflip.jpeg",
34
+ //"guidance_exmaples/i2v-mt/self_sitting.jpg",
35
+ // "guidance_exmaples/i2v-mt/canvas.png",
36
+ // "guidance_exmaples/metronome.mp4",
37
+ // "guidance_exmaples/ttm/charizard/preprocessed_14B-low_charizard_81f_ff.png",
38
+ // "/dev/shm/loveu-tgve-2023/ttm/480p_frames/cutdrag_wan_Surfing/cutdrag_wan_Surfing_first_frame.jpg",
39
+ // "guidance_exmaples/preprocessed_14B-low_octupus1_81f_ff.png",
40
+ // "guidance_exmaples/ttm/surfing/preprocessed_14B-low_81f_cutdrag_wan_Surfing_ff.png",
41
+ // "guidance_exmaples/beach_snail.png",
42
+ // "guidance_exmaples/i2v-mt/heli_forest.png",
43
+ // "guidance_exmaples/i2v-mt/person_from_back.png",
44
+ // "guidance_exmaples/i2v-mt/rock.png",
45
+ "--prompt",
46
+ // "A flock of birds flies gracefully across the sky above a natural landscape.",
47
+ "The cat is turning its head towards the camera and after a second starts waving hello its right paw. Camera is fixed and static. Fixed Background.",
48
+
49
+ "--pn_ref_path",
50
+ "guidance_exmaples/mt-it2m/preprocessed_14B-low_81f_woman_turning.mp4",
51
+ // "guidance_exmaples/ttm/cutdrag_wan_Owl/preprocessed_14B-low_81f_motion_signal_intrp.mp4",
52
+ // "guidance_exmaples/i2v-mt/preprocessed_14B-low_81f_backflip_x_self_backflip._diff.mp4",
53
+ // "guidance_exmaples/i2v-mt/preprocessed_14B-low_81f_backflip.mp4",
54
+ // "guidance_exmaples/i2v-mt/preprocessed_14B-low_81f_bird_flying_x_self_sitting_diff.mp4",
55
+ // "guidance_exmaples/i2v-mt/preprocessed_14B-low_81f_bird_flying_m_x_canvas_diff.mp4",
56
+ // "guidance_exmaples/ttm/charizard/preprocessed_14B-low_charizard_81f.mp4",
57
+ // "/dev/shm/loveu-tgve-2023/ttm/preprocess_videos_14B/cutdrag_wan_Surfing.mp4",
58
+ // "guidance_exmaples/preprocessed_14B-low_octupus1_81f.mp4",
59
+ // "guidance_exmaples/preprocessed_14B-low_81f_rabbit_walking.mp4","
60
+ // "guidance_exmaples/i2v-mt/preprocessed_14B-low_81f_ski-follow.mp4",
61
+ // "guidance_exmaples/i2v-mt/preprocessed_14B-low_81f_women_cam.mp4",
62
+ // "guidance_exmaples/i2v-mt/preprocessed_14B-low_81f_car_x_rock_diff.mp4",
63
+ // "guidance_exmaples/preprocessed_14B-low_81f_duck.mp4",
64
+ // "guidance_exmaples/ttm/cutdrag_wan_Jumping/preprocessed_14B-low_81f_motion_signal.mp4",
65
+
66
+ // "--fm_gamma_t", "30#30#30#30",
67
+ // "--fm_gamma_t", "5#10#15#20",
68
+ "--pn_task", "i2v_mt", // "cnd", // "i2v_mt"
69
+ "--pn_gamma", "30",
70
+ // "--fm_alpha_t", "5#6#7#8",
71
+ // "--fm_alpha_t", "0#1#2#3#4#5#6#7#8",
72
+ // "--fm_alpha_t", "4#4#4#4#4#4#4#4",
73
+ "--pn_alpha", "2#3#2#3",
74
+ ],
75
+ "env": {"CUDA_VISIBLE_DEVICES": "0,1,2,3,4,5,6,7",
76
+ "PYTHONPATH": "/dev/shm/ofir/phi-noise:/dev/shm/ofir/phi-noise/Wan2.2_phi-noise"
77
+ }
78
+ },
79
+ {
80
+ "name": "5b_fast_generate-ti2v",
81
+ "type": "debugpy",
82
+ "request": "launch",
83
+ "module": "torch.distributed.run",
84
+ "subProcess": true,
85
+ "justMyCode": false,
86
+ "console": "integratedTerminal",
87
+ "args": [
88
+ "--standalone",
89
+ "--nproc_per_node", "4",
90
+ "generate.py",
91
+ "--ulysses_size", "4",
92
+ "--task", "ti2v-5B",
93
+ "--size", "1280*704",
94
+ "--sample_steps", "20",
95
+ // "--ckpt_dir", "/dev/shm/Wan2.2-TI2V-5B",
96
+ "--ckpt_dir", "/dev/shm/Wan2.2-TI2V-5B",
97
+ "--offload_model", "False",
98
+ "--convert_model_dtype",
99
+ "--dit_fsdp",
100
+ "--sample_solver", "unipc",
101
+ // "--image", "guidance_exmaples/ttm/kid_jumping/first_frame.png",
102
+ // "--image", "guidance_exmaples/ttm/cutdrag_wan_Owl/first_frame.png",
103
+ // "--image", "guidance_exmaples/ttm/cutdrag_wan_Rhino/first_frame.png",
104
+ // "--image", "guidance_exmaples/i2v-mt/puppy.png",
105
+ // "--image", "guidance_exmaples/i2v-mt/black_bird.png",
106
+ // "--image", "guidance_exmaples/i2v-mt/self_standing.png",
107
+ // "--image", "guidance_exmaples/i2v-mt/cat_in_nature.jpg",
108
+ // "--image", "guidance_exmaples/i2v-mt/patrick.png",
109
+ // "--image", "guidance_exmaples/ttm/cutdrag_wan_Owl/first_frame.png",
110
+ // "--image", "guidance_exmaples/ttm/labubu/preprocessed_5B_labubu_121f_ff.png",
111
+
112
+ // "--prompt", "a cat is walking in the garden.",
113
+ // "--prompt", "a rabbit is bouncing up and down outside.",
114
+ // "--prompt", "a bowling ball is rolling down the lane.",
115
+ // "--prompt", "a dear is crossing the road walking. camera is fixed, static, and not moving.",
116
+ // "--prompt", "a peacock is walking. camera is fixed and static.",
117
+ // "--prompt", "a dinosaur is walking.",
118
+
119
+ // "--prompt", "A kid is climing on the block.",
120
+ // "--prompt", "From the vibrant chaos of the neon-lit bar, a single spotlight finds its focus, illuminating a cocktail glass holding glistening ice and clear liquor. A thick, deep crimson cherry syrup begins to cascade from above the camera view in a stream, its rich color cutting through the light. As it descends, the syrup weaves a liquid trail through the ice, bleeding into the clear liquid to create a mesmerizing swirl of ruby red. The once-separate elements of ice, alcohol, and syrup dance and mingle, each drop transforming the drink until it becomes a singular, brilliant red jewel. The process is a silent spectacle, a concentrated moment of creation that stands out against the backdrop of the bustling, vibrant night, culminating in a beautiful and vivid cocktail ready to be enjoyed.",
121
+
122
+ // "--prompt", "The person stands still for a moment, then jumps.",
123
+ "--prompt", "The kid is climbing the rhino.",
124
+ // "--prompt", "The scene opens on a breathtaking savanna, bathed in the fiery hues of a twilight sky, where a small boy stands in silent awe next to an enormous rhino. With an electric burst of energy, the boy's face breaks into a wide grin, and he launches himself into a single, impossible leap, a blur of motion against the dramatic landscape. For a fleeting moment, he hangs in the air, a tiny, determined silhouette before landing with a soft thud on the rhino's massive back. There is no fear, only pure, unadulterated joy as a triumphant whoop escapes his lips, echoing across the plains. He settles comfortably on his new perch, his small hands holding on to the bristly hide, a perfect picture of thrilled connection. The rhino continues to stand in its quiet dignity, seemingly unfazed, as the boy's infectious laughter rings out, a perfect harmony with the fading light of the African twilight.",
125
+ // "--prompt", "The scene opens on a breathtaking savanna, bathed in the fiery hues of a twilight sky, where a small boy stands in silent awe next to an enormous rhino. With an electric burst of energy, the boy's face breaks into a wide grin, and he launches himself into a single, impossible leap, a blur of motion against the dramatic landscape. For a fleeting moment, he hangs in the air, a tiny, determined silhouette before landing with a soft thud on the rhino's massive back. There is no fear, only pure, unadulterated joy as a triumphant whoop escapes his lips, echoing across the plains. He settles comfortably on his new perch, his small hands holding on to the bristly hide, a perfect picture of thrilled connection. The rhino continues to stand in its quiet dignity, seemingly unfazed, as the boy's infectious laughter rings out, a perfect harmony with the fading light of the African twilight.",
126
+ // "--prompt", "Cinematic wide shot steady camera. The marble statue is jumping into the lake.",
127
+ // "--prompt", "A majestic snowy owl perches gracefully on a gnarled branch, its pristine white feathers adorned with delicate black speckles. The owl's piercing yellow eyes are wide and alert, scanning the surroundings with a sense of calm authority. As a gentle breeze rustles through the leaves, the owl remains poised, its sharp talons gripping the branch securely. The dark, blurred background accentuates the owl's striking presence, creating a serene yet powerful scene in the quiet of the night. Camera is fixed and static.",
128
+ // "--prompt", "An owl is moving his head. Camera is fixed and static.",
129
+
130
+ // "--use_prompt_extend",
131
+ // "--prompt_extend_model", "Qwen/Qwen2.5-VL-3B-Instruct",
132
+ // "--prompt_extend_target_lang", "en",
133
+
134
+ // "--prompt", "The subject begins in a forward-facing position with its eyes fixed toward the camera. The movement consists of a sharp, mechanical rotation of the head to the right. The subject maintains a stable, stationary body while the head turns approximately 90 degrees to face the side profile. During the turn, the subject blinks once before coming to a steady hold in the new direction. The camera is in a close-up, static shot, focusing entirely on the subtle facial movements and the fluid yet precise rotation. Camera remains fixed throughout the motion.",
135
+ // "--prompt", "The subject executes a sequence of three distinct athletic maneuvers, shifting orientation between each action: Forward Broad Jump with Pivot: The subject starts in a side-profile stance, crouches deeply, and performs a powerful forward horizontal leap. Upon landing, the subject executes a 90-degree pivot to face the camera, stabilizing into a standing position. Vertical Leap: From a front-facing orientation, the subject performs a rapid vertical jump. The arms swing upward to assist the elevation, and the subject lands back in the original position with a controlled, cushioned impact. 360-Degree Spin Jump: Following a brief pause, the subject initiates a high vertical jump while simultaneously rotating the entire body along the vertical axis. The subject completes a full 360-degree rotation in mid-air and lands facing forward, concluding in an upright, neutral posture. The camera remains in a fixed wide shot, capturing the subject's full-body kinematics, spatial displacement, and changes in orientation.",
136
+ // "--prompt", "the subject is walking across the frame. Camera is fixed and static. Fixed Background.",
137
+ // "--prompt", "A majestic snowy owl perches gracefully on a gnarled branch, its pristine white feathers adorned with delicate black speckles. The owl's piercing yellow eyes are wide and alert, scanning the surroundings with a sense of calm authority. As a gentle breeze rustles through the leaves, the owl remains poised, its sharp talons gripping the branch securely. The dark, blurred background accentuates the owl's striking presence, creating a serene yet powerful scene in the quiet of the night.",
138
+
139
+ // "--prompt", "The subject, a cat, performs a sequence involving a deliberate change in gaze and a single-paw gesture from a stationary start: Head Turn: The cat begins seated, its body in three-quarter profile and its head turned distinctly to the side, looking out of frame. It then executes a controlled, 90-degree rotation of the head, bringing its gaze directly forward toward the camera. Its body remains perfectly still throughout this turn. Paw Raise (Wave): Once facing forward, the cat holds its neutral, front-facing seated posture. It then delicately lifts one front paw. The paw performs a concise, rapid, three-stroke side-to-side 'air-kneading' or 'waving' motion, with the paw extended. This entire gesture is contained and precise. Held Stillness: Immediately after the final stroke, the cat retracts the paw, setting it softly back onto the surface, and holds a profound, unwavering, forward-facing gaze, returning to perfect, stationary alertness. The camera is in a fixed medium-wide side-profile shot, strictly framing the rotation of the head and the movement of the single limb while the body remains static, emphasizing the feline kinematics.",
140
+ // "--prompt", "The cat is turning its head towards the camera and after a second starts waving its right paw. Camera is fixed and static. Fixed Background.",
141
+ // "--prompt", "A majestic snowy owl perches gracefully on a gnarled branch, its pristine white feathers adorned with delicate black speckles. The owl's piercing yellow eyes are wide and alert, scanning the surroundings with a sense of calm authority. As a gentle breeze rustles through the leaves, the owl remains poised, its sharp talons gripping the branch securely. The dark, blurred background accentuates the owl's striking presence, creating a serene yet powerful scene in the quiet of the night.",
142
+ // "--prompt", "The cat is walking across the frame. Camera is fixed and static. Fixed Background.",
143
+ // "--prompt", "The doll is riding a skateboard like a proffessional, and jumps in the air. Camera is fixed and static. Fixed Background.",
144
+
145
+
146
+ // "--fm_ref_path", "guidance_exmaples/preprocessed_5B_dear_static_camera.mp4",
147
+ // "--fm_ref_path", "guidance_exmaples/i2v-mt/preprocessed_5B_121f_walking_puppy.mp4",
148
+ // "--fm_ref_path", "diff_video.mp4",
149
+ "--fm_ref_path", "guidance_exmaples/ttm/labubu/preprocessed_5B_labubu_121f.mp4",
150
+
151
+ // "--fm_ref_path", "guidance_exmaples/ttm/cutdrag_wan_Owl/preprocessed_5B_motion_signal_intrp.mp4",
152
+ // "--fm_ref_path", "guidance_exmaples/ttm/cutdrag_wan_Owl/preprocessed_5B_121f_motion_signal_intrp.mp4",
153
+
154
+ // "--use_motion_mask",
155
+ // "--fm_gamma_t", "30#30#30#30",
156
+ // "--fm_gamma_t", "15#20#30#40",
157
+
158
+ "--fm_gamma_t", "30",
159
+ // "--fm_gamma_t", "2.3",
160
+ // "--fm_alpha_t", "2#3#4#5#6#7#8#9",
161
+ "--fm_alpha_t", "2#4#6#8#10",
162
+ "--fm_alpha_t", "3#3#3#3#3#3#3#3",
163
+
164
+ // "--base_seed", "412",
165
+
166
+ ],
167
+ "env": {
168
+ "CUDA_VISIBLE_DEVICES": "0,1,2,3",
169
+ // "NCCL_DEBUG": "INFO",
170
+ // "TORCH_DISTRIBUTED_DEBUG": "DETAIL",
171
+ "PYTHONPATH": "${workspaceFolder}",
172
+ "OMP_NUM_THREADS": "1"
173
+ },
174
+ },
175
+ {
176
+ "name": "14b_fast_generate-t2v",
177
+ "type": "debugpy",
178
+ "request": "launch",
179
+ "module": "torch.distributed.run",
180
+ "console": "integratedTerminal",
181
+ "args": [
182
+ "--nproc_per_node", "8",
183
+ "--master_port", "29501",
184
+ "Wan2.2_phi-noise/generate.py",
185
+ "--ulysses_size", "8",
186
+ "--task", "t2v-A14B",
187
+ // "--size", "1280*720",
188
+ "--size", "832*480",
189
+ "--sample_steps", "20",
190
+ "--ckpt_dir", "/data/weights/wan/Wan2.2-T2V-A14B",
191
+ "--offload_model", "False",
192
+ "--convert_model_dtype",
193
+ "--dit_fsdp",
194
+ // "--frame_num", "121",
195
+
196
+ "--prompt",
197
+ // "the subject is walking across the frame. Camera is fixed and static. Fixed Background.",
198
+ // "The owl is moving his head. Camera is fixed and static. Fixed Background.",
199
+ // "A majestic snowy owl perches gracefully on a gnarled branch, its pristine white feathers adorned with delicate black speckles. The owl's piercing yellow eyes are wide and alert, scanning the surroundings with a sense of calm authority. As a gentle breeze rustles through the leaves, the owl remains poised, its sharp talons gripping the branch securely. The dark, blurred background accentuates the owl's striking presence, creating a serene yet powerful scene in the quiet of the night.",
200
+ // "The bird is spreading its wings and flying out of the frame. Camera is fixed and static. Fixed Background.",
201
+ // "The person is perfoming a backflip. Camera is fixed and static. Fixed Background.",
202
+ // "A person is sitting in a room. Suddenly, they spread their arms and magically fly out of the room. Camera is fixed and static. Fixed Background.",
203
+ // "The pendulum is moving from side to side in a realistic motion. Camera is fixed and static. Fixed Background.",
204
+ // "The toy is comming alive, starts flying and suddenly spitting fire from his mouth. Camera is fixed and static. Fixed Background.",
205
+ // "A surfer expertly rides inside the barrel of a powerful, curling wave. The sunlight glistens off the ocean surface, casting a shimmering glow across the water. As the wave crashes around him, he maintains perfect balance, skillfully maneuvering his board to stay within the wave's hollow. The sky is a soft blend of blues and whites, adding to the serene yet exhilarating atmosphere of the scene.",
206
+ // "An octopus is moving its tentacles in the water. Camera is fixed and static. Fixed Background.",
207
+ // "A surfer rides across ocean waves in an open sea scene. Camera is fixed and static. Fixed Background.",
208
+ // "A snail is walking fast at the beach. Camera is fixed and static. Fixed background.",
209
+ // "A dramatic low-angle shot of a silhouette standing with their back to the camera. In a swift, fluid motion, they spin around to face the lens, leveling a rifle with intense focus and a sharp gaze. Camera is fixed and static. Fixed Background.",
210
+ // "The camera follows the big rock rock from a high-angle perspective.",
211
+ // "A young child stands beside a concrete block on a vast, empty runway. The child, wearing a blue shirt and shorts, looks around curiously. Suddenly, with a burst of energy, he begins to jump up and down, his laughter echoing across the open space. The sky is overcast, and the distant trees frame the scene, adding a sense of freedom and adventure to his playful movements.",
212
+ "A yellow helicopter is flying in the beach. Camera is fixed and static. Fixed Background.",
213
+
214
+ "--pn_ref_path",
215
+ "guidance_exmaples/mt-t2m/preprocessed_14B-low_81f_duck.mp4",
216
+ // "guidance_exmaples/ttm/cutdrag_wan_Jumping/preprocessed_14B-low_81f_motion_signal.mp4",
217
+
218
+ // "--fm_gamma_t", "30#30#30#30",
219
+ // "--fm_gamma_t", "5#10#15#20",
220
+
221
+ // "--fm_gamma_t", "2#3#4#5#6#7#8",
222
+ "--pn_task", "t2v_mt",
223
+ "--pn_gamma", "4#5#6#7#8",
224
+ "--pn_alpha", "4",
225
+ ],
226
+ "env": {"CUDA_VISIBLE_DEVICES": "0,1,2,3,4,5,6,7",
227
+ "PYTHONPATH": "/dev/shm/ofir/phi-noise:/dev/shm/ofir/phi-noise/Wan2.2_phi-noise"
228
+ }
229
+ },
230
+ {
231
+ "name": "5b_fast_generate-t2v-spatial",
232
+ "type": "debugpy",
233
+ "request": "launch",
234
+ "module": "torch.distributed.run",
235
+ "console": "integratedTerminal",
236
+ "args": [
237
+ "--nproc_per_node", "4",
238
+ "--master_port", "29501",
239
+ "generate.py",
240
+ "--ulysses_size", "4",
241
+ "--task", "ti2v-5B",
242
+ "--size", "1280*704",
243
+ "--sample_steps", "20",
244
+ "--ckpt_dir", "/dev/shm/Wan2.2-TI2V-5B",
245
+ "--sample_steps", "20",
246
+ "--offload_model", "False",
247
+ "--convert_model_dtype",
248
+ "--dit_fsdp",
249
+
250
+ "--prompt",
251
+ "A cat is walking in the snow.",
252
+ "--fm_ref_path",
253
+ "guidance_exmaples/preprocessed_14B-low_81f_dear_static_camera.mp4",
254
+ "--fm_gamma_t", "10",
255
+ "--fm_alpha_t", "8#10#12#14#16",
256
+ "--base_seed", "42",
257
+
258
+ ],
259
+ "env": {"CUDA_VISIBLE_DEVICES": "4,5,6,7"}
260
+ },
261
+ {
262
+ "name": "5b_fast_generate",
263
+ "type": "debugpy",
264
+ "request": "launch",
265
+ "module": "torch.distributed.run",
266
+ "subProcess": true,
267
+ "justMyCode": false,
268
+ "console": "integratedTerminal",
269
+ "args": [
270
+ "--standalone",
271
+ "--nproc_per_node", "4",
272
+ "generate.py",
273
+ "--task", "ti2v-5B",
274
+ "--size", "1280*704",
275
+ "--sample_steps", "20",
276
+ "--ckpt_dir", "/dev/shm/Wan2.2-TI2V-5B",
277
+ "--offload_model", "False",
278
+ "--convert_model_dtype",
279
+ "--dit_fsdp",
280
+ "--ulysses_size", "4",
281
+ "--sample_solver", "unipc",
282
+ // "--image", "examples/nature.png",
283
+ // "--prompt", "a rabbit is bouncing up and down outside.",
284
+ // "--prompt", "a bowling ball is rolling down the lane.",
285
+ // "--prompt", "a dear is crossing the road walking. camera is fixed, static, and not moving.",
286
+ // "--prompt", "a peacock is walking. camera is fixed and static.",
287
+ "--prompt", "a dinosaur is walking.",
288
+ "--fm_ref_path", "guidance_exmaples/dear_static_camera.mp4",
289
+ // "--fm_ref_path", "guidance_exmaples/processed_5B_dear.mp4",
290
+ // "--fm_ref_path", "guidance_exmaples/processed_5B_ball_bouncing_v2.mp4",
291
+ // "--fm_ref_path", "guidance_exmaples/processed_5B_dino.mp4",
292
+ // "--fm_ref_path", "motion_video.mp4",
293
+ "--fm_gamma_s", "10",
294
+ "--fm_gamma_t", "70",
295
+ "--fm_alpha_s", "0.1",
296
+ "--fm_alpha_t", "0.2",
297
+ // "--base_seed", "412",
298
+ ],
299
+ "env": {
300
+ "CUDA_VISIBLE_DEVICES": "4,5,6,7",
301
+ // "NCCL_DEBUG": "INFO",
302
+ // "TORCH_DISTRIBUTED_DEBUG": "DETAIL",
303
+ "PYTHONPATH": "${workspaceFolder}",
304
+ "OMP_NUM_THREADS": "1"
305
+ },
306
+ },
307
+ {
308
+ "name": "generate_ti2v-5b_multigpu",
309
+ "type": "debugpy",
310
+ "request": "launch",
311
+ "module": "torch.distributed.run",
312
+ "console": "integratedTerminal",
313
+ "args": [
314
+ "--nproc_per_node", "8",
315
+ "--master_port", "29500",
316
+ "generate.py",
317
+ "--task", "ti2v-5B",
318
+ "--size", "1280*704",
319
+ "--sample_steps", "50",
320
+ "--ckpt_dir", "/data/weights/wan/Wan2.2-TI2V-5B",
321
+ "--offload_model", "False",
322
+ "--convert_model_dtype",
323
+ // "--base_seed", "424242",
324
+ "--prompt", "a ball is bouncing on the floor.",
325
+ ],
326
+ "env": {"CUDA_VISIBLE_DEVICES": "0,1,2,3,4,5,6,7"}
327
+ },
328
+ {
329
+ "name": "generate_ti2v-5b",
330
+ "type": "debugpy",
331
+ "request": "launch",
332
+ "program": "generate.py",
333
+ "console": "integratedTerminal",
334
+ "args": [
335
+ "--task", "ti2v-5B",
336
+ "--size", "1280*704",
337
+ "--sample_steps", "30",
338
+ "--ckpt_dir", "/data/weights/wan/Wan2.2-TI2V-5B",
339
+ "--offload_model", "False",
340
+ "--convert_model_dtype",
341
+ // "--base_seed", "424242",
342
+ "--prompt", "a ball is bouncing on the floor.",
343
+ ],
344
+ "env": {"CUDA_VISIBLE_DEVICES": "0,1,2,3,4,5,6,7"}
345
+ },
346
+ // torchrun 14b
347
+ {
348
+ "name": "generate_t2v-14b_multigpu",
349
+ "type": "debugpy",
350
+ "request": "launch",
351
+ "module": "torch.distributed.run",
352
+ "console": "integratedTerminal",
353
+ "args": [
354
+ "--nproc_per_node", "8",
355
+ "--master_port", "29500",
356
+ "generate.py",
357
+ "--task", "t2v-A14B",
358
+ // "--size", "720*1280",
359
+ // "--size", "1280*720",
360
+ // "--size", "480*832",
361
+ "--size", "832*480",
362
+ "--sample_steps", "50",
363
+ "--ckpt_dir", "/data/weights/wan/Wan2.2-T2V-A14B",
364
+ "--offload_model", "False",
365
+ "--convert_model_dtype",
366
+ // "--base_seed", "424242",
367
+ "--prompt", "a ball is bouncing on the floor.",
368
+ ],
369
+ "env": {"CUDA_VISIBLE_DEVICES": "0,1,2,3,4,5,6,7"}
370
+ },
371
+ {
372
+ "name": "generate_t2v-14b",
373
+ "type": "debugpy",
374
+ "request": "launch",
375
+ "program": "generate.py",
376
+ "console": "integratedTerminal",
377
+ "args": [
378
+ "--task", "t2v-A14B",
379
+ // "--size", "720*1280",
380
+ // "--size", "1280*720",
381
+ // "--size", "480*832",
382
+ "--size", "832*480",
383
+ "--sample_steps", "30",
384
+ "--ckpt_dir", "/data/weights/wan/Wan2.2-T2V-A14B",
385
+ "--offload_model", "False",
386
+ "--convert_model_dtype",
387
+ // "--base_seed", "424242",
388
+ "--prompt", "a ball is bouncing on the floor.",
389
+ ],
390
+ "env": {"CUDA_VISIBLE_DEVICES": "0,1,2,3,4,5,6,7"}
391
+ },
392
+ {
393
+ "name": "encode_video",
394
+ "type": "debugpy",
395
+ "request": "launch",
396
+ "program": "video_processing_utils.py",
397
+ "console": "integratedTerminal",
398
+ "env": {"CUDA_VISIBLE_DEVICES": "0"}
399
+ },
400
+ {
401
+ "name": "freq_utils",
402
+ "type": "debugpy",
403
+ "request": "launch",
404
+ "program": "freq_utils.py",
405
+ "console": "integratedTerminal",
406
+ "env": {"CUDA_VISIBLE_DEVICES": "4,5,6,7"}
407
+
408
+ },
409
+ {
410
+ "name": "generate_t2v-14b_custom",
411
+ "type": "debugpy",
412
+ "request": "launch",
413
+ "program": "generate.py",
414
+ "console": "integratedTerminal",
415
+ "args": [
416
+ "--task", "t2v-A14B",
417
+ "--size", "832*480",
418
+ "--sample_steps", "20",
419
+ "--ckpt_dir", "/data/weights/wan/Wan2.2-T2V-A14B",
420
+ "--offload_model", "False",
421
+ "--convert_model_dtype",
422
+ "--ulysses_size", "1",
423
+ "--sample_solver", "unipc",
424
+ "--fm_ref_path", "/dev/shm/loveu-tgve-2023/relatedworks/preprocess_videos_14B/elefent.mp4",
425
+ "--prompt", "a cat is walking.",
426
+ "--fm_alpha", "0.2#0.3#0.4#0.5#0.6#0.7#0.8",
427
+ "--base_seed", "42",
428
+ "--fm_gamma", "5",
429
+ "--fm_level", "2.25",
430
+ "--output_dir", "/dev/shm/baselines/ours/nadav_func_14B_ofir"
431
+ ],
432
+ "env": {"CUDA_VISIBLE_DEVICES": "4,5,6,7"}
433
+ }
434
+ ]
435
+ }
.vscode/settings.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "python-envs.defaultEnvManager": "ms-python.python:conda",
3
+ "python-envs.defaultPackageManager": "ms-python.python:conda"
4
+ }
OUTPUTS/i2v-A14B_832*480_8_A_flock_of_birds_flies_gracefully_across_the_sky_a_20260614_161600.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:19381834936d572c6b761f6cbe51c2010de49c354ba34fb7dd36ef1d480e8207
3
+ size 2213830
OUTPUTS/i2v-A14B_832*480_8_A_flock_of_birds_flies_gracefully_across_the_sky_a_20260614_161734.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6211ca3a40d6f26fd1aca4b48f6a3b2ce99d3887f007ae79546a8d3a7ce2d051
3
+ size 2487247
OUTPUTS/i2v-A14B_832*480_8_A_flock_of_birds_flies_gracefully_across_the_sky_a_20260614_161909.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:245a541c9036c5643078ed6bb892729003902e95d5b09a5b8dc87581d6e49924
3
+ size 2199116
OUTPUTS/i2v-A14B_832*480_8_A_flock_of_birds_flies_gracefully_across_the_sky_a_20260614_162043.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:46de92d8100b8be41d07e144d7fde744851eb4dc6c2d01ef66a5932c57d0afec
3
+ size 2107769
OUTPUTS/i2v-A14B_832*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_164913.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:34f9a1d42a3fb08cfd6362917a6b56792b9d09d838eefd4a6aed51da981c8549
3
+ size 5042940
OUTPUTS/i2v-A14B_832*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_165047.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d987e43c0bc25896f6b6baa10ab90a353e9012006291fc141ac8bcbe0726fd86
3
+ size 5327429
OUTPUTS/i2v-A14B_832*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_165221.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ec30d54f752509302d7926450ce37ea24a465942f2c3860dda1bf12effac22e0
3
+ size 5128910
OUTPUTS/i2v-A14B_832*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_165355.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2a5d7d003acc8ed7f3ffc554fd6c8d77220150ee2f33ef8fe358e28d897adb1c
3
+ size 5257848
OUTPUTS/i2v-A14B_832*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_165956.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4afc02a5aa17b532bfecc19fa597b4f0840a648e9db9b86855c6c7b716d47344
3
+ size 5011028
OUTPUTS/i2v-A14B_832*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_170130.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e16b4f3927f385b88e23c8b2e4c484d561d491471ca30636251d796a8d2848c9
3
+ size 5074599
OUTPUTS/i2v-A14B_832*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_170304.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e06c4b1a45b6d981c0dcb14614ef4ae3b2ff10c2ed1a86006ee3711c98ecc87
3
+ size 5565035
OUTPUTS/i2v-A14B_832*480_8_The_cat_is_turning_its_head_towards_the_camera_and_20260614_170438.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:27a931d2b187e618ee46e946e6a20cc69f42b2f2820ac5238371e4c188c06dd2
3
+ size 5039847
OUTPUTS/t2v-A14B_832*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260612_144341.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d590c6cda48d90bfd5f5e7c27ea48772ae2bfe805c068430e043ca2a9130a379
3
+ size 1979040
OUTPUTS/t2v-A14B_832*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260612_144942.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:edb46fa6b85370eac438ea456469b26e6e3d9041ddd6d3dbb928b0c0c9067fba
3
+ size 1977559
OUTPUTS/t2v-A14B_832*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260614_152023.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:558a06896a05e83ef2f44f2f7507fe370336cf17239758384af26c61bc1c0003
3
+ size 4016809
OUTPUTS/t2v-A14B_832*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260614_152155.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:40251113148c33ff82c0de5c321ea7fc1cc54040cbc2c23395fb03f0206f5662
3
+ size 3596481
OUTPUTS/t2v-A14B_832*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260614_152327.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4056ddd1888237b8e775427eb5dc9ea53957bdc77439b281fe54dc13a500c5fe
3
+ size 4052021
OUTPUTS/t2v-A14B_832*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260614_152459.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9c46a9973308dc6393152df0e0234ae2061eebbdef6d63f2386f8898ce044537
3
+ size 4245727
OUTPUTS/t2v-A14B_832*480_8_A_yellow_helicopter_is_flying_in_the_beach._Camera_20260614_152631.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f8097e663c531871ce1307bc01ade7eee1700956c8179319a574c4d1ecbc581f
3
+ size 3806474
README.md CHANGED
@@ -1,3 +1,135 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <table align="center">
2
+ <tr>
3
+ <td align="center" width="22%">
4
+ <img src="docs/static/logos/lab_logo.png" alt="Lab logo" width="100%" />
5
+ </td>
6
+ <td align="center" width="56%">
7
+ <h2 style="font-size:36px; margin:0;">ϕ-Noise:<br>Training-Free Temporal Video Conditioning via Phase-Based Noise Manipulation</h2>
8
+ <a href="https://arxiv.org/abs/2605.24509">
9
+ <img src="https://img.shields.io/badge/arXiv-paper-b31b1b?style=flat-square&logo=arxiv&logoColor=white" alt="arXiv" />
10
+ </a>
11
+ <a href="https://ofirabramovich.github.io/phi-noise/">
12
+ <img src="https://img.shields.io/badge/Web-page-1f77b4?style=flat-square&logo=github&logoColor=white" alt="Web page" />
13
+ </a>
14
+ <a href="https://arxiv.org/pdf/2605.24509">
15
+ <img src="https://img.shields.io/badge/PDF-download-0066cc?style=flat-square&logo=adobeacrobatreader&logoColor=white" alt="PDF" />
16
+ </a>
17
+ </td>
18
+ <td align="center" width="22%">
19
+ <img src="docs/static/logos/uni_logo.png" alt="University logo" width="100%" />
20
+ </td>
21
+ </tr>
22
+ </table>
23
+
24
+ ### An official implementatiton of the paper. ###
25
+
26
+ *Φ-Noise* enables motion and structure conditioning for diffusion-based video generation. By utilizing low-frequency components in either the spatial or temporal dimensions, it facilitates precise motion transfer and supports three key applications:
27
+ - Image-to-video motion Transfer
28
+ - Text-to-video Motion Transfer
29
+ - Cut-n-Drag (interactive user control over object trajectories and spatial placement)
30
+
31
+ | **I2V Motion Transfer** | **T2V Motion Transfer** | **Cut n' Drag** |
32
+ | :---: | :---: | :---: |
33
+ | <img src="docs/static/media/results/i2v.gif" alt="I2V Motion Transfer" width="90%"> | <img src="docs/static/media/results/t2v.gif" alt="T2V Motion Transfer" width="90%"> | <img src="docs/static/media/results/cnd.gif" alt="Cut n' Drag" width="100%"> |
34
+
35
+
36
+ ### Contents ###
37
+ - `phi_noise_utils.py`: core frequency-mixing utilities.
38
+ - `video_processing_utils.py`: Video utilities: preprocessing and adjusting sizes/lengths.
39
+ - `Wan2.2_phi-noise/`: A fork of [Wan2.2 official GitHub](https://github.com/Wan-Video/Wan2.2) with small adjustments for the integration of our method. \
40
+ *Note*: You have to git-clone it from the root directory (`git clone git@github.com:ofir1080/Wan2.2_phi-noise.git`).
41
+
42
+
43
+ ### Highlights ###
44
+ - *Φ-Noise* is **training-free** temporal conditioning via phase/magnitude mixing in frequency domain.
45
+ - this code (`freq_mix_temporal` and `freq_mix_spatial` in [phi_noise_utils.py](phi_noise_utils.py#L1-L220) can be integrated easily with any diffusion-based video model.
46
+ - We supply an example integration for Wan2.2 model [Wan2.2_phi-noise/generate.py](Wan2.2_phi-noise/generate.py#L1-L520).
47
+
48
+
49
+ ### Installation ###
50
+ *Φ-Noise* uses [PyTorch](https://pytorch.org/) for frequecny decomposition (`torch.fft` module). \
51
+ For installation instruction of Wan2.2, please refer to [Wan2.2/INSTALL.md](https://github.com/Wan-Video/Wan2.2/blob/main/INSTALL.md).
52
+
53
+ ### Usage ###
54
+
55
+ #### Φ-Noise + Wan2.2 ####
56
+
57
+ For a new input video, first preprocess it with `video_processing_utils.py` so the FPS, frame size, and clip length match the model requirements. This saves the preprocessed video in addition to the first frame (for I2V Motio Transfer).
58
+
59
+ Run the Wan example script (multi-GPU via torch.distributed.run). Make sure both the workspace root and the Wan folder are on `PYTHONPATH` so `phi_noise_utils` and `wan` import correctly. Example commands (adjust `--nproc_per_node`, `--ulysses_size`, `CUDA_VISIBLE_DEVICES`, and `--ckpt_dir`):
60
+
61
+ T2V Motion Trasfer:
62
+ ```bash
63
+ export PYTHONPATH=absolute-path/phi-noise/Wan2.2_phi-noise
64
+ export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
65
+ python -m torch.distributed.run \
66
+ --nproc_per_node 8 --master_port 29501 Wan2.2_phi-noise/generate.py \
67
+ --ulysses_size 8 --task t2v-A14B --size "832*480" --sample_steps 20 \
68
+ --ckpt_dir /path/to/checkpoints --offload_model False --convert_model_dtype \
69
+ --dit_fsdp --prompt "A yellow helicopter is flying in the beach. Camera is fixed and static. Fixed Background." \
70
+ --pn_ref_path guidance_exmaples/preprocessed_14B-low_81f_duck.mp4 --pn_task t2v_mt \
71
+ --pn_gamma 5 --pn_alpha 4
72
+ ```
73
+
74
+ I2V Motion Trasfer:
75
+ ```bash
76
+ export PYTHONPATH=absolute-path/to/phi-noise/Wan2.2_phi-noise
77
+ export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
78
+ python -m torch.distributed.run \
79
+ --nproc_per_node 8 --master_port 29501 Wan2.2_phi-noise/generate.py \
80
+ --ulysses_size 8 --task t2v-A14B --size "832*480" --sample_steps 20 \
81
+ --ckpt_dir /path/to/checkpoints --offload_model False --convert_model_dtype \
82
+ --dit_fsdp --prompt "The cat is turning its head towards the camera and after a second starts waving hello its right paw. Camera is fixed and static. Fixed Background." \
83
+ --image "guidance_exmaples/mt-it2m/cat_in_nature.jpg" \
84
+ --pn_ref_path guidance_exmaples/mt-it2m/preprocessed_14B-low_81f_woman_turning.mp4 \
85
+ --pn_task i2v_mt \
86
+ --pn_gamma 3 --pn_alpha 3
87
+ ```
88
+
89
+ Cut n' Drag:
90
+ ```bash
91
+ export PYTHONPATH=absolute-path/phi-noise/Wan2.2_phi-noise
92
+ export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
93
+ python -m torch.distributed.run \
94
+ --nproc_per_node 8 --master_port 29501 Wan2.2_phi-noise/generate.py \
95
+ --ulysses_size 8 --task i2v-A14B --size "832*480" --sample_steps 20 \
96
+ --ckpt_dir /path/to/checkpoints --offload_model False --convert_model_dtype --dit_fsdp \
97
+ --prompt "A flock of birds flies gracefully across the sky above a natural landscape." \
98
+ --image "guidance_exmaples/cut_n_drag/preprocessed_14B-low_81f_birds_ff.png"\
99
+ --pn_ref_path guidance_exmaples/cut_n_drag/preprocessed_14B-low_81f_birds.mp4 \
100
+ --pn_task t2v_mt \
101
+ --pn_gamma 30 --pn_alpha 3
102
+ ```
103
+ *Tip*: To run with multiple gamma or alpha values, pass them with `#` separators, for example: `--pn_alpha arg1#arg2#arg3`.
104
+
105
+ #### General Usage ####
106
+ As utilities in your own code (recommended):
107
+
108
+ ```python
109
+ from phi_noise_utils import freq_mix_temporal, freq_mix_spatial
110
+
111
+ # freq_mix_temporal expects lists like [latents] and returns a list
112
+ latents = freq_mix_temporal(noise_list, latents_ref_list, alpha=3, gamma=30.0) # recommended range values: gamma: alpha: [3-6], gamma: [30]
113
+
114
+ # freq_mix_spatial mixes spatial phase; returns a tensor
115
+ out = freq_mix_spatial(latents_hi, latents_lo, alpha=3, gamma=4.0, dims=("h","w")) # recommended range values: gamma: alpha: [3-4], gamma: [5-10]
116
+ ```
117
+
118
+
119
+ ### Citation ###
120
+ ```
121
+ @article{abramovich2025phinoise,
122
+ title = {ϕ-Noise: Training-Free Temporal Video Conditioning
123
+ via Phase-Based Noise Manipulation},
124
+ author = {Abramovich, Ofir and Cohen, Nadav Z. and
125
+ Rosenthal, Adi and Shamir, Ariel},
126
+ journal = {arXiv preprint},
127
+ year = {2025},
128
+ }
129
+ ```
130
+
131
+ ### Acknowledgments ###
132
+ This repository uses a fork of [Wan2.2](https://github.com/Wan-Video/Wan2.2) codebase.
133
+
134
+ ### License ###
135
+ This project is licensed under the **Apache License 2.0**.
Wan2.2_phi-noise/.gitignore ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ __pycache__/
2
+ .DS_Store
3
+ .vscode*
4
+ tmp_examples*
5
+ new_checkpoint*
6
+ batch_test*
7
+ nohup*
Wan2.2_phi-noise/INSTALL.md ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Installation Guide
2
+
3
+ ## Install with pip
4
+
5
+ ```bash
6
+ pip install .
7
+ pip install .[dev] # Installe aussi les outils de dev
8
+ ```
9
+
10
+ ## Install with Poetry
11
+
12
+ Ensure you have [Poetry](https://python-poetry.org/docs/#installation) installed on your system.
13
+
14
+ To install all dependencies:
15
+
16
+ ```bash
17
+ poetry install
18
+ ```
19
+
20
+ ### Handling `flash-attn` Installation Issues
21
+
22
+ If `flash-attn` fails due to **PEP 517 build issues**, you can try one of the following fixes.
23
+
24
+ #### No-Build-Isolation Installation (Recommended)
25
+ ```bash
26
+ poetry run pip install --upgrade pip setuptools wheel
27
+ poetry run pip install flash-attn --no-build-isolation
28
+ poetry install
29
+ ```
30
+
31
+ #### Install from Git (Alternative)
32
+ ```bash
33
+ poetry run pip install git+https://github.com/Dao-AILab/flash-attention.git
34
+ ```
35
+
36
+ ---
37
+
38
+ ### Running the Model
39
+
40
+ Once the installation is complete, you can run **Wan2.2** using:
41
+
42
+ ```bash
43
+ poetry run python generate.py --task t2v-A14B --size '1280*720' --ckpt_dir ./Wan2.2-T2V-A14B --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage."
44
+ ```
45
+
46
+ #### Test
47
+ ```bash
48
+ bash tests/test.sh
49
+ ```
50
+
51
+ #### Format
52
+ ```bash
53
+ black .
54
+ isort .
55
+ ```
Wan2.2_phi-noise/LICENSE.txt ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
Wan2.2_phi-noise/Makefile ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ .PHONY: format
2
+
3
+ format:
4
+ isort generate.py wan
5
+ yapf -i -r *.py generate.py wan
Wan2.2_phi-noise/README.md ADDED
@@ -0,0 +1,507 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Wan2.2
2
+
3
+ <p align="center">
4
+ <img src="assets/logo.png" width="400"/>
5
+ <p>
6
+
7
+ <p align="center">
8
+ 💜 <a href="https://wan.video"><b>Wan</b></a> &nbsp&nbsp | &nbsp&nbsp 🖥️ <a href="https://github.com/Wan-Video/Wan2.2">GitHub</a> &nbsp&nbsp | &nbsp&nbsp🤗 <a href="https://huggingface.co/Wan-AI/">Hugging Face</a>&nbsp&nbsp | &nbsp&nbsp🤖 <a href="https://modelscope.cn/organization/Wan-AI">ModelScope</a>&nbsp&nbsp | &nbsp&nbsp 📑 <a href="https://arxiv.org/abs/2503.20314">Paper</a> &nbsp&nbsp | &nbsp&nbsp 📑 <a href="https://wan.video/welcome?spm=a2ty_o02.30011076.0.0.6c9ee41eCcluqg">Blog</a> &nbsp&nbsp | &nbsp&nbsp 💬 <a href="https://discord.gg/AKNgpMK4Yj">Discord</a>&nbsp&nbsp
9
+ <br>
10
+ 📕 <a href="https://alidocs.dingtalk.com/i/nodes/jb9Y4gmKWrx9eo4dCql9LlbYJGXn6lpz">使用指南(中文)</a>&nbsp&nbsp | &nbsp&nbsp 📘 <a href="https://alidocs.dingtalk.com/i/nodes/EpGBa2Lm8aZxe5myC99MelA2WgN7R35y">User Guide(English)</a>&nbsp&nbsp | &nbsp&nbsp💬 <a href="https://gw.alicdn.com/imgextra/i2/O1CN01tqjWFi1ByuyehkTSB_!!6000000000015-0-tps-611-1279.jpg">WeChat(微信)</a>&nbsp&nbsp
11
+ <br>
12
+
13
+ -----
14
+
15
+ [**Wan: Open and Advanced Large-Scale Video Generative Models**](https://arxiv.org/abs/2503.20314) <be>
16
+
17
+
18
+ We are excited to introduce **Wan2.2**, a major upgrade to our foundational video models. With **Wan2.2**, we have focused on incorporating the following innovations:
19
+
20
+ - 👍 **Effective MoE Architecture**: Wan2.2 introduces a Mixture-of-Experts (MoE) architecture into video diffusion models. By separating the denoising process cross timesteps with specialized powerful expert models, this enlarges the overall model capacity while maintaining the same computational cost.
21
+
22
+ - 👍 **Cinematic-level Aesthetics**: Wan2.2 incorporates meticulously curated aesthetic data, complete with detailed labels for lighting, composition, contrast, color tone, and more. This allows for more precise and controllable cinematic style generation, facilitating the creation of videos with customizable aesthetic preferences.
23
+
24
+ - 👍 **Complex Motion Generation**: Compared to Wan2.1, Wan2.2 is trained on a significantly larger data, with +65.6% more images and +83.2% more videos. This expansion notably enhances the model's generalization across multiple dimensions such as motions, semantics, and aesthetics, achieving TOP performance among all open-sourced and closed-sourced models.
25
+
26
+ - 👍 **Efficient High-Definition Hybrid TI2V**: Wan2.2 open-sources a 5B model built with our advanced Wan2.2-VAE that achieves a compression ratio of **16×16×4**. This model supports both text-to-video and image-to-video generation at 720P resolution with 24fps and can also run on consumer-grade graphics cards like 4090. It is one of the fastest **720P@24fps** models currently available, capable of serving both the industrial and academic sectors simultaneously.
27
+
28
+
29
+ ## Video Demos
30
+
31
+ <div align="center">
32
+ <video src="https://github.com/user-attachments/assets/b63bfa58-d5d7-4de6-a1a2-98970b06d9a7" width="70%" poster=""> </video>
33
+ </div>
34
+
35
+ ## 🔥 Latest News!!
36
+ * Nov 13, 2025: 👋 Wan2.2-Animate-14B has been integrated into Diffusers ([PR](https://github.com/huggingface/diffusers/pull/12526),[Weights](https://huggingface.co/Wan-AI/Wan2.2-Animate-14B-Diffusers)). Thanks to all community contributors. Enjoy!
37
+
38
+ * Sep 19, 2025: 💃 We introduct **[Wan2.2-Animate-14B](https://humanaigc.github.io/wan-animate)**, an unified model for character animation and replacement with holistic movement and expression replication. We released the [model weights](#model-download) and [inference code](#run-wan-animate). And you can try it on [wan.video](https://wan.video/), [ModelScope Studio](https://www.modelscope.cn/studios/Wan-AI/Wan2.2-Animate) or [HuggingFace Space](https://huggingface.co/spaces/Wan-AI/Wan2.2-Animate)!
39
+ * Aug 26, 2025: 🎵 We introduce **[Wan2.2-S2V-14B](https://humanaigc.github.io/wan-s2v-webpage)**, an audio-driven cinematic video generation model, including [inference code](#run-speech-to-video-generation), [model weights](#model-download), and [technical report](https://humanaigc.github.io/wan-s2v-webpage/content/wan-s2v.pdf)! Now you can try it on [wan.video](https://wan.video/), [ModelScope Gradio](https://www.modelscope.cn/studios/Wan-AI/Wan2.2-S2V) or [HuggingFace Gradio](https://huggingface.co/spaces/Wan-AI/Wan2.2-S2V)!
40
+ * Jul 28, 2025: 👋 We have open a [HF space](https://huggingface.co/spaces/Wan-AI/Wan-2.2-5B) using the TI2V-5B model. Enjoy!
41
+ * Jul 28, 2025: 👋 Wan2.2 has been integrated into ComfyUI ([CN](https://docs.comfy.org/zh-CN/tutorials/video/wan/wan2_2) | [EN](https://docs.comfy.org/tutorials/video/wan/wan2_2)). Enjoy!
42
+ * Jul 28, 2025: 👋 Wan2.2's T2V, I2V and TI2V have been integrated into Diffusers ([T2V-A14B](https://huggingface.co/Wan-AI/Wan2.2-T2V-A14B-Diffusers) | [I2V-A14B](https://huggingface.co/Wan-AI/Wan2.2-I2V-A14B-Diffusers) | [TI2V-5B](https://huggingface.co/Wan-AI/Wan2.2-TI2V-5B-Diffusers)). Feel free to give it a try!
43
+ * Jul 28, 2025: 👋 We've released the inference code and model weights of **Wan2.2**.
44
+ * Sep 5, 2025: 👋 We add text-to-speech synthesis support with [CosyVoice](https://github.com/FunAudioLLM/CosyVoice) for Speech-to-Video generation task.
45
+
46
+
47
+ ## Community Works
48
+ If your research or project builds upon [**Wan2.1**](https://github.com/Wan-Video/Wan2.1) or [**Wan2.2**](https://github.com/Wan-Video/Wan2.2), and you would like more people to see it, please inform us.
49
+
50
+ - [Prompt Relay](https://github.com/GordonChen19/Prompt-Relay), a plug-and-play, inference-time method for temporal control in video generation. Prompt Relay improves video quality and gives users precise control over what happens at each moment in the video. Visit their [webpage](https://gordonchen19.github.io/Prompt-Relay/) for more details.
51
+ - [Helios](https://github.com/PKU-YuanGroup/Helios), a breakthrough video generation model base on **Wan2.1** that achieves minute-scale, high-quality video synthesis at 19.5 FPS on a single H100 GPU (about 10 FPS on a single Ascend NPU) —without relying on conventional long video anti-drifting strategies or standard video acceleration techniques. Visit their [webpage](https://pku-yuangroup.github.io/Helios-Page/) for more details.
52
+ - [LightX2V](https://github.com/ModelTC/LightX2V), a lightweight and efficient video generation framework that integrates **Wan2.1** and **Wan2.2**, supporting multiple engineering acceleration techniques for fast inference. [LightX2V-HuggingFace](https://huggingface.co/lightx2v), offers a variety of Wan-based step-distillation models, quantized models, and lightweight VAE models.
53
+ - [HuMo](https://github.com/Phantom-video/HuMo) proposed a unified, human-centric framework based on **Wan** to produce high-quality, fine-grained, and controllable human videos from multimodal inputs—including text, images, and audio. Visit their [webpage](https://phantom-video.github.io/HuMo/) for more details.
54
+ - [FastVideo](https://github.com/hao-ai-lab/FastVideo) includes distilled **Wan** models with sparse attention that significanly speed up the inference time.
55
+ - [Cache-dit](https://github.com/vipshop/cache-dit) offers Fully Cache Acceleration support for **Wan2.2** MoE with DBCache, TaylorSeer and Cache CFG. Visit their [example](https://github.com/vipshop/cache-dit/blob/main/examples/pipeline/run_wan_2.2.py) for more details.
56
+ - [Kijai's ComfyUI WanVideoWrapper](https://github.com/kijai/ComfyUI-WanVideoWrapper) is an alternative implementation of **Wan** models for ComfyUI. Thanks to its Wan-only focus, it's on the frontline of getting cutting edge optimizations and hot research features, which are often hard to integrate into ComfyUI quickly due to its more rigid structure.
57
+ - [DiffSynth-Studio](https://github.com/modelscope/DiffSynth-Studio) provides comprehensive support for **Wan 2.2**, including low-GPU-memory layer-by-layer offload, FP8 quantization, sequence parallelism, LoRA training, full training.
58
+
59
+
60
+ ## 📑 Todo List
61
+ - Wan2.2 Text-to-Video
62
+ - [x] Multi-GPU Inference code of the A14B and 14B models
63
+ - [x] Checkpoints of the A14B and 14B models
64
+ - [x] ComfyUI integration
65
+ - [x] Diffusers integration
66
+ - Wan2.2 Image-to-Video
67
+ - [x] Multi-GPU Inference code of the A14B model
68
+ - [x] Checkpoints of the A14B model
69
+ - [x] ComfyUI integration
70
+ - [x] Diffusers integration
71
+ - Wan2.2 Text-Image-to-Video
72
+ - [x] Multi-GPU Inference code of the 5B model
73
+ - [x] Checkpoints of the 5B model
74
+ - [x] ComfyUI integration
75
+ - [x] Diffusers integration
76
+ - Wan2.2-S2V Speech-to-Video
77
+ - [x] Inference code of Wan2.2-S2V
78
+ - [x] Checkpoints of Wan2.2-S2V-14B
79
+ - [x] ComfyUI integration
80
+ - [x] Diffusers integration
81
+ - Wan2.2-Animate Character Animation and Replacement
82
+ - [x] Inference code of Wan2.2-Animate
83
+ - [x] Checkpoints of Wan2.2-Animate
84
+ - [x] ComfyUI integration
85
+ - [x] Diffusers integration
86
+
87
+ ## Run Wan2.2
88
+
89
+ #### Installation
90
+ Clone the repo:
91
+ ```sh
92
+ git clone https://github.com/Wan-Video/Wan2.2.git
93
+ cd Wan2.2
94
+ ```
95
+
96
+ Install dependencies:
97
+ ```sh
98
+ # Ensure torch >= 2.4.0
99
+ # If the installation of `flash_attn` fails, try installing the other packages first and install `flash_attn` last
100
+ pip install -r requirements.txt
101
+ # If you want to use CosyVoice to synthesize speech for Speech-to-Video Generation, please install requirements_s2v.txt additionally
102
+ pip install -r requirements_s2v.txt
103
+ ```
104
+
105
+
106
+ #### Model Download
107
+
108
+ | Models | Download Links | Description |
109
+ |--------------------|---------------------------------------------------------------------------------------------------------------------------------------------|-------------|
110
+ | T2V-A14B | 🤗 [Huggingface](https://huggingface.co/Wan-AI/Wan2.2-T2V-A14B) 🤖 [ModelScope](https://modelscope.cn/models/Wan-AI/Wan2.2-T2V-A14B) | Text-to-Video MoE model, supports 480P & 720P |
111
+ | I2V-A14B | 🤗 [Huggingface](https://huggingface.co/Wan-AI/Wan2.2-I2V-A14B) 🤖 [ModelScope](https://modelscope.cn/models/Wan-AI/Wan2.2-I2V-A14B) | Image-to-Video MoE model, supports 480P & 720P |
112
+ | TI2V-5B | 🤗 [Huggingface](https://huggingface.co/Wan-AI/Wan2.2-TI2V-5B) 🤖 [ModelScope](https://modelscope.cn/models/Wan-AI/Wan2.2-TI2V-5B) | High-compression VAE, T2V+I2V, supports 720P |
113
+ | S2V-14B | 🤗 [Huggingface](https://huggingface.co/Wan-AI/Wan2.2-S2V-14B) 🤖 [ModelScope](https://modelscope.cn/models/Wan-AI/Wan2.2-S2V-14B) | Speech-to-Video model, supports 480P & 720P |
114
+ | Animate-14B | 🤗 [Huggingface](https://huggingface.co/Wan-AI/Wan2.2-Animate-14B) 🤖 [ModelScope](https://www.modelscope.cn/models/Wan-AI/Wan2.2-Animate-14B) | Character animation and replacement | |
115
+
116
+
117
+
118
+ > 💡Note:
119
+ > The TI2V-5B model supports 720P video generation at **24 FPS**.
120
+
121
+
122
+ Download models using huggingface-cli:
123
+ ``` sh
124
+ pip install "huggingface_hub[cli]"
125
+ huggingface-cli download Wan-AI/Wan2.2-T2V-A14B --local-dir ./Wan2.2-T2V-A14B
126
+ ```
127
+
128
+ Download models using modelscope-cli:
129
+ ``` sh
130
+ pip install modelscope
131
+ modelscope download Wan-AI/Wan2.2-T2V-A14B --local_dir ./Wan2.2-T2V-A14B
132
+ ```
133
+
134
+ #### Run Text-to-Video Generation
135
+
136
+ This repository supports the `Wan2.2-T2V-A14B` Text-to-Video model and can simultaneously support video generation at 480P and 720P resolutions.
137
+
138
+
139
+ ##### (1) Without Prompt Extension
140
+
141
+ To facilitate implementation, we will start with a basic version of the inference process that skips the [prompt extension](#2-using-prompt-extention) step.
142
+
143
+ - Single-GPU inference
144
+
145
+ ``` sh
146
+ python generate.py --task t2v-A14B --size 1280*720 --ckpt_dir ./Wan2.2-T2V-A14B --offload_model True --convert_model_dtype --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage."
147
+ ```
148
+
149
+ > 💡 This command can run on a GPU with at least 80GB VRAM.
150
+
151
+ > 💡If you encounter OOM (Out-of-Memory) issues, you can use the `--offload_model True`, `--convert_model_dtype` and `--t5_cpu` options to reduce GPU memory usage.
152
+
153
+
154
+ - Multi-GPU inference using FSDP + DeepSpeed Ulysses
155
+
156
+ We use [PyTorch FSDP](https://docs.pytorch.org/docs/stable/fsdp.html) and [DeepSpeed Ulysses](https://arxiv.org/abs/2309.14509) to accelerate inference.
157
+
158
+
159
+ ``` sh
160
+ torchrun --nproc_per_node=8 generate.py --task t2v-A14B --size 1280*720 --ckpt_dir ./Wan2.2-T2V-A14B --dit_fsdp --t5_fsdp --ulysses_size 8 --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage."
161
+ ```
162
+
163
+
164
+ ##### (2) Using Prompt Extension
165
+
166
+ Extending the prompts can effectively enrich the details in the generated videos, further enhancing the video quality. Therefore, we recommend enabling prompt extension. We provide the following two methods for prompt extension:
167
+
168
+ - Use the Dashscope API for extension.
169
+ - Apply for a `dashscope.api_key` in advance ([EN](https://www.alibabacloud.com/help/en/model-studio/getting-started/first-api-call-to-qwen) | [CN](https://help.aliyun.com/zh/model-studio/getting-started/first-api-call-to-qwen)).
170
+ - Configure the environment variable `DASH_API_KEY` to specify the Dashscope API key. For users of Alibaba Cloud's international site, you also need to set the environment variable `DASH_API_URL` to 'https://dashscope-intl.aliyuncs.com/api/v1'. For more detailed instructions, please refer to the [dashscope document](https://www.alibabacloud.com/help/en/model-studio/developer-reference/use-qwen-by-calling-api?spm=a2c63.p38356.0.i1).
171
+ - Use the `qwen-plus` model for text-to-video tasks and `qwen-vl-max` for image-to-video tasks.
172
+ - You can modify the model used for extension with the parameter `--prompt_extend_model`. For example:
173
+ ```sh
174
+ DASH_API_KEY=your_key torchrun --nproc_per_node=8 generate.py --task t2v-A14B --size 1280*720 --ckpt_dir ./Wan2.2-T2V-A14B --dit_fsdp --t5_fsdp --ulysses_size 8 --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage" --use_prompt_extend --prompt_extend_method 'dashscope' --prompt_extend_target_lang 'zh'
175
+ ```
176
+
177
+ - Using a local model for extension.
178
+
179
+ - By default, the Qwen model on HuggingFace is used for this extension. Users can choose Qwen models or other models based on the available GPU memory size.
180
+ - For text-to-video tasks, you can use models like `Qwen/Qwen2.5-14B-Instruct`, `Qwen/Qwen2.5-7B-Instruct` and `Qwen/Qwen2.5-3B-Instruct`.
181
+ - For image-to-video tasks, you can use models like `Qwen/Qwen2.5-VL-7B-Instruct` and `Qwen/Qwen2.5-VL-3B-Instruct`.
182
+ - Larger models generally provide better extension results but require more GPU memory.
183
+ - You can modify the model used for extension with the parameter `--prompt_extend_model` , allowing you to specify either a local model path or a Hugging Face model. For example:
184
+
185
+ ``` sh
186
+ torchrun --nproc_per_node=8 generate.py --task t2v-A14B --size 1280*720 --ckpt_dir ./Wan2.2-T2V-A14B --dit_fsdp --t5_fsdp --ulysses_size 8 --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage" --use_prompt_extend --prompt_extend_method 'local_qwen' --prompt_extend_target_lang 'zh'
187
+ ```
188
+
189
+
190
+ #### Run Image-to-Video Generation
191
+
192
+ This repository supports the `Wan2.2-I2V-A14B` Image-to-Video model and can simultaneously support video generation at 480P and 720P resolutions.
193
+
194
+
195
+ - Single-GPU inference
196
+ ```sh
197
+ python generate.py --task i2v-A14B --size 1280*720 --ckpt_dir ./Wan2.2-I2V-A14B --offload_model True --convert_model_dtype --image examples/i2v_input.JPG --prompt "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard. The fluffy-furred feline gazes directly at the camera with a relaxed expression. Blurred beach scenery forms the background featuring crystal-clear waters, distant green hills, and a blue sky dotted with white clouds. The cat assumes a naturally relaxed posture, as if savoring the sea breeze and warm sunlight. A close-up shot highlights the feline's intricate details and the refreshing atmosphere of the seaside."
198
+ ```
199
+
200
+ > This command can run on a GPU with at least 80GB VRAM.
201
+
202
+ > 💡For the Image-to-Video task, the `size` parameter represents the area of the generated video, with the aspect ratio following that of the original input image.
203
+
204
+
205
+ - Multi-GPU inference using FSDP + DeepSpeed Ulysses
206
+
207
+ ```sh
208
+ torchrun --nproc_per_node=8 generate.py --task i2v-A14B --size 1280*720 --ckpt_dir ./Wan2.2-I2V-A14B --image examples/i2v_input.JPG --dit_fsdp --t5_fsdp --ulysses_size 8 --prompt "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard. The fluffy-furred feline gazes directly at the camera with a relaxed expression. Blurred beach scenery forms the background featuring crystal-clear waters, distant green hills, and a blue sky dotted with white clouds. The cat assumes a naturally relaxed posture, as if savoring the sea breeze and warm sunlight. A close-up shot highlights the feline's intricate details and the refreshing atmosphere of the seaside."
209
+ ```
210
+
211
+ - Image-to-Video Generation without prompt
212
+
213
+ ```sh
214
+ DASH_API_KEY=your_key torchrun --nproc_per_node=8 generate.py --task i2v-A14B --size 1280*720 --ckpt_dir ./Wan2.2-I2V-A14B --prompt '' --image examples/i2v_input.JPG --dit_fsdp --t5_fsdp --ulysses_size 8 --use_prompt_extend --prompt_extend_method 'dashscope'
215
+ ```
216
+
217
+ > 💡The model can generate videos solely from the input image. You can use prompt extension to generate prompt from the image.
218
+
219
+ > The process of prompt extension can be referenced [here](#2-using-prompt-extention).
220
+
221
+ #### Run Text-Image-to-Video Generation
222
+
223
+ This repository supports the `Wan2.2-TI2V-5B` Text-Image-to-Video model and can support video generation at 720P resolutions.
224
+
225
+
226
+ - Single-GPU Text-to-Video inference
227
+ ```sh
228
+ python generate.py --task ti2v-5B --size 1280*704 --ckpt_dir ./Wan2.2-TI2V-5B --offload_model True --convert_model_dtype --t5_cpu --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage"
229
+ ```
230
+
231
+ > 💡Unlike other tasks, the 720P resolution of the Text-Image-to-Video task is `1280*704` or `704*1280`.
232
+
233
+ > This command can run on a GPU with at least 24GB VRAM (e.g, RTX 4090 GPU).
234
+
235
+ > 💡If you are running on a GPU with at least 80GB VRAM, you can remove the `--offload_model True`, `--convert_model_dtype` and `--t5_cpu` options to speed up execution.
236
+
237
+
238
+ - Single-GPU Image-to-Video inference
239
+ ```sh
240
+ python generate.py --task ti2v-5B --size 1280*704 --ckpt_dir ./Wan2.2-TI2V-5B --offload_model True --convert_model_dtype --t5_cpu --image examples/i2v_input.JPG --prompt "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard. The fluffy-furred feline gazes directly at the camera with a relaxed expression. Blurred beach scenery forms the background featuring crystal-clear waters, distant green hills, and a blue sky dotted with white clouds. The cat assumes a naturally relaxed posture, as if savoring the sea breeze and warm sunlight. A close-up shot highlights the feline's intricate details and the refreshing atmosphere of the seaside."
241
+ ```
242
+
243
+ > 💡If the image parameter is configured, it is an Image-to-Video generation; otherwise, it defaults to a Text-to-Video generation.
244
+
245
+ > 💡Similar to Image-to-Video, the `size` parameter represents the area of the generated video, with the aspect ratio following that of the original input image.
246
+
247
+
248
+ - Multi-GPU inference using FSDP + DeepSpeed Ulysses
249
+
250
+ ```sh
251
+ torchrun --nproc_per_node=8 generate.py --task ti2v-5B --size 1280*704 --ckpt_dir ./Wan2.2-TI2V-5B --dit_fsdp --t5_fsdp --ulysses_size 8 --image examples/i2v_input.JPG --prompt "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard. The fluffy-furred feline gazes directly at the camera with a relaxed expression. Blurred beach scenery forms the background featuring crystal-clear waters, distant green hills, and a blue sky dotted with white clouds. The cat assumes a naturally relaxed posture, as if savoring the sea breeze and warm sunlight. A close-up shot highlights the feline's intricate details and the refreshing atmosphere of the seaside."
252
+ ```
253
+
254
+ > The process of prompt extension can be referenced [here](#2-using-prompt-extention).
255
+
256
+ #### Run Speech-to-Video Generation
257
+
258
+ This repository supports the `Wan2.2-S2V-14B` Speech-to-Video model and can simultaneously support video generation at 480P and 720P resolutions.
259
+
260
+ - Single-GPU Speech-to-Video inference
261
+
262
+ ```sh
263
+ python generate.py --task s2v-14B --size 1024*704 --ckpt_dir ./Wan2.2-S2V-14B/ --offload_model True --convert_model_dtype --prompt "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard." --image "examples/i2v_input.JPG" --audio "examples/talk.wav"
264
+ # Without setting --num_clip, the generated video length will automatically adjust based on the input audio length
265
+
266
+ # You can use CosyVoice to generate audio with --enable_tts
267
+ python generate.py --task s2v-14B --size 1024*704 --ckpt_dir ./Wan2.2-S2V-14B/ --offload_model True --convert_model_dtype --prompt "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard." --image "examples/i2v_input.JPG" --enable_tts --tts_prompt_audio "examples/zero_shot_prompt.wav" --tts_prompt_text "希望你以后能够做的比我还好呦。" --tts_text "收到好友从远方寄来的生日礼物,那份意外的惊喜与深深的祝福让我心中充满了甜蜜的快乐,笑容如花儿般绽放。"
268
+ ```
269
+
270
+ > 💡 This command can run on a GPU with at least 80GB VRAM.
271
+
272
+ - Multi-GPU inference using FSDP + DeepSpeed Ulysses
273
+
274
+ ```sh
275
+ torchrun --nproc_per_node=8 generate.py --task s2v-14B --size 1024*704 --ckpt_dir ./Wan2.2-S2V-14B/ --dit_fsdp --t5_fsdp --ulysses_size 8 --prompt "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard." --image "examples/i2v_input.JPG" --audio "examples/talk.wav"
276
+ ```
277
+
278
+ - Pose + Audio driven generation
279
+
280
+ ```sh
281
+ torchrun --nproc_per_node=8 generate.py --task s2v-14B --size 1024*704 --ckpt_dir ./Wan2.2-S2V-14B/ --dit_fsdp --t5_fsdp --ulysses_size 8 --prompt "a person is singing" --image "examples/pose.png" --audio "examples/sing.MP3" --pose_video "./examples/pose.mp4"
282
+ ```
283
+
284
+ > 💡For the Speech-to-Video task, the `size` parameter represents the area of the generated video, with the aspect ratio following that of the original input image.
285
+
286
+ > 💡The model can generate videos from audio input combined with reference image and optional text prompt.
287
+
288
+ > 💡The `--pose_video` parameter enables pose-driven generation, allowing the model to follow specific pose sequences while generating videos synchronized with audio input.
289
+
290
+ > 💡The `--num_clip` parameter controls the number of video clips generated, useful for quick preview with shorter generation time.
291
+
292
+ Please visit our project page to see more examples and learn about the scenarios suitable for this model.
293
+
294
+ #### Run Wan-Animate
295
+
296
+ Wan-Animate takes a video and a character image as input, and generates a video in either "animation" or "replacement" mode.
297
+
298
+ 1. animation mode: The model generates a video of the character image that mimics the human motion in the input video.
299
+ 2. replacement mode: The model replaces the character image with the input video.
300
+
301
+ Please visit our [project page](https://humanaigc.github.io/wan-animate) to see more examples and learn about the scenarios suitable for this model.
302
+
303
+ ##### (1) Preprocessing
304
+ The input video should be preprocessed into several materials before be feed into the inference process. Please refer to the following processing flow, and more details about preprocessing can be found in [UserGuider](https://github.com/Wan-Video/Wan2.2/blob/main/wan/modules/animate/preprocess/UserGuider.md).
305
+
306
+ * For animation
307
+ ```bash
308
+ python ./wan/modules/animate/preprocess/preprocess_data.py \
309
+ --ckpt_path ./Wan2.2-Animate-14B/process_checkpoint \
310
+ --video_path ./examples/wan_animate/animate/video.mp4 \
311
+ --refer_path ./examples/wan_animate/animate/image.jpeg \
312
+ --save_path ./examples/wan_animate/animate/process_results \
313
+ --resolution_area 1280 720 \
314
+ --retarget_flag \
315
+ --use_flux
316
+ ```
317
+ * For replacement
318
+ ```bash
319
+ python ./wan/modules/animate/preprocess/preprocess_data.py \
320
+ --ckpt_path ./Wan2.2-Animate-14B/process_checkpoint \
321
+ --video_path ./examples/wan_animate/replace/video.mp4 \
322
+ --refer_path ./examples/wan_animate/replace/image.jpeg \
323
+ --save_path ./examples/wan_animate/replace/process_results \
324
+ --resolution_area 1280 720 \
325
+ --iterations 3 \
326
+ --k 7 \
327
+ --w_len 1 \
328
+ --h_len 1 \
329
+ --replace_flag
330
+ ```
331
+ ##### (2) Run in animation mode
332
+
333
+ * Single-GPU inference
334
+
335
+ ```bash
336
+ python generate.py --task animate-14B --ckpt_dir ./Wan2.2-Animate-14B/ --src_root_path ./examples/wan_animate/animate/process_results/ --refert_num 1
337
+ ```
338
+
339
+ * Multi-GPU inference using FSDP + DeepSpeed Ulysses
340
+
341
+ ```bash
342
+ python -m torch.distributed.run --nnodes 1 --nproc_per_node 8 generate.py --task animate-14B --ckpt_dir ./Wan2.2-Animate-14B/ --src_root_path ./examples/wan_animate/animate/process_results/ --refert_num 1 --dit_fsdp --t5_fsdp --ulysses_size 8
343
+ ```
344
+
345
+ * Diffusers Pipeline
346
+
347
+ ```python
348
+ from diffusers import WanAnimatePipeline
349
+ from diffusers.utils import export_to_video, load_image, load_video
350
+
351
+ device = "cuda:0"
352
+ dtype = torch.bfloat16
353
+ model_id = "Wan-AI/Wan2.2-Animate-14B-Diffusers"
354
+ pipe = WanAnimatePipeline.from_pretrained(model_id torch_dtype=dtype)
355
+ pipe.to(device)
356
+
357
+ seed = 42
358
+ prompt = "People in the video are doing actions."
359
+
360
+ # Animation
361
+ image = load_image("/path/to/animate/reference/image/src_ref.png")
362
+ pose_video = load_video("/path/to/animate/pose/video/src_pose.mp4")
363
+ face_video = load_video("/path/to/animate/face/video/src_face.mp4")
364
+
365
+ animate_video = pipe(
366
+ image=image,
367
+ pose_video=pose_video,
368
+ face_video=face_video,
369
+ prompt=prompt,
370
+ mode="animate",
371
+ segment_frame_length=77, # clip_len in original code
372
+ prev_segment_conditioning_frames=1, # refert_num in original code
373
+ guidance_scale=1.0,
374
+ num_inference_steps=20,
375
+ generator=torch.Generator(device=device).manual_seed(seed),
376
+ ).frames[0]
377
+ export_to_video(animate_video, "diffusers_animate.mp4", fps=30)
378
+ ```
379
+
380
+ ##### (3) Run in replacement mode
381
+
382
+ * Single-GPU inference
383
+
384
+ ```bash
385
+ python generate.py --task animate-14B --ckpt_dir ./Wan2.2-Animate-14B/ --src_root_path ./examples/wan_animate/replace/process_results/ --refert_num 1 --replace_flag --use_relighting_lora
386
+ ```
387
+
388
+ * Multi-GPU inference using FSDP + DeepSpeed Ulysses
389
+
390
+ ```bash
391
+ python -m torch.distributed.run --nnodes 1 --nproc_per_node 8 generate.py --task animate-14B --ckpt_dir ./Wan2.2-Animate-14B/ --src_root_path ./examples/wan_animate/replace/process_results/src_pose.mp4 --refert_num 1 --replace_flag --use_relighting_lora --dit_fsdp --t5_fsdp --ulysses_size 8
392
+ ```
393
+
394
+ * Diffusers Pipeline
395
+
396
+ ```python
397
+ # create pipeline as in the Animation code ☝️
398
+
399
+ # Replacement
400
+ image = load_image("/path/to/replace/reference/image/src_ref.png")
401
+ pose_video = load_video("/path/to/replace/pose/video/src_pose.mp4")
402
+ face_video = load_video("/path/to/replace/face/video/src_face.mp4")
403
+ background_video = load_video("/path/to/replace/background/video/src_bg.mp4")
404
+ mask_video = load_video("/path/to/replace/mask/video/src_mask.mp4")
405
+
406
+ replace_video = pipe(
407
+ image=image,
408
+ pose_video=pose_video,
409
+ face_video=face_video,
410
+ background_video=background_video,
411
+ mask_video=mask_video,
412
+ prompt=prompt,
413
+ mode="replace",
414
+ segment_frame_length=77, # clip_len in original code
415
+ prev_segment_conditioning_frames=1, # refert_num in original code
416
+ guidance_scale=1.0,
417
+ num_inference_steps=20,
418
+ generator=torch.Generator(device=device).manual_seed(seed),
419
+ ).frames[0]
420
+ export_to_video(replace_video, "diffusers_replace.mp4", fps=30)
421
+ ```
422
+
423
+ > 💡 If you're using **Wan-Animate**, we do not recommend using LoRA models trained on `Wan2.2`, since weight changes during training may lead to unexpected behavior.
424
+
425
+ ## Computational Efficiency on Different GPUs
426
+
427
+ We test the computational efficiency of different **Wan2.2** models on different GPUs in the following table. The results are presented in the format: **Total time (s) / peak GPU memory (GB)**.
428
+
429
+
430
+ <div align="center">
431
+ <img src="assets/comp_effic.png" alt="" style="width: 80%;" />
432
+ </div>
433
+
434
+ > The parameter settings for the tests presented in this table are as follows:
435
+ > (1) Multi-GPU: 14B: `--ulysses_size 4/8 --dit_fsdp --t5_fsdp`, 5B: `--ulysses_size 4/8 --offload_model True --convert_model_dtype --t5_cpu`; Single-GPU: 14B: `--offload_model True --convert_model_dtype`, 5B: `--offload_model True --convert_model_dtype --t5_cpu`
436
+ (--convert_model_dtype converts model parameter types to config.param_dtype);
437
+ > (2) The distributed testing utilizes the built-in FSDP and Ulysses implementations, with FlashAttention3 deployed on Hopper architecture GPUs;
438
+ > (3) Tests were run without the `--use_prompt_extend` flag;
439
+ > (4) Reported results are the average of multiple samples taken after the warm-up phase.
440
+
441
+
442
+ -------
443
+
444
+ ## Introduction of Wan2.2
445
+
446
+ **Wan2.2** builds on the foundation of Wan2.1 with notable improvements in generation quality and model capability. This upgrade is driven by a series of key technical innovations, mainly including the Mixture-of-Experts (MoE) architecture, upgraded training data, and high-compression video generation.
447
+
448
+ ##### (1) Mixture-of-Experts (MoE) Architecture
449
+
450
+ Wan2.2 introduces Mixture-of-Experts (MoE) architecture into the video generation diffusion model. MoE has been widely validated in large language models as an efficient approach to increase total model parameters while keeping inference cost nearly unchanged. In Wan2.2, the A14B model series adopts a two-expert design tailored to the denoising process of diffusion models: a high-noise expert for the early stages, focusing on overall layout; and a low-noise expert for the later stages, refining video details. Each expert model has about 14B parameters, resulting in a total of 27B parameters but only 14B active parameters per step, keeping inference computation and GPU memory nearly unchanged.
451
+
452
+ <div align="center">
453
+ <img src="assets/moe_arch.png" alt="" style="width: 90%;" />
454
+ </div>
455
+
456
+ The transition point between the two experts is determined by the signal-to-noise ratio (SNR), a metric that decreases monotonically as the denoising step $t$ increases. At the beginning of the denoising process, $t$ is large and the noise level is high, so the SNR is at its minimum, denoted as ${SNR}_{min}$. In this stage, the high-noise expert is activated. We define a threshold step ${t}_{moe}$ corresponding to half of the ${SNR}_{min}$, and switch to the low-noise expert when $t<{t}_{moe}$.
457
+
458
+ <div align="center">
459
+ <img src="assets/moe_2.png" alt="" style="width: 90%;" />
460
+ </div>
461
+
462
+ To validate the effectiveness of the MoE architecture, four settings are compared based on their validation loss curves. The baseline **Wan2.1** model does not employ the MoE architecture. Among the MoE-based variants, the **Wan2.1 & High-Noise Expert** reuses the Wan2.1 model as the low-noise expert while uses the Wan2.2's high-noise expert, while the **Wan2.1 & Low-Noise Expert** uses Wan2.1 as the high-noise expert and employ the Wan2.2's low-noise expert. The **Wan2.2 (MoE)** (our final version) achieves the lowest validation loss, indicating that its generated video distribution is closest to ground-truth and exhibits superior convergence.
463
+
464
+
465
+ ##### (2) Efficient High-Definition Hybrid TI2V
466
+ To enable more efficient deployment, Wan2.2 also explores a high-compression design. In addition to the 27B MoE models, a 5B dense model, i.e., TI2V-5B, is released. It is supported by a high-compression Wan2.2-VAE, which achieves a $T\times H\times W$ compression ratio of $4\times16\times16$, increasing the overall compression rate to 64 while maintaining high-quality video reconstruction. With an additional patchification layer, the total compression ratio of TI2V-5B reaches $4\times32\times32$. Without specific optimization, TI2V-5B can generate a 5-second 720P video in under 9 minutes on a single consumer-grade GPU, ranking among the fastest 720P@24fps video generation models. This model also natively supports both text-to-video and image-to-video tasks within a single unified framework, covering both academic research and practical applications.
467
+
468
+
469
+ <div align="center">
470
+ <img src="assets/vae.png" alt="" style="width: 80%;" />
471
+ </div>
472
+
473
+
474
+
475
+ ##### Comparisons to SOTAs
476
+ We compared Wan2.2 with leading closed-source commercial models on our new Wan-Bench 2.0, evaluating performance across multiple crucial dimensions. The results demonstrate that Wan2.2 achieves superior performance compared to these leading models.
477
+
478
+
479
+ <div align="center">
480
+ <img src="assets/performance.png" alt="" style="width: 90%;" />
481
+ </div>
482
+
483
+ ## Citation
484
+ If you find our work helpful, please cite us.
485
+
486
+ ```
487
+ @article{wan2025,
488
+ title={Wan: Open and Advanced Large-Scale Video Generative Models},
489
+ author={Team Wan and Ang Wang and Baole Ai and Bin Wen and Chaojie Mao and Chen-Wei Xie and Di Chen and Feiwu Yu and Haiming Zhao and Jianxiao Yang and Jianyuan Zeng and Jiayu Wang and Jingfeng Zhang and Jingren Zhou and Jinkai Wang and Jixuan Chen and Kai Zhu and Kang Zhao and Keyu Yan and Lianghua Huang and Mengyang Feng and Ningyi Zhang and Pandeng Li and Pingyu Wu and Ruihang Chu and Ruili Feng and Shiwei Zhang and Siyang Sun and Tao Fang and Tianxing Wang and Tianyi Gui and Tingyu Weng and Tong Shen and Wei Lin and Wei Wang and Wei Wang and Wenmeng Zhou and Wente Wang and Wenting Shen and Wenyuan Yu and Xianzhong Shi and Xiaoming Huang and Xin Xu and Yan Kou and Yangyu Lv and Yifei Li and Yijing Liu and Yiming Wang and Yingya Zhang and Yitong Huang and Yong Li and You Wu and Yu Liu and Yulin Pan and Yun Zheng and Yuntao Hong and Yupeng Shi and Yutong Feng and Zeyinzi Jiang and Zhen Han and Zhi-Fan Wu and Ziyu Liu},
490
+ journal = {arXiv preprint arXiv:2503.20314},
491
+ year={2025}
492
+ }
493
+ ```
494
+
495
+ ## License Agreement
496
+ The models in this repository are licensed under the Apache 2.0 License. We claim no rights over the your generated contents, granting you the freedom to use them while ensuring that your usage complies with the provisions of this license. You are fully accountable for your use of the models, which must not involve sharing any content that violates applicable laws, causes harm to individuals or groups, disseminates personal information intended for harm, spreads misinformation, or targets vulnerable populations. For a complete list of restrictions and details regarding your rights, please refer to the full text of the [license](LICENSE.txt).
497
+
498
+
499
+ ## Acknowledgements
500
+
501
+ We would like to thank the contributors to the [SD3](https://huggingface.co/stabilityai/stable-diffusion-3-medium), [Qwen](https://huggingface.co/Qwen), [umt5-xxl](https://huggingface.co/google/umt5-xxl), [diffusers](https://github.com/huggingface/diffusers) and [HuggingFace](https://huggingface.co) repositories, for their open research.
502
+
503
+
504
+
505
+ ## Contact Us
506
+ If you would like to leave a message to our research or product teams, feel free to join our [Discord](https://discord.gg/AKNgpMK4Yj) or [WeChat groups](https://gw.alicdn.com/imgextra/i2/O1CN01tqjWFi1ByuyehkTSB_!!6000000000015-0-tps-611-1279.jpg)!
507
+
Wan2.2_phi-noise/assets/comp_effic.png ADDED

Git LFS Details

  • SHA256: 75ee012dcfb08365bec67a3ec7afc126fc2817f79b9f80e38711792d4770e32b
  • Pointer size: 131 Bytes
  • Size of remote file: 202 kB
Wan2.2_phi-noise/assets/logo.png ADDED
Wan2.2_phi-noise/assets/moe_2.png ADDED

Git LFS Details

  • SHA256: 4ea471ccb64349bd08bc9a78f336ae000e9ca3b40da9a652b8028b214a8c6093
  • Pointer size: 131 Bytes
  • Size of remote file: 528 kB
Wan2.2_phi-noise/assets/moe_arch.png ADDED
Wan2.2_phi-noise/assets/performance.png ADDED

Git LFS Details

  • SHA256: 97ef99c13c8ae717a8a11c8d8ec927b69077c647cc6689755d08fc38e7fbb830
  • Pointer size: 131 Bytes
  • Size of remote file: 307 kB
Wan2.2_phi-noise/assets/vae.png ADDED

Git LFS Details

  • SHA256: 4aaea5e187f1c5908e15ade5bef24c9fb59882986bc3d2ad75f7fe820f3d772f
  • Pointer size: 131 Bytes
  • Size of remote file: 165 kB
Wan2.2_phi-noise/examples/Five Hundred Miles.MP3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5d969412bfe4d5e4b328d3ff92c1307fc39f7988ceba66860b5c1a17e40502d6
3
+ size 121043
Wan2.2_phi-noise/examples/Five Hundred Miles.png ADDED

Git LFS Details

  • SHA256: 5775ff7fbb162b937ec7ea2ff028cf4207d77a156720f9be822004b549ab4e98
  • Pointer size: 131 Bytes
  • Size of remote file: 878 kB
Wan2.2_phi-noise/examples/i2v_input.JPG ADDED

Git LFS Details

  • SHA256: 077e3d965090c9028c69c00931675f42e1acc815c6eb450ab291b3b72d211a8e
  • Pointer size: 131 Bytes
  • Size of remote file: 251 kB
Wan2.2_phi-noise/examples/pose.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:467b541d19625fdc42bf47f9d4db2d02cf0579f4e3a9233c543b2117dbed8a8e
3
+ size 2192979
Wan2.2_phi-noise/examples/pose.png ADDED

Git LFS Details

  • SHA256: 53a5d9b435adaf15dd8ffcab1a833b61da4a63079200fb9cec33127ee10f733b
  • Pointer size: 131 Bytes
  • Size of remote file: 823 kB
Wan2.2_phi-noise/examples/sing.MP3 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:520217a826cd078a61ff1eac7a3f8dfa55ade170d07a977d86d9bcb049d7fa59
3
+ size 300144
Wan2.2_phi-noise/examples/talk.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c8b0b80ae25baaa402853f34b24f5ba64decd67bcf9a512640d1e8b1d040824f
3
+ size 884814
Wan2.2_phi-noise/examples/wan_animate/animate/image.jpeg ADDED

Git LFS Details

  • SHA256: 8123db8e5c47c3a229c288b4c5245e8ee2ce4378b1c09e92873b75939812eb7b
  • Pointer size: 131 Bytes
  • Size of remote file: 123 kB
Wan2.2_phi-noise/examples/wan_animate/animate/video.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:80f3cfe3786a7f8a94844476448fb45e7e115216ddcdaad14b0b88223be597e7
3
+ size 903201
Wan2.2_phi-noise/examples/wan_animate/replace/image.jpeg ADDED

Git LFS Details

  • SHA256: 412591418fbb133bd46c41b3376b810bd7e3eb59b916bf9693da337a08ca1b0d
  • Pointer size: 131 Bytes
  • Size of remote file: 143 kB
Wan2.2_phi-noise/examples/wan_animate/replace/video.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db6da60e5fcb0fda0bff151bfbdbb7085d5a86a78508743cce2a25709de86a19
3
+ size 754294
Wan2.2_phi-noise/examples/zero_shot_prompt.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bd199eb7109fd6ce9943cb297e3cf350c1073af014063dfadbdc100230526243
3
+ size 111496
Wan2.2_phi-noise/generate.py ADDED
@@ -0,0 +1,728 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2024-2025 The Alibaba Wan Team Authors. All rights reserved.
2
+ import argparse
3
+ import logging
4
+ import os
5
+ import sys
6
+ import warnings
7
+ from datetime import datetime
8
+
9
+ warnings.filterwarnings('ignore')
10
+
11
+ import random
12
+
13
+ import torch
14
+ import torch.distributed as dist
15
+ from PIL import Image
16
+
17
+ import wan
18
+ from wan.configs import MAX_AREA_CONFIGS, SIZE_CONFIGS, SUPPORTED_SIZES, WAN_CONFIGS
19
+ from wan.distributed.util import init_distributed_group
20
+ from wan.utils.prompt_extend import DashScopePromptExpander, QwenPromptExpander
21
+ from wan.utils.utils import save_video, str2bool
22
+
23
+ # Phi-noise imports
24
+ from phi_noise_utils import freq_mix_spatial, freq_mix_temporal
25
+ from video_processing_utils import encode_video
26
+
27
+ EXAMPLE_PROMPT = {
28
+ "t2v-A14B": {
29
+ "prompt":
30
+ "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage.",
31
+ },
32
+ "i2v-A14B": {
33
+ "prompt":
34
+ "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard. The fluffy-furred feline gazes directly at the camera with a relaxed expression. Blurred beach scenery forms the background featuring crystal-clear waters, distant green hills, and a blue sky dotted with white clouds. The cat assumes a naturally relaxed posture, as if savoring the sea breeze and warm sunlight. A close-up shot highlights the feline's intricate details and the refreshing atmosphere of the seaside.",
35
+ "image":
36
+ "examples/i2v_input.JPG",
37
+ },
38
+ "ti2v-5B": {
39
+ "prompt":
40
+ "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage.",
41
+ },
42
+ "animate-14B": {
43
+ "prompt": "视频中的人在做动作",
44
+ "video": "",
45
+ "pose": "",
46
+ "mask": "",
47
+ },
48
+ "s2v-14B": {
49
+ "prompt":
50
+ "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard. The fluffy-furred feline gazes directly at the camera with a relaxed expression. Blurred beach scenery forms the background featuring crystal-clear waters, distant green hills, and a blue sky dotted with white clouds. The cat assumes a naturally relaxed posture, as if savoring the sea breeze and warm sunlight. A close-up shot highlights the feline's intricate details and the refreshing atmosphere of the seaside.",
51
+ "image":
52
+ "examples/i2v_input.JPG",
53
+ "audio":
54
+ "examples/talk.wav",
55
+ "tts_prompt_audio":
56
+ "examples/zero_shot_prompt.wav",
57
+ "tts_prompt_text":
58
+ "希望你以后能够做的比我还好呦。",
59
+ "tts_text":
60
+ "收到好友从远方寄来的生日礼物,那份意外的惊喜与深深的祝福让我心中充满了甜蜜的快乐,笑容如花儿般绽放。"
61
+ },
62
+ }
63
+
64
+
65
+ def _validate_args(args):
66
+ # Basic check
67
+ assert args.ckpt_dir is not None, "Please specify the checkpoint directory."
68
+ assert args.task in WAN_CONFIGS, f"Unsupport task: {args.task}"
69
+ assert args.task in EXAMPLE_PROMPT, f"Unsupport task: {args.task}"
70
+
71
+ if args.prompt is None:
72
+ args.prompt = EXAMPLE_PROMPT[args.task]["prompt"]
73
+ if args.image is None and "image" in EXAMPLE_PROMPT[args.task]:
74
+ args.image = EXAMPLE_PROMPT[args.task]["image"]
75
+ if args.audio is None and args.enable_tts is False and "audio" in EXAMPLE_PROMPT[args.task]:
76
+ args.audio = EXAMPLE_PROMPT[args.task]["audio"]
77
+ if (args.tts_prompt_audio is None or args.tts_text is None) and args.enable_tts is True and "audio" in EXAMPLE_PROMPT[args.task]:
78
+ args.tts_prompt_audio = EXAMPLE_PROMPT[args.task]["tts_prompt_audio"]
79
+ args.tts_prompt_text = EXAMPLE_PROMPT[args.task]["tts_prompt_text"]
80
+ args.tts_text = EXAMPLE_PROMPT[args.task]["tts_text"]
81
+
82
+ if args.task == "i2v-A14B":
83
+ assert args.image is not None, "Please specify the image path for i2v."
84
+
85
+ cfg = WAN_CONFIGS[args.task]
86
+
87
+ if args.sample_steps is None:
88
+ args.sample_steps = cfg.sample_steps
89
+
90
+ if args.sample_shift is None:
91
+ args.sample_shift = cfg.sample_shift
92
+
93
+ if args.sample_guide_scale is None:
94
+ args.sample_guide_scale = cfg.sample_guide_scale
95
+
96
+ if args.frame_num is None:
97
+ args.frame_num = cfg.frame_num
98
+
99
+ args.base_seed = args.base_seed if args.base_seed >= 0 else random.randint(
100
+ 0, sys.maxsize)
101
+ # Size check
102
+ if not 's2v' in args.task:
103
+ assert args.size in SUPPORTED_SIZES[
104
+ args.
105
+ task], f"Unsupport size {args.size} for task {args.task}, supported sizes are: {', '.join(SUPPORTED_SIZES[args.task])}"
106
+
107
+
108
+ def _parse_args():
109
+ parser = argparse.ArgumentParser(
110
+ description="Generate a image or video from a text prompt or image using Wan"
111
+ )
112
+ parser.add_argument(
113
+ "--task",
114
+ type=str,
115
+ default="t2v-A14B",
116
+ choices=list(WAN_CONFIGS.keys()),
117
+ help="The task to run.")
118
+ parser.add_argument(
119
+ "--size",
120
+ type=str,
121
+ default="1280*720",
122
+ choices=list(SIZE_CONFIGS.keys()),
123
+ help="The area (width*height) of the generated video. For the I2V task, the aspect ratio of the output video will follow that of the input image."
124
+ )
125
+ parser.add_argument(
126
+ "--frame_num",
127
+ type=int,
128
+ default=None,
129
+ help="How many frames of video are generated. The number should be 4n+1"
130
+ )
131
+ parser.add_argument(
132
+ "--ckpt_dir",
133
+ type=str,
134
+ default=None,
135
+ help="The path to the checkpoint directory.")
136
+ parser.add_argument(
137
+ "--offload_model",
138
+ type=str2bool,
139
+ default=None,
140
+ help="Whether to offload the model to CPU after each model forward, reducing GPU memory usage."
141
+ )
142
+ parser.add_argument(
143
+ "--ulysses_size",
144
+ type=int,
145
+ default=1,
146
+ help="The size of the ulysses parallelism in DiT.")
147
+ parser.add_argument(
148
+ "--t5_fsdp",
149
+ action="store_true",
150
+ default=False,
151
+ help="Whether to use FSDP for T5.")
152
+ parser.add_argument(
153
+ "--t5_cpu",
154
+ action="store_true",
155
+ default=False,
156
+ help="Whether to place T5 model on CPU.")
157
+ parser.add_argument(
158
+ "--dit_fsdp",
159
+ action="store_true",
160
+ default=False,
161
+ help="Whether to use FSDP for DiT.")
162
+ parser.add_argument(
163
+ "--save_file",
164
+ type=str,
165
+ default=None,
166
+ help="The file to save the generated video to.")
167
+ parser.add_argument(
168
+ "--prompt",
169
+ type=str,
170
+ default=None,
171
+ help="The prompt to generate the video from.")
172
+ parser.add_argument(
173
+ "--use_prompt_extend",
174
+ action="store_true",
175
+ default=False,
176
+ help="Whether to use prompt extend.")
177
+ parser.add_argument(
178
+ "--prompt_extend_method",
179
+ type=str,
180
+ default="local_qwen",
181
+ choices=["dashscope", "local_qwen"],
182
+ help="The prompt extend method to use.")
183
+ parser.add_argument(
184
+ "--prompt_extend_model",
185
+ type=str,
186
+ default=None,
187
+ help="The prompt extend model to use.")
188
+ parser.add_argument(
189
+ "--prompt_extend_target_lang",
190
+ type=str,
191
+ default="zh",
192
+ choices=["zh", "en"],
193
+ help="The target language of prompt extend.")
194
+ parser.add_argument(
195
+ "--base_seed",
196
+ type=int,
197
+ default=-1,
198
+ help="The seed to use for generating the video.")
199
+ parser.add_argument(
200
+ "--image",
201
+ type=str,
202
+ default=None,
203
+ help="The image to generate the video from.")
204
+ parser.add_argument(
205
+ "--sample_solver",
206
+ type=str,
207
+ default='unipc',
208
+ choices=['unipc', 'dpm++'],
209
+ help="The solver used to sample.")
210
+ parser.add_argument(
211
+ "--sample_steps", type=int, default=None, help="The sampling steps.")
212
+ parser.add_argument(
213
+ "--sample_shift",
214
+ type=float,
215
+ default=None,
216
+ help="Sampling shift factor for flow matching schedulers.")
217
+ parser.add_argument(
218
+ "--sample_guide_scale",
219
+ type=float,
220
+ default=None,
221
+ help="Classifier free guidance scale.")
222
+ parser.add_argument(
223
+ "--convert_model_dtype",
224
+ action="store_true",
225
+ default=False,
226
+ help="Whether to convert model paramerters dtype.")
227
+
228
+ # animate
229
+ parser.add_argument(
230
+ "--src_root_path",
231
+ type=str,
232
+ default=None,
233
+ help="The file of the process output path. Default None.")
234
+ parser.add_argument(
235
+ "--refert_num",
236
+ type=int,
237
+ default=77,
238
+ help="How many frames used for temporal guidance. Recommended to be 1 or 5."
239
+ )
240
+ parser.add_argument(
241
+ "--replace_flag",
242
+ action="store_true",
243
+ default=False,
244
+ help="Whether to use replace.")
245
+ parser.add_argument(
246
+ "--use_relighting_lora",
247
+ action="store_true",
248
+ default=False,
249
+ help="Whether to use relighting lora.")
250
+
251
+ # following args only works for s2v
252
+ parser.add_argument(
253
+ "--num_clip",
254
+ type=int,
255
+ default=None,
256
+ help="Number of video clips to generate, the whole video will not exceed the length of audio."
257
+ )
258
+ parser.add_argument(
259
+ "--audio",
260
+ type=str,
261
+ default=None,
262
+ help="Path to the audio file, e.g. wav, mp3")
263
+ parser.add_argument(
264
+ "--enable_tts",
265
+ action="store_true",
266
+ default=False,
267
+ help="Use CosyVoice to synthesis audio")
268
+ parser.add_argument(
269
+ "--tts_prompt_audio",
270
+ type=str,
271
+ default=None,
272
+ help="Path to the tts prompt audio file, e.g. wav, mp3. Must be greater than 16khz, and between 5s to 15s.")
273
+ parser.add_argument(
274
+ "--tts_prompt_text",
275
+ type=str,
276
+ default=None,
277
+ help="Content to the tts prompt audio. If provided, must exactly match tts_prompt_audio")
278
+ parser.add_argument(
279
+ "--tts_text",
280
+ type=str,
281
+ default=None,
282
+ help="Text wish to synthesize")
283
+ parser.add_argument(
284
+ "--pose_video",
285
+ type=str,
286
+ default=None,
287
+ help="Provide Dw-pose sequence to do Pose Driven")
288
+ parser.add_argument(
289
+ "--start_from_ref",
290
+ action="store_true",
291
+ default=False,
292
+ help="whether set the reference image as the starting point for generation"
293
+ )
294
+ parser.add_argument(
295
+ "--infer_frames",
296
+ type=int,
297
+ default=80,
298
+ help="Number of frames per clip, 48 or 80 or others (must be multiple of 4) for 14B s2v"
299
+ )
300
+
301
+ ######################
302
+ # Phi-Noise args #
303
+ ######################
304
+
305
+ parser.add_argument(
306
+ "--pn_task",
307
+ type=str,
308
+ default='i2v_mt',
309
+ choices=['i2v_mt', 't2v_mt', 'cnd'],
310
+ help="The specific task for applying Phi-Noise. `i2v_mt` means applying Phi-Noise on I2V model for motion transfer, `t2v_mt` means applying Phi-Noise on T2V model for motion transfer, and `cud` means applying cut-n-drag"
311
+ )
312
+
313
+
314
+ parser.add_argument(
315
+ "--pn_ref_path",
316
+ type=str,
317
+ default=None,
318
+ help="gudance video for frequency mix, should be preprocessed by `preprocess_guidance_video.py` to align the size and frame number with the generation target. Only used for ti2v task."
319
+ )
320
+ parser.add_argument(
321
+ "--pn_alpha",
322
+ type=str,
323
+ default=None,
324
+ help="how much of low-frequency to mix"
325
+ )
326
+ parser.add_argument(
327
+ "--pn_gamma",
328
+ type=str,
329
+ default=None,
330
+ help="Division factor of low-frequency before mixing (SPATIAL)"
331
+ )
332
+
333
+ args = parser.parse_args()
334
+ _validate_args(args)
335
+
336
+ return args
337
+
338
+
339
+ def _init_logging(rank):
340
+ # logging
341
+ if rank == 0:
342
+ # set format
343
+ logging.basicConfig(
344
+ level=logging.INFO,
345
+ format="[%(asctime)s] %(levelname)s: %(message)s",
346
+ handlers=[logging.StreamHandler(stream=sys.stdout)])
347
+ else:
348
+ logging.basicConfig(level=logging.ERROR)
349
+
350
+
351
+ def generate(args):
352
+ rank = int(os.getenv("RANK", 0))
353
+ world_size = int(os.getenv("WORLD_SIZE", 1))
354
+ local_rank = int(os.getenv("LOCAL_RANK", 0))
355
+ device = local_rank
356
+ _init_logging(rank)
357
+
358
+ if '#' in args.pn_alpha:
359
+ pn_alpha = [float(x) for x in args.pn_alpha.split('#')]
360
+ else:
361
+ pn_alpha = float(args.pn_alpha)
362
+ if '#' in args.pn_gamma:
363
+ pn_gamma = [float(x) for x in args.pn_gamma.split('#')]
364
+ else:
365
+ pn_gamma = float(args.pn_gamma)
366
+
367
+ if isinstance(pn_gamma, list):
368
+ pn_alpha = [pn_alpha] * len(pn_gamma)
369
+ elif isinstance(pn_alpha, list):
370
+ pn_gamma = [pn_gamma] * len(pn_alpha)
371
+
372
+ if args.offload_model is None:
373
+ args.offload_model = False if world_size > 1 else True
374
+ logging.info(
375
+ f"offload_model is not specified, set to {args.offload_model}.")
376
+ if world_size > 1:
377
+ torch.cuda.set_device(local_rank)
378
+ dist.init_process_group(
379
+ backend="nccl",
380
+ init_method="env://",
381
+ rank=rank,
382
+ world_size=world_size)
383
+ else:
384
+ assert not (
385
+ args.t5_fsdp or args.dit_fsdp
386
+ ), f"t5_fsdp and dit_fsdp are not supported in non-distributed environments."
387
+ assert not (
388
+ args.ulysses_size > 1
389
+ ), f"sequence parallel are not supported in non-distributed environments."
390
+
391
+ if args.ulysses_size > 1:
392
+ assert args.ulysses_size == world_size, f"The number of ulysses_size should be equal to the world size."
393
+ init_distributed_group()
394
+
395
+ if args.use_prompt_extend:
396
+ if args.prompt_extend_method == "dashscope":
397
+ prompt_expander = DashScopePromptExpander(
398
+ model_name=args.prompt_extend_model,
399
+ task=args.task,
400
+ is_vl=args.image is not None)
401
+ elif args.prompt_extend_method == "local_qwen":
402
+ prompt_expander = QwenPromptExpander(
403
+ model_name=args.prompt_extend_model,
404
+ task=args.task,
405
+ is_vl=args.image is not None,
406
+ device=rank)
407
+ else:
408
+ raise NotImplementedError(
409
+ f"Unsupport prompt_extend_method: {args.prompt_extend_method}")
410
+
411
+ cfg = WAN_CONFIGS[args.task]
412
+ if args.ulysses_size > 1:
413
+ assert cfg.num_heads % args.ulysses_size == 0, f"`{cfg.num_heads=}` cannot be divided evenly by `{args.ulysses_size=}`."
414
+
415
+ logging.info(f"Generation job args: {args}")
416
+ logging.info(f"Generation model config: {cfg}")
417
+
418
+ if dist.is_initialized():
419
+ base_seed = [args.base_seed] if rank == 0 else [None]
420
+ dist.broadcast_object_list(base_seed, src=0)
421
+ args.base_seed = base_seed[0]
422
+
423
+ logging.info(f"Input prompt: {args.prompt}")
424
+ img = None
425
+ if args.image is not None:
426
+ img = Image.open(args.image).convert("RGB").resize(SIZE_CONFIGS[args.size])
427
+ logging.info(f"Input image: {args.image}")
428
+
429
+ if args.pn_ref_path is not None:
430
+ logging.info(f"Phi-Noise reference video: {args.pn_ref_path}")
431
+
432
+ # prompt extend
433
+ if args.use_prompt_extend:
434
+ logging.info("Extending prompt ...")
435
+ if rank == 0:
436
+ prompt_output = prompt_expander(
437
+ args.prompt,
438
+ image=img,
439
+ tar_lang=args.prompt_extend_target_lang,
440
+ seed=args.base_seed)
441
+ if prompt_output.status == False:
442
+ logging.info(
443
+ f"Extending prompt failed: {prompt_output.message}")
444
+ logging.info("Falling back to original prompt.")
445
+ input_prompt = args.prompt
446
+ else:
447
+ input_prompt = prompt_output.prompt
448
+ input_prompt = [input_prompt]
449
+ else:
450
+ input_prompt = [None]
451
+ if dist.is_initialized():
452
+ dist.broadcast_object_list(input_prompt, src=0)
453
+ args.prompt = input_prompt[0]
454
+ logging.info(f"Extended prompt: {args.prompt}")
455
+
456
+ if "t2v" in args.task:
457
+ logging.info("Creating WanT2V pipeline.")
458
+ wan_t2v = wan.WanT2V(
459
+ config=cfg,
460
+ checkpoint_dir=args.ckpt_dir,
461
+ device_id=device,
462
+ rank=rank,
463
+ t5_fsdp=args.t5_fsdp,
464
+ dit_fsdp=args.dit_fsdp,
465
+ use_sp=(args.ulysses_size > 1),
466
+ t5_cpu=args.t5_cpu,
467
+ convert_model_dtype=args.convert_model_dtype,
468
+ )
469
+
470
+ for i, (_gamma, _alpha) in enumerate(zip(pn_gamma, pn_alpha)):
471
+ seed_generator = torch.Generator(device=device).manual_seed(args.base_seed + i)
472
+ logging.info(f'Current Seed: {args.base_seed + i}')
473
+
474
+ ######### Phi-Noise generation #########
475
+ if args.pn_ref_path is not None:
476
+ latents_ref, _ = encode_video(args.pn_ref_path, target_size=(832, 464), vae_enc=wan_t2v.vae)
477
+ noise = [torch.randn(*latents_ref[0].shape, dtype=torch.float32, device=wan_t2v.device, generator=seed_generator)]
478
+
479
+ if args.pn_task in ['i2v_mt', 'cnd']:
480
+ latents = freq_mix_temporal(noise, latents_ref,
481
+ gamma=_gamma,
482
+ alpha=_alpha,
483
+ exclude_dc=False)
484
+ elif args.pn_task == 't2v_mt':
485
+ latents = [freq_mix_spatial(noise[0].type(torch.float),
486
+ latents_ref[0].type(torch.float),
487
+ alpha=_alpha,
488
+ gamma=_gamma,
489
+ dims=("h", "w")).type(torch.float)]
490
+
491
+ logging.info(f"Phi-Noise generation parameters:\n\tgamma={_gamma}\n\talpha={_alpha}")
492
+ else:
493
+ latents = None
494
+ #################################
495
+
496
+ logging.info(f"Generating video ...")
497
+ video = wan_t2v.generate(
498
+ args.prompt,
499
+ n_prompt='camera movement, panning, zooming, tracking, dolly, shaky cam, camera rotation, tilting, crane shot, background drift, motion blur',
500
+ size=SIZE_CONFIGS[args.size],
501
+ frame_num=args.frame_num,
502
+ shift=args.sample_shift,
503
+ sample_solver=args.sample_solver,
504
+ sampling_steps=args.sample_steps,
505
+ guide_scale=args.sample_guide_scale,
506
+ seed=args.base_seed,
507
+ latents=latents,
508
+ offload_model=args.offload_model)
509
+
510
+ if rank == 0:
511
+ save_generated_video(video, sample_fps=cfg.sample_fps, prompt=args.prompt, args=args)
512
+ del video
513
+ torch.cuda.synchronize()
514
+
515
+ elif "ti2v" in args.task:
516
+ logging.info("Creating WanTI2V pipeline.")
517
+ wan_ti2v = wan.WanTI2V(
518
+ config=cfg,
519
+ checkpoint_dir=args.ckpt_dir,
520
+ device_id=device,
521
+ rank=rank,
522
+ t5_fsdp=args.t5_fsdp,
523
+ dit_fsdp=args.dit_fsdp,
524
+ use_sp=(args.ulysses_size > 1),
525
+ t5_cpu=args.t5_cpu,
526
+ convert_model_dtype=args.convert_model_dtype,
527
+ )
528
+
529
+ for i, (_alpha, _gamma) in enumerate(zip(pn_alpha, pn_gamma)):
530
+ seed_generator = torch.Generator(device=device).manual_seed(args.base_seed + i)
531
+
532
+ ######### Phi-Noise generation #########
533
+ if args.pn_ref_path is not None:
534
+ latents_ref, _ = encode_video(args.pn_ref_path, target_size=(1280, 704), vae_enc=wan_ti2v.vae)
535
+ noise = [torch.randn(*latents_ref[0].shape, dtype=torch.float32, device=wan_ti2v.device, generator=seed_generator)]
536
+
537
+ if args.pn_task in ['i2v_mt', 'cnd']:
538
+ latents = freq_mix_temporal(noise, latents_ref,
539
+ gamma=_gamma,
540
+ alpha=_alpha,
541
+ exclude_dc=False)
542
+ elif args.pn_task == 't2v_mt':
543
+ latents = [freq_mix_spatial(noise[0].type(torch.float),
544
+ latents_ref[0].type(torch.float),
545
+ alpha=_alpha,
546
+ gamma=_gamma,
547
+ dims=("h", "w")).type(torch.float)]
548
+
549
+ logging.info(f"Phi-Noise generation parameters:\n\tgamma={_gamma}\n\talpha={_alpha}")
550
+ else:
551
+ latents = None
552
+ #################################
553
+
554
+
555
+ video = wan_ti2v.generate(
556
+ args.prompt,
557
+ img=img,
558
+ n_prompt='camera movement, panning, zooming, tracking, dolly, shaky cam, camera rotation, tilting, crane shot, background drift, motion blur',
559
+ size=SIZE_CONFIGS[args.size],
560
+ max_area=MAX_AREA_CONFIGS[args.size],
561
+ frame_num=args.frame_num,
562
+ shift=args.sample_shift,
563
+ sample_solver=args.sample_solver,
564
+ sampling_steps=args.sample_steps,
565
+ guide_scale=args.sample_guide_scale,
566
+ seed=args.base_seed,
567
+ latents=latents,
568
+ offload_model=args.offload_model)
569
+
570
+ if rank == 0:
571
+ save_generated_video(video, sample_fps=cfg.sample_fps, prompt=args.prompt, args=args)
572
+ del video
573
+ torch.cuda.synchronize()
574
+
575
+ elif "animate" in args.task:
576
+ logging.info("Creating Wan-Animate pipeline.")
577
+ wan_animate = wan.WanAnimate(
578
+ config=cfg,
579
+ checkpoint_dir=args.ckpt_dir,
580
+ device_id=device,
581
+ rank=rank,
582
+ t5_fsdp=args.t5_fsdp,
583
+ dit_fsdp=args.dit_fsdp,
584
+ use_sp=(args.ulysses_size > 1),
585
+ t5_cpu=args.t5_cpu,
586
+ convert_model_dtype=args.convert_model_dtype,
587
+ use_relighting_lora=args.use_relighting_lora
588
+ )
589
+
590
+ logging.info(f"Generating video ...")
591
+ video = wan_animate.generate(
592
+ src_root_path=args.src_root_path,
593
+ replace_flag=args.replace_flag,
594
+ refert_num = args.refert_num,
595
+ clip_len=args.frame_num,
596
+ shift=args.sample_shift,
597
+ sample_solver=args.sample_solver,
598
+ sampling_steps=args.sample_steps,
599
+ guide_scale=args.sample_guide_scale,
600
+ seed=args.base_seed,
601
+ offload_model=args.offload_model)
602
+ elif "s2v" in args.task:
603
+ logging.info("Creating WanS2V pipeline.")
604
+ wan_s2v = wan.WanS2V(
605
+ config=cfg,
606
+ checkpoint_dir=args.ckpt_dir,
607
+ device_id=device,
608
+ rank=rank,
609
+ t5_fsdp=args.t5_fsdp,
610
+ dit_fsdp=args.dit_fsdp,
611
+ use_sp=(args.ulysses_size > 1),
612
+ t5_cpu=args.t5_cpu,
613
+ convert_model_dtype=args.convert_model_dtype,
614
+ )
615
+ logging.info(f"Generating video ...")
616
+ video = wan_s2v.generate(
617
+ input_prompt=args.prompt,
618
+ ref_image_path=args.image,
619
+ audio_path=args.audio,
620
+ enable_tts=args.enable_tts,
621
+ tts_prompt_audio=args.tts_prompt_audio,
622
+ tts_prompt_text=args.tts_prompt_text,
623
+ tts_text=args.tts_text,
624
+ num_repeat=args.num_clip,
625
+ pose_video=args.pose_video,
626
+ max_area=MAX_AREA_CONFIGS[args.size],
627
+ infer_frames=args.infer_frames,
628
+ shift=args.sample_shift,
629
+ sample_solver=args.sample_solver,
630
+ sampling_steps=args.sample_steps,
631
+ guide_scale=args.sample_guide_scale,
632
+ seed=args.base_seed,
633
+ offload_model=args.offload_model,
634
+ init_first_frame=args.start_from_ref,
635
+ )
636
+ else:
637
+ logging.info("Creating WanI2V pipeline.")
638
+ wan_i2v = wan.WanI2V(
639
+ config=cfg,
640
+ checkpoint_dir=args.ckpt_dir,
641
+ device_id=device,
642
+ rank=rank,
643
+ t5_fsdp=args.t5_fsdp,
644
+ dit_fsdp=args.dit_fsdp,
645
+ use_sp=(args.ulysses_size > 1),
646
+ t5_cpu=args.t5_cpu,
647
+ convert_model_dtype=args.convert_model_dtype,
648
+ )
649
+ for i, (_alpha, _gamma) in enumerate(zip(pn_alpha, pn_gamma)):
650
+ seed_generator = torch.Generator(device=wan_i2v.device).manual_seed(args.base_seed + i)
651
+
652
+ ######### Phi-Noise generation #########
653
+ if args.pn_ref_path is not None:
654
+ latents_ref, _ = encode_video(args.pn_ref_path, target_size=(832, 464), vae_enc=wan_i2v.vae)
655
+ noise = [torch.randn(*latents_ref[0].shape, dtype=torch.float32, device=wan_i2v.device, generator=seed_generator)]
656
+
657
+ if args.pn_task in ['i2v_mt', 'cnd']:
658
+ latents = freq_mix_temporal(noise, latents_ref,
659
+ gamma=_gamma,
660
+ alpha=_alpha,
661
+ exclude_dc=False)
662
+ elif args.pn_task == 't2v_mt':
663
+ latents = [freq_mix_spatial(noise[0].type(torch.float),
664
+ latents_ref[0].type(torch.float),
665
+ alpha=_alpha,
666
+ gamma=_gamma,
667
+ dims=("h", "w")).type(torch.float)]
668
+ logging.info(f"Phi-Noise generation parameters:\n\tgamma={_gamma}\n\talpha={_alpha}")
669
+ else:
670
+ latents = None
671
+ #################################
672
+
673
+ logging.info("Generating video ...")
674
+ video = wan_i2v.generate(
675
+ args.prompt,
676
+ img,
677
+ max_area=MAX_AREA_CONFIGS[args.size],
678
+ frame_num=args.frame_num,
679
+ shift=args.sample_shift,
680
+ sample_solver=args.sample_solver,
681
+ sampling_steps=args.sample_steps,
682
+ guide_scale=args.sample_guide_scale,
683
+ seed=args.base_seed,
684
+ latents=latents,
685
+ offload_model=args.offload_model)
686
+
687
+ if rank == 0:
688
+ save_generated_video(video, sample_fps=cfg.sample_fps, args=args, prompt=args.prompt)
689
+ del video
690
+
691
+ torch.cuda.synchronize()
692
+ if dist.is_initialized():
693
+ dist.barrier()
694
+ dist.destroy_process_group()
695
+
696
+ logging.info("Finished.")
697
+
698
+
699
+ def save_generated_video(video, sample_fps, prompt, args):
700
+ if args.save_file is None:
701
+ formatted_time = datetime.now().strftime("%Y%m%d_%H%M%S")
702
+ formatted_prompt = prompt.replace(" ", "_").replace("/", "_")[:50]
703
+ suffix = '.mp4'
704
+ if not os.path.exists('OUTPUTS'):
705
+ os.makedirs('OUTPUTS', exist_ok=True)
706
+ save_file = f"OUTPUTS/{args.task}_{args.size.replace('*','x') if sys.platform=='win32' else args.size}_{args.ulysses_size}_{formatted_prompt}_{formatted_time}" + suffix
707
+ if os.path.exists(save_file):
708
+ save_file = args.save_file.replace(suffix, f"_{random.randint(0, 9999)}{suffix}")
709
+ logging.info(f"Saving generated video to {save_file}")
710
+ save_video(
711
+ tensor=video[None],
712
+ save_file=save_file,
713
+ fps=sample_fps,
714
+ nrow=1,
715
+ normalize=True,
716
+ value_range=(-1, 1))
717
+
718
+ # irrelevant
719
+ # if "s2v" in args.task:
720
+ # if args.enable_tts is False:
721
+ # merge_video_audio(video_path=args.save_file, audio_path=args.audio)
722
+ # else:
723
+ # merge_video_audio(video_path=args.save_file, audio_path="tts.wav")
724
+
725
+
726
+ if __name__ == "__main__":
727
+ args = _parse_args()
728
+ generate(args)
Wan2.2_phi-noise/pyproject.toml ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "wan"
7
+ version = "2.2.0"
8
+ description = "Wan: Open and Advanced Large-Scale Video Generative Models"
9
+ authors = [
10
+ { name = "Wan Team", email = "wan.ai@alibabacloud.com" }
11
+ ]
12
+ license = { file = "LICENSE.txt" }
13
+ readme = "README.md"
14
+ requires-python = ">=3.10,<4.0"
15
+ dependencies = [
16
+ "torch>=2.4.0",
17
+ "torchvision>=0.19.0",
18
+ "opencv-python>=4.9.0.80",
19
+ "diffusers>=0.31.0",
20
+ "transformers>=4.49.0",
21
+ "tokenizers>=0.20.3",
22
+ "accelerate>=1.1.1",
23
+ "tqdm",
24
+ "imageio",
25
+ "easydict",
26
+ "ftfy",
27
+ "dashscope",
28
+ "imageio-ffmpeg",
29
+ "flash_attn",
30
+ "numpy>=1.23.5,<2"
31
+ ]
32
+
33
+ [project.optional-dependencies]
34
+ dev = [
35
+ "pytest",
36
+ "black",
37
+ "flake8",
38
+ "isort",
39
+ "mypy",
40
+ "huggingface-hub[cli]"
41
+ ]
42
+
43
+ [project.urls]
44
+ homepage = "https://wanxai.com"
45
+ documentation = "https://github.com/Wan-Video/Wan2.2"
46
+ repository = "https://github.com/Wan-Video/Wan2.2"
47
+ huggingface = "https://huggingface.co/Wan-AI/"
48
+ modelscope = "https://modelscope.cn/organization/Wan-AI"
49
+ discord = "https://discord.gg/p5XbdQV7"
50
+
51
+ [tool.setuptools]
52
+ packages = ["wan"]
53
+
54
+ [tool.setuptools.package-data]
55
+ "wan" = ["**/*.py"]
56
+
57
+ [tool.black]
58
+ line-length = 88
59
+
60
+ [tool.isort]
61
+ profile = "black"
62
+
63
+ [tool.mypy]
64
+ strict = true
65
+
66
+
Wan2.2_phi-noise/requirements.txt ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ torch>=2.4.0
2
+ torchvision>=0.19.0
3
+ torchaudio
4
+ opencv-python>=4.9.0.80
5
+ diffusers>=0.31.0
6
+ transformers>=4.49.0,<=4.51.3
7
+ tokenizers>=0.20.3
8
+ accelerate>=1.1.1
9
+ tqdm
10
+ imageio[ffmpeg]
11
+ easydict
12
+ ftfy
13
+ dashscope
14
+ imageio-ffmpeg
15
+ flash_attn
16
+ numpy>=1.23.5,<2