Skip to content
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,7 @@ time_cost.json
costtime.json
batch_eval.txt
*.log

# README comparison assets intentionally included in the PR
!assets/wan21_comparison/
!assets/wan21_comparison/*.mp4
114 changes: 96 additions & 18 deletions NaviCache4Wan2.1/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# NaviCache for Wan2.1

NaviCache is a training-free test-time self-calibration caching method for accelerating video diffusion models. This directory provides the NaviCache generation script for [Wan2.1](https://github.com/Wan-Video/Wan2.1).
NaviCache is a training-free, test-time self-calibration caching method for accelerating [Wan2.1](https://github.com/Wan-Video/Wan2.1) text-to-video and image-to-video generation.

## Usage

Follow [Wan2.1](https://github.com/Wan-Video/Wan2.1) to clone the repo, finish the installation, and download the required model weights. Then copy `navicache_generate.py` in this repo to the Wan2.1 repo.
Install Wan2.1 following the [official repository](https://github.com/Wan-Video/Wan2.1), then copy the NaviCache integration script into the Wan2.1 repository:

```bash
git clone https://github.com/Wan-Video/Wan2.1.git
Expand All @@ -14,11 +14,7 @@ cp NaviCache/NaviCache4Wan2.1/navicache_generate.py Wan2.1/
cd Wan2.1
```

Please make sure that `--ckpt_dir` points to the matching Wan2.1 checkpoint directory. The T2V-14B and T2V-1.3B models use different weights. The I2V 480P and I2V 720P models also use different weights.

## Text-to-Video

For T2V with the 1.3B model:
### T2V 1.3B, 832x480

```bash
python navicache_generate.py \
Expand All @@ -27,12 +23,13 @@ python navicache_generate.py \
--ckpt_dir ./Wan2.1-T2V-1.3B \
--offload_model True \
--t5_cpu \
--base_seed 42 \
--navicache_thresh 0.05 \
--navicache_align_steps 10 \
--prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage."
--prompt "A boat sailing leisurely along the Seine River with the Eiffel Tower in background, zoom out"
```

For T2V with the 14B model:
### T2V 14B, 1280x720

```bash
python navicache_generate.py \
Expand All @@ -41,14 +38,13 @@ python navicache_generate.py \
--ckpt_dir ./Wan2.1-T2V-14B \
--offload_model True \
--t5_cpu \
--base_seed 42 \
--navicache_thresh 0.05 \
--navicache_align_steps 10 \
--prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage."
--prompt "A person is skateboarding"
```

## Image-to-Video

For I2V with the 480P model:
### I2V 14B, 832x480

```bash
python navicache_generate.py \
Expand All @@ -58,28 +54,110 @@ python navicache_generate.py \
--image examples/i2v_input.JPG \
--offload_model True \
--t5_cpu \
--base_seed 42 \
--navicache_thresh 0.05 \
--navicache_align_steps 10 \
--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."
--prompt "A beautiful coastal beach in spring, waves lapping on sand by Hokusai, in the style of Ukiyo"
```

For I2V with the 720P model:
### I2V 14B, 1280x720

```bash
python navicache_generate.py \
--task i2v-14B \
--size 1280*720 \
--ckpt_dir ./Wan2.1-I2V-14B-720P \
--image examples/i2v_input.JPG \
--frame_num 61 \
--offload_model True \
--t5_cpu \
--base_seed 42 \
--navicache_thresh 0.05 \
--navicache_align_steps 10 \
--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."
--prompt "an orange cat"
```

The I2V commands use the sample image included in Wan2.1 at `examples/i2v_input.JPG`; replace it with your own input image as needed.Generated files are written to `outputs/` unless `--save_file` is specified. Generation timing records are appended to `output/time_cost.json` by default. Use `--out_dir` to choose another timing-output directory.
## Results

### Inference Latency Comparison

| Wan2.1 configuration | Resolution | Wan2.1 | TeaCache | TeaCache speedup | NaviCache | NaviCache speedup |
|:---------------------|:----------:|:-------------------:|:----------------------------:|:----------------:|:----------------------:|:-----------------:|
| T2V 1.3B | 832x480 | 488.0 s | 209.5 s | 2.33x | 160.1 s | 3.05x |
| T2V 14B | 1280x720 | 3528.1 s | 1784.2 s | 1.98x | 1361.1 s | 2.59x |
| I2V 14B 480P | 832x480 | 825.9 s | 604.4 s | 1.37x | 481.4 s | 1.72x |
| I2V 14B 720P | 1280x720 | 1887.2 s | 1296.2 s | 1.46x | 1007.9 s | 1.87x |

### Visual Quality Comparison

#### T2V 1.3B, 832x480

<div align="center">
<video src="../assets/wan21_comparison/t2v13b480_boat_comparison.mp4" width="936" controls muted loop></video>
</div>

| Wan2.1 | TeaCache | NaviCache |
|:------:|:--------:|:---------:|
| 488.0 s (1.00x) | 209.5 s (2.33x) | **160.1 s (3.05x)** |

<details>
<summary>Prompt: A boat sailing leisurely along the Seine River with the Eiffel Tower in background, zoom out</summary>

A boat sailing leisurely along the Seine River with the Eiffel Tower in background, zoom out

</details>

#### T2V 14B, 1280x720

<div align="center">
<video src="../assets/wan21_comparison/t2v14b720_skateboarding_comparison.mp4" width="960" controls muted loop></video>
</div>

| Wan2.1 | TeaCache | NaviCache |
|:------:|:--------:|:---------:|
| 3528.1 s (1.00x) | 1784.2 s (1.98x) | **1361.1 s (2.59x)** |

<details>
<summary>Prompt: A person is skateboarding</summary>

A person is skateboarding

</details>

#### I2V 14B, 832x480

<div align="center">
<video src="../assets/wan21_comparison/i2v14b480_ribbon_dancer_comparison.mp4" width="936" controls muted loop></video>
</div>

| Wan2.1 | TeaCache | NaviCache |
|:------:|:--------:|:---------:|
| 825.9 s (1.00x) | 604.4 s (1.37x) | **481.4 s (1.72x)** |

<details>
<summary>Prompt</summary>

The ribbon dancer spins rapidly across the courtyard, both red silk ribbons tracing wide fluid arcs as her layered costume billows; the camera tracks sideways with strong natural background parallax.

</details>

#### I2V 14B, 1280x720

<div align="center">
<video src="../assets/wan21_comparison/i2v14b720_clockwork_hummingbird_comparison.mp4" width="960" controls muted loop></video>
</div>

| Wan2.1 | TeaCache | NaviCache |
|:------:|:--------:|:---------:|
| 1887.2 s (1.00x) | 1296.2 s (1.46x) | **1007.9 s (1.87x)** |

<details>
<summary>Prompt</summary>

The clockwork hummingbird beats both articulated wings rapidly and flies from one red flower to the next; tiny gears turn visibly while the camera arcs around it through the greenhouse with deep parallax.

</details>

## Acknowledgements

We would like to thank the contributors to [Wan2.1](https://github.com/Wan-Video/Wan2.1).
We would like to thank the contributors to [Wan2.1](https://github.com/Wan-Video/Wan2.1), [TeaCache](https://github.com/ali-vilab/TeaCache), [EasyCache](https://github.com/H-EmbodVis/EasyCache), and [MagCache](https://github.com/Zehong-Ma/MagCache).
66 changes: 66 additions & 0 deletions NaviCache4Wan2.2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# NaviCache for Wan2.2

NaviCache is a training-free test-time self-calibration caching method for accelerating video diffusion models. This directory provides the NaviCache generation script for [Wan2.2](https://github.com/Wan-Video/Wan2.2).

## Usage

Follow the official [Wan2.2](https://github.com/Wan-Video/Wan2.2) instructions to clone the repository, install the required environment, and download the Wan2.2-TI2V-5B model weights. NaviCache requires no training or offline calibration. From the directory containing the cloned `Wan2.2` repository, copy `navicache_generate.py` to its root:

```bash
git clone https://github.com/HelloZicky/NaviCache.git

cp NaviCache/NaviCache4Wan2.2/navicache_generate.py Wan2.2/
cd Wan2.2
mkdir -p outputs
```

Make sure that `--ckpt_dir` points to the downloaded Wan2.2-TI2V-5B checkpoint directory. Once the official environment and weights are ready, run either of the following commands to generate videos with NaviCache.

## Text-to-Video

Run Wan2.2-TI2V-5B without an input image:

```bash
python navicache_generate.py \
--task ti2v-5B \
--size 1280*704 \
--frame_num 121 \
--ckpt_dir ./Wan2.2-TI2V-5B \
--offload_model True \
--convert_model_dtype \
--t5_cpu \
--navicache_thresh 0.05 \
--navicache_align_steps 10 \
--navicache_process_noise 0.05 \
--navicache_measurement_noise 0.05 \
--prompt "Two anthropomorphic cats in comfy boxing gear and bright gloves fight intensely on a spotlighted stage." \
--save_file ./outputs/wan22_t2v_navicache.mp4
```

## Image-to-Video

Pass an input image to the same TI2V checkpoint with `--image`:

```bash
python navicache_generate.py \
--task ti2v-5B \
--size 1280*704 \
--frame_num 121 \
--ckpt_dir ./Wan2.2-TI2V-5B \
--image examples/i2v_input.JPG \
--offload_model True \
--convert_model_dtype \
--t5_cpu \
--navicache_thresh 0.05 \
--navicache_align_steps 10 \
--navicache_process_noise 0.05 \
--navicache_measurement_noise 0.05 \
--prompt "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard at a sunny beach." \
--save_file ./outputs/wan22_i2v_navicache.mp4
```

The command uses the sample image included in Wan2.2 at `examples/i2v_input.JPG`; replace it with your own input image as needed. Generated videos are written to the path provided by `--save_file`.

## Acknowledgements

We would like to thank the contributors to [Wan2.2](https://github.com/Wan-Video/Wan2.2).
Loading