TeaCache can speedup Wan2.1 2x without much visual quality degradation, in a training-free manner. The following video shows the results generated by TeaCache-Wan2.1 with various teacache_thresh values. The corresponding teacache_thresh values are shown in the following table.
t2v-1.3B_832_480.mp4
t2v-14B_1280_720.mp4
i2v-14B_832_480.mp4
i2v-14B_1280_720.mp4
Wan2.1 t2v 1.3B | TeaCache (0.05) | TeaCache (0.07) | TeaCache (0.08) |
---|---|---|---|
~175 s | ~117 s | ~110 s | ~88 s |
Wan2.1 t2v 14B | TeaCache (0.14) | TeaCache (0.15) | TeaCache (0.2) |
---|---|---|---|
~55 min | ~38 min | ~30 min | ~27 min |
Wan2.1 i2v 480P | TeaCache (0.13) | TeaCache (0.19) | TeaCache (0.26) |
---|---|---|---|
~735 s | ~464 s | ~372 s | ~300 s |
Wan2.1 i2v 720P | TeaCache (0.18) | TeaCache (0.2) | TeaCache (0.3) |
---|---|---|---|
~29 min | ~17 min | ~15 min | ~12 min |
Follow Wan2.1 to clone the repo and finish the installation, then copy 'teacache_generate.py' in this repo to the Wan2.1 repo.
For T2V with 1.3B model, you can use the following command:
python teacache_generate.py --task t2v-1.3B --size 832*480 --ckpt_dir ./Wan2.1-T2V-1.3B --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." --base_seed 42 --offload_model True --t5_cpu --teacache_thresh 0.08
For T2V with 14B model, you can use the following command:
python teacache_generate.py --task t2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-T2V-14B --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." --base_seed 42 --offload_model True --t5_cpu --teacache_thresh 0.2
For I2V with 480P resolution, you can use the following command:
python teacache_generate.py --task i2v-14B --size 832*480 --ckpt_dir ./Wan2.1-I2V-14B-480P --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." --base_seed 42 --offload_model True --t5_cpu --teacache_thresh 0.26
For I2V with 720P resolution, you can use the following command:
python teacache_generate.py --task i2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-I2V-14B-720P --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." --base_seed 42 --offload_model True --t5_cpu --frame_num 61 --teacache_thresh 0.3
Using Retention Steps will result in faster generation speed and better generation quality (except for t2v-1.3B).
want2v1.3b.mp4
want2v14b.mp4
wani2v480p.mp4
wani2v720p.mp4
use_ref_steps | Wan2.1 t2v 1.3B (thresh) | Slow (thresh) | Fast (thresh) |
---|---|---|---|
False | ~97 s (0.00) | ~64 s (0.05) | ~49 s (0.08) |
True | ~97 s (0.00) | ~61 s (0.05) | ~41 s (0.10) |
use_ref_steps | Wan2.1 t2v 14B (thresh) | Slow (thresh) | Fast (thresh) |
---|---|---|---|
False | ~1829 s (0.00) | ~1234 s (0.14) | ~909 s (0.20) |
True | ~1829 s (0.00) | ~915 s (0.10) | ~578 s (0.20) |
use_ref_steps | Wan2.1 i2v 480p (thresh) | Slow (thresh) | Fast (thresh) |
---|---|---|---|
False | ~385 s (0.00) | ~241 s (0.13) | ~156 s (0.26) |
True | ~385 s (0.00) | ~212 s (0.20) | ~164 s (0.30) |
use_ref_steps | Wan2.1 i2v 720p (thresh) | Slow (thresh) | Fast (thresh) |
---|---|---|---|
False | ~903 s (0.00) | ~476 s (0.20) | ~363 s (0.30) |
True | ~903 s (0.00) | ~430 s (0.20) | ~340 s (0.30) |
You can refer to the previous video generation instructions and use the use_ret_steps
parameter to speed up the video generation process, achieving results closer to Wan2.1. Simply add the --use_ret_steps
parameter to the original command and adjust the --teacache_thresh
parameter to achieve more efficient video generation. The value of the --teacache_thresh
parameter can be referenced from the table, allowing you to choose the appropriate value based on different models and settings.
python teacache_generate.py --task t2v-14B --size 1280*720 --ckpt_dir ./Wan2.1-T2V-14B --prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." --base_seed 42 --offload_model True --t5_cpu --teacache_thresh 0.3 --use_ret_steps
We would like to thank the contributors to the Wan2.1.