cache-dit 0.2.0__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cache_dit-0.2.0 → cache_dit-0.2.1}/PKG-INFO +30 -11
- {cache_dit-0.2.0 → cache_dit-0.2.1}/README.md +29 -10
- {cache_dit-0.2.0 → cache_dit-0.2.1}/examples/run_hunyuan_video.py +1 -1
- {cache_dit-0.2.0 → cache_dit-0.2.1}/examples/run_wan.py +11 -2
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/_version.py +2 -2
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/dual_block_cache/cache_context.py +46 -29
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/dynamic_block_prune/diffusers_adapters/wan.py +1 -1
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit.egg-info/PKG-INFO +30 -11
- {cache_dit-0.2.0 → cache_dit-0.2.1}/.github/workflows/issue.yml +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/.gitignore +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/.pre-commit-config.yaml +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/CONTRIBUTE.md +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/LICENSE +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/MANIFEST.in +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBCACHE_F12B12S4_R0.2_S16.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBCACHE_F12B16S4_R0.08_S6.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBCACHE_F16B16S2_R0.2_S14.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBCACHE_F16B16S4_R0.2_S13.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBCACHE_F1B0S1_R0.08_S11.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBCACHE_F1B0S1_R0.2_S19.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBCACHE_F8B0S2_R0.12_S12.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBCACHE_F8B16S1_R0.2_S18.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBCACHE_F8B8S1_R0.08_S9.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBCACHE_F8B8S1_R0.12_S12.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBCACHE_F8B8S1_R0.15_S15.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBCache.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBPRUNE_F1B0_R0.03_P24.0_T19.43s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBPRUNE_F1B0_R0.04_P34.6_T16.82s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBPRUNE_F1B0_R0.05_P38.3_T15.95s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBPRUNE_F1B0_R0.06_P45.2_T14.24s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBPRUNE_F1B0_R0.07_P52.3_T12.53s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBPRUNE_F1B0_R0.08_P52.4_T12.52s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBPRUNE_F1B0_R0.09_P59.2_T10.81s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBPRUNE_F1B0_R0.12_P59.5_T10.76s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBPRUNE_F1B0_R0.12_P63.0_T9.90s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBPRUNE_F1B0_R0.1_P62.8_T9.95s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBPRUNE_F1B0_R0.2_P59.5_T10.66s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/DBPRUNE_F1B0_R0.3_P63.1_T9.79s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/NONE_R0.08_S0.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U0_C1_DBPRUNE_F1B0_R0.03_P24.0_T16.25s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U0_C1_DBPRUNE_F1B0_R0.045_P38.2_T13.41s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U0_C1_DBPRUNE_F1B0_R0.04_P34.6_T14.12s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U0_C1_DBPRUNE_F1B0_R0.055_P45.1_T12.00s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U0_C1_DBPRUNE_F1B0_R0.05_P41.6_T12.70s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U0_C1_DBPRUNE_F1B0_R0.2_P59.5_T8.86s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U0_C1_DBPRUNE_F8B8_R0.08_P23.1_T16.14s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U0_C1_NONE_R0.08_S0_T20.43s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U4_C1_DBPRUNE_F1B0_R0.03_P27.3_T6.62s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U4_C1_DBPRUNE_F1B0_R0.03_P27.3_T6.63s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U4_C1_DBPRUNE_F1B0_R0.045_P38.2_T5.81s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U4_C1_DBPRUNE_F1B0_R0.045_P38.2_T5.82s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U4_C1_DBPRUNE_F1B0_R0.04_P34.6_T6.06s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U4_C1_DBPRUNE_F1B0_R0.04_P34.6_T6.07s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U4_C1_DBPRUNE_F1B0_R0.04_P34.6_T6.08s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U4_C1_DBPRUNE_F1B0_R0.055_P45.1_T5.27s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U4_C1_DBPRUNE_F1B0_R0.055_P45.1_T5.28s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U4_C1_DBPRUNE_F1B0_R0.2_P59.5_T3.95s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U4_C1_DBPRUNE_F1B0_R0.2_P59.5_T3.96s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U4_C1_NONE_R0.08_S0_T7.78s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/U4_C1_NONE_R0.08_S0_T7.79s.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/assets/cache-dit.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/bench/.gitignore +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/bench/bench.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/docs/.gitignore +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/examples/.gitignore +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/examples/README.md +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/examples/data/cup.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/examples/data/cup_mask.png +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/examples/requirements.txt +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/examples/run_cogvideox.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/examples/run_flux.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/examples/run_flux_fill.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/examples/run_mochi.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/pyproject.toml +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/pytest.ini +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/requirements.txt +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/setup.cfg +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/setup.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/__init__.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/__init__.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/dual_block_cache/__init__.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/dual_block_cache/diffusers_adapters/__init__.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/dual_block_cache/diffusers_adapters/cogvideox.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/dual_block_cache/diffusers_adapters/flux.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/dual_block_cache/diffusers_adapters/hunyuan_video.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/dual_block_cache/diffusers_adapters/mochi.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/dual_block_cache/diffusers_adapters/wan.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/dynamic_block_prune/__init__.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/dynamic_block_prune/diffusers_adapters/__init__.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/dynamic_block_prune/diffusers_adapters/cogvideox.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/dynamic_block_prune/diffusers_adapters/flux.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/dynamic_block_prune/diffusers_adapters/hunyuan_video.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/dynamic_block_prune/diffusers_adapters/mochi.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/dynamic_block_prune/prune_context.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/first_block_cache/__init__.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/first_block_cache/cache_context.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/first_block_cache/diffusers_adapters/__init__.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/first_block_cache/diffusers_adapters/cogvideox.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/first_block_cache/diffusers_adapters/flux.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/first_block_cache/diffusers_adapters/hunyuan_video.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/first_block_cache/diffusers_adapters/mochi.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/first_block_cache/diffusers_adapters/wan.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/taylorseer.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/utils.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/logger.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/primitives.py +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit.egg-info/SOURCES.txt +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit.egg-info/dependency_links.txt +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit.egg-info/requires.txt +0 -0
- {cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cache_dit
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: 🤗 CacheDiT: A Training-free and Easy-to-use Cache Acceleration Toolbox for Diffusion Transformers
|
|
5
5
|
Author: DefTruth, vipshop.com, etc.
|
|
6
6
|
Maintainer: DefTruth, vipshop.com, etc
|
|
@@ -44,20 +44,11 @@ Dynamic: requires-python
|
|
|
44
44
|
<img src=https://img.shields.io/badge/PyPI-pass-brightgreen.svg >
|
|
45
45
|
<img src=https://static.pepy.tech/badge/cache-dit >
|
|
46
46
|
<img src=https://img.shields.io/badge/Python-3.10|3.11|3.12-9cf.svg >
|
|
47
|
-
<img src=https://img.shields.io/badge/Release-v0.2.
|
|
47
|
+
<img src=https://img.shields.io/badge/Release-v0.2.1-brightgreen.svg >
|
|
48
48
|
</div>
|
|
49
49
|
<p align="center">
|
|
50
50
|
DeepCache is for UNet not DiT. Most DiT cache speedups are complex and not training-free. CacheDiT <br>offers a set of training-free cache accelerators for DiT: 🔥DBCache, DBPrune, FBCache, etc🔥
|
|
51
51
|
</p>
|
|
52
|
-
<p align="center">
|
|
53
|
-
<h4> 🔥Supported Models🔥</h4>
|
|
54
|
-
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀FLUX.1</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
55
|
-
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀Mochi</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
56
|
-
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀CogVideoX</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
57
|
-
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀CogVideoX1.5</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
58
|
-
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀Wan2.1</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
59
|
-
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀HunyuanVideo</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
60
|
-
</p>
|
|
61
52
|
</div>
|
|
62
53
|
|
|
63
54
|
## 👋 Highlight
|
|
@@ -160,6 +151,7 @@ Moreover, **CacheDiT** are **plug-and-play** solutions that works hand-in-hand w
|
|
|
160
151
|
<div id="contents"></div>
|
|
161
152
|
|
|
162
153
|
- [⚙️Installation](#️installation)
|
|
154
|
+
- [🔥Supported Models](#supported)
|
|
163
155
|
- [⚡️Dual Block Cache](#dbcache)
|
|
164
156
|
- [🎉First Block Cache](#fbcache)
|
|
165
157
|
- [⚡️Dynamic Block Prune](#dbprune)
|
|
@@ -183,6 +175,30 @@ Or you can install the latest develop version from GitHub:
|
|
|
183
175
|
pip3 install git+https://github.com/vipshop/cache-dit.git
|
|
184
176
|
```
|
|
185
177
|
|
|
178
|
+
## 🔥Supported Models
|
|
179
|
+
|
|
180
|
+
<div id="supported"></div>
|
|
181
|
+
|
|
182
|
+
- [🚀FLUX.1](https://github.com/vipshop/cache-dit/raw/main/examples)
|
|
183
|
+
- [🚀Mochi](https://github.com/vipshop/cache-dit/raw/main/examples)
|
|
184
|
+
- [🚀CogVideoX](https://github.com/vipshop/cache-dit/raw/main/examples)
|
|
185
|
+
- [🚀CogVideoX1.5](https://github.com/vipshop/cache-dit/raw/main/examples)
|
|
186
|
+
- [🚀Wan2.1](https://github.com/vipshop/cache-dit/raw/main/examples)
|
|
187
|
+
- [🚀HunyuanVideo](https://github.com/vipshop/cache-dit/raw/main/examples)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
<!--
|
|
191
|
+
<p align="center">
|
|
192
|
+
<h4> 🔥Supported Models🔥</h4>
|
|
193
|
+
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀FLUX.1</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
194
|
+
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀Mochi</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
195
|
+
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀CogVideoX</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
196
|
+
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀CogVideoX1.5</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
197
|
+
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀Wan2.1</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
198
|
+
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀HunyuanVideo</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
199
|
+
</p>
|
|
200
|
+
-->
|
|
201
|
+
|
|
186
202
|
## ⚡️DBCache: Dual Block Cache
|
|
187
203
|
|
|
188
204
|
<div id="dbcache"></div>
|
|
@@ -340,6 +356,9 @@ cache_options = {
|
|
|
340
356
|
apply_cache_on_pipe(pipe, **cache_options)
|
|
341
357
|
```
|
|
342
358
|
|
|
359
|
+
> [!Important]
|
|
360
|
+
> Please note that for GPUs with lower VRAM, DBPrune may not be suitable for use on video DiTs, as it caches the hidden states and residuals of each block, leading to higher GPU memory requirements. In such cases, please use DBCache, which only caches the hidden states and residuals of 2 blocks.
|
|
361
|
+
|
|
343
362
|
<div align="center">
|
|
344
363
|
<p align="center">
|
|
345
364
|
DBPrune, <b> L20x1 </b>, Steps: 28, "A cat holding a sign that says hello world with complex background"
|
|
@@ -9,20 +9,11 @@
|
|
|
9
9
|
<img src=https://img.shields.io/badge/PyPI-pass-brightgreen.svg >
|
|
10
10
|
<img src=https://static.pepy.tech/badge/cache-dit >
|
|
11
11
|
<img src=https://img.shields.io/badge/Python-3.10|3.11|3.12-9cf.svg >
|
|
12
|
-
<img src=https://img.shields.io/badge/Release-v0.2.
|
|
12
|
+
<img src=https://img.shields.io/badge/Release-v0.2.1-brightgreen.svg >
|
|
13
13
|
</div>
|
|
14
14
|
<p align="center">
|
|
15
15
|
DeepCache is for UNet not DiT. Most DiT cache speedups are complex and not training-free. CacheDiT <br>offers a set of training-free cache accelerators for DiT: 🔥DBCache, DBPrune, FBCache, etc🔥
|
|
16
16
|
</p>
|
|
17
|
-
<p align="center">
|
|
18
|
-
<h4> 🔥Supported Models🔥</h4>
|
|
19
|
-
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀FLUX.1</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
20
|
-
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀Mochi</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
21
|
-
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀CogVideoX</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
22
|
-
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀CogVideoX1.5</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
23
|
-
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀Wan2.1</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
24
|
-
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀HunyuanVideo</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
25
|
-
</p>
|
|
26
17
|
</div>
|
|
27
18
|
|
|
28
19
|
## 👋 Highlight
|
|
@@ -125,6 +116,7 @@ Moreover, **CacheDiT** are **plug-and-play** solutions that works hand-in-hand w
|
|
|
125
116
|
<div id="contents"></div>
|
|
126
117
|
|
|
127
118
|
- [⚙️Installation](#️installation)
|
|
119
|
+
- [🔥Supported Models](#supported)
|
|
128
120
|
- [⚡️Dual Block Cache](#dbcache)
|
|
129
121
|
- [🎉First Block Cache](#fbcache)
|
|
130
122
|
- [⚡️Dynamic Block Prune](#dbprune)
|
|
@@ -148,6 +140,30 @@ Or you can install the latest develop version from GitHub:
|
|
|
148
140
|
pip3 install git+https://github.com/vipshop/cache-dit.git
|
|
149
141
|
```
|
|
150
142
|
|
|
143
|
+
## 🔥Supported Models
|
|
144
|
+
|
|
145
|
+
<div id="supported"></div>
|
|
146
|
+
|
|
147
|
+
- [🚀FLUX.1](https://github.com/vipshop/cache-dit/raw/main/examples)
|
|
148
|
+
- [🚀Mochi](https://github.com/vipshop/cache-dit/raw/main/examples)
|
|
149
|
+
- [🚀CogVideoX](https://github.com/vipshop/cache-dit/raw/main/examples)
|
|
150
|
+
- [🚀CogVideoX1.5](https://github.com/vipshop/cache-dit/raw/main/examples)
|
|
151
|
+
- [🚀Wan2.1](https://github.com/vipshop/cache-dit/raw/main/examples)
|
|
152
|
+
- [🚀HunyuanVideo](https://github.com/vipshop/cache-dit/raw/main/examples)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
<!--
|
|
156
|
+
<p align="center">
|
|
157
|
+
<h4> 🔥Supported Models🔥</h4>
|
|
158
|
+
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀FLUX.1</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
159
|
+
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀Mochi</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
160
|
+
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀CogVideoX</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
161
|
+
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀CogVideoX1.5</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
162
|
+
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀Wan2.1</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
163
|
+
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀HunyuanVideo</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
164
|
+
</p>
|
|
165
|
+
-->
|
|
166
|
+
|
|
151
167
|
## ⚡️DBCache: Dual Block Cache
|
|
152
168
|
|
|
153
169
|
<div id="dbcache"></div>
|
|
@@ -305,6 +321,9 @@ cache_options = {
|
|
|
305
321
|
apply_cache_on_pipe(pipe, **cache_options)
|
|
306
322
|
```
|
|
307
323
|
|
|
324
|
+
> [!Important]
|
|
325
|
+
> Please note that for GPUs with lower VRAM, DBPrune may not be suitable for use on video DiTs, as it caches the hidden states and residuals of each block, leading to higher GPU memory requirements. In such cases, please use DBCache, which only caches the hidden states and residuals of 2 blocks.
|
|
326
|
+
|
|
308
327
|
<div align="center">
|
|
309
328
|
<p align="center">
|
|
310
329
|
DBPrune, <b> L20x1 </b>, Steps: 28, "A cat holding a sign that says hello world with complex background"
|
|
@@ -9,7 +9,7 @@ from diffusers import (
|
|
|
9
9
|
)
|
|
10
10
|
from cache_dit.cache_factory import apply_cache_on_pipe, CacheType
|
|
11
11
|
|
|
12
|
-
model_id = os.environ.get("
|
|
12
|
+
model_id = os.environ.get("HUNYUAN_DIR", "tencent/HunyuanVideo")
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
def get_gpu_memory_in_gib():
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import torch
|
|
3
|
+
import diffusers
|
|
3
4
|
from diffusers import WanPipeline, AutoencoderKLWan
|
|
4
5
|
from diffusers.utils import export_to_video
|
|
5
6
|
from diffusers.schedulers.scheduling_unipc_multistep import (
|
|
@@ -35,8 +36,16 @@ pipe.enable_model_cpu_offload()
|
|
|
35
36
|
|
|
36
37
|
# Wan currently requires installing diffusers from source
|
|
37
38
|
assert isinstance(pipe.vae, AutoencoderKLWan) # enable type check for IDE
|
|
38
|
-
|
|
39
|
-
pipe.vae.
|
|
39
|
+
if diffusers.__version__ >= "0.34.0.dev0":
|
|
40
|
+
pipe.vae.enable_tiling()
|
|
41
|
+
pipe.vae.enable_slicing()
|
|
42
|
+
else:
|
|
43
|
+
print(
|
|
44
|
+
"Wan pipeline requires diffusers version >= 0.34.0.dev0 "
|
|
45
|
+
"for vae tiling and slicing, please install diffusers "
|
|
46
|
+
"from source."
|
|
47
|
+
)
|
|
48
|
+
|
|
40
49
|
|
|
41
50
|
video = pipe(
|
|
42
51
|
prompt=(
|
{cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/dual_block_cache/cache_context.py
RENAMED
|
@@ -9,6 +9,7 @@ from typing import Any, DefaultDict, Dict, List, Optional, Union
|
|
|
9
9
|
import torch
|
|
10
10
|
|
|
11
11
|
import cache_dit.primitives as DP
|
|
12
|
+
from cache_dit.cache_factory.taylorseer import TaylorSeer
|
|
12
13
|
from cache_dit.logger import init_logger
|
|
13
14
|
|
|
14
15
|
logger = init_logger(__name__)
|
|
@@ -60,6 +61,18 @@ class DBCacheContext:
|
|
|
60
61
|
residual_diffs: DefaultDict[str, float] = dataclasses.field(
|
|
61
62
|
default_factory=lambda: defaultdict(float),
|
|
62
63
|
)
|
|
64
|
+
# TODO: Support TaylorSeers and SLG in Dual Block Cache
|
|
65
|
+
# TaylorSeers:
|
|
66
|
+
# Title: From Reusing to Forecasting: Accelerating Diffusion Models with TaylorSeers
|
|
67
|
+
# Url: https://arxiv.org/pdf/2503.06923
|
|
68
|
+
taylorseer: Optional[TaylorSeer] = None
|
|
69
|
+
alter_taylorseer: Optional[TaylorSeer] = None
|
|
70
|
+
|
|
71
|
+
# Skip Layer Guidance, SLG
|
|
72
|
+
# https://github.com/huggingface/candle/issues/2588
|
|
73
|
+
slg_layers: Optional[List[int]] = None
|
|
74
|
+
slg_start: float = 0.0
|
|
75
|
+
slg_end: float = 0.1
|
|
63
76
|
|
|
64
77
|
def get_incremental_name(self, name=None):
|
|
65
78
|
if name is None:
|
|
@@ -700,7 +713,7 @@ class DBCachedTransformerBlocks(torch.nn.Module):
|
|
|
700
713
|
encoder_hidden_states,
|
|
701
714
|
hidden_states_residual,
|
|
702
715
|
encoder_hidden_states_residual,
|
|
703
|
-
) = self.
|
|
716
|
+
) = self.call_Mn_transformer_blocks( # middle
|
|
704
717
|
hidden_states,
|
|
705
718
|
encoder_hidden_states,
|
|
706
719
|
*args,
|
|
@@ -772,32 +785,32 @@ class DBCachedTransformerBlocks(torch.nn.Module):
|
|
|
772
785
|
return selected_Fn_transformer_blocks
|
|
773
786
|
|
|
774
787
|
@torch.compiler.disable
|
|
775
|
-
def
|
|
788
|
+
def _Mn_single_transformer_blocks(self): # middle blocks
|
|
776
789
|
# M(N-2n): transformer_blocks [n,...] + single_transformer_blocks [0,...,N-n]
|
|
777
|
-
|
|
790
|
+
selected_Mn_single_transformer_blocks = []
|
|
778
791
|
if self.single_transformer_blocks is not None:
|
|
779
792
|
if Bn_compute_blocks() == 0: # WARN: x[:-0] = []
|
|
780
|
-
|
|
793
|
+
selected_Mn_single_transformer_blocks = (
|
|
781
794
|
self.single_transformer_blocks
|
|
782
795
|
)
|
|
783
796
|
else:
|
|
784
|
-
|
|
797
|
+
selected_Mn_single_transformer_blocks = (
|
|
785
798
|
self.single_transformer_blocks[: -Bn_compute_blocks()]
|
|
786
799
|
)
|
|
787
|
-
return
|
|
800
|
+
return selected_Mn_single_transformer_blocks
|
|
788
801
|
|
|
789
802
|
@torch.compiler.disable
|
|
790
|
-
def
|
|
803
|
+
def _Mn_transformer_blocks(self): # middle blocks
|
|
791
804
|
# M(N-2n): only transformer_blocks [n,...,N-n], middle
|
|
792
805
|
if Bn_compute_blocks() == 0: # WARN: x[:-0] = []
|
|
793
|
-
|
|
806
|
+
selected_Mn_transformer_blocks = self.transformer_blocks[
|
|
794
807
|
Fn_compute_blocks() :
|
|
795
808
|
]
|
|
796
809
|
else:
|
|
797
|
-
|
|
810
|
+
selected_Mn_transformer_blocks = self.transformer_blocks[
|
|
798
811
|
Fn_compute_blocks() : -Bn_compute_blocks()
|
|
799
812
|
]
|
|
800
|
-
return
|
|
813
|
+
return selected_Mn_transformer_blocks
|
|
801
814
|
|
|
802
815
|
@torch.compiler.disable
|
|
803
816
|
def _Bn_single_transformer_blocks(self):
|
|
@@ -845,7 +858,7 @@ class DBCachedTransformerBlocks(torch.nn.Module):
|
|
|
845
858
|
|
|
846
859
|
return hidden_states, encoder_hidden_states
|
|
847
860
|
|
|
848
|
-
def
|
|
861
|
+
def call_Mn_transformer_blocks(
|
|
849
862
|
self,
|
|
850
863
|
hidden_states: torch.Tensor,
|
|
851
864
|
encoder_hidden_states: torch.Tensor,
|
|
@@ -873,7 +886,7 @@ class DBCachedTransformerBlocks(torch.nn.Module):
|
|
|
873
886
|
hidden_states = torch.cat(
|
|
874
887
|
[encoder_hidden_states, hidden_states], dim=1
|
|
875
888
|
)
|
|
876
|
-
for block in self.
|
|
889
|
+
for block in self._Mn_single_transformer_blocks():
|
|
877
890
|
hidden_states = block(
|
|
878
891
|
hidden_states,
|
|
879
892
|
*args,
|
|
@@ -887,7 +900,7 @@ class DBCachedTransformerBlocks(torch.nn.Module):
|
|
|
887
900
|
dim=1,
|
|
888
901
|
)
|
|
889
902
|
else:
|
|
890
|
-
for block in self.
|
|
903
|
+
for block in self._Mn_transformer_blocks():
|
|
891
904
|
hidden_states = block(
|
|
892
905
|
hidden_states,
|
|
893
906
|
encoder_hidden_states,
|
|
@@ -1016,7 +1029,9 @@ class DBCachedTransformerBlocks(torch.nn.Module):
|
|
|
1016
1029
|
|
|
1017
1030
|
def _compute_and_cache_single_transformer_block(
|
|
1018
1031
|
self,
|
|
1019
|
-
|
|
1032
|
+
# Block index in the transformer blocks
|
|
1033
|
+
# Bn: 8, block_id should be in [0, 8)
|
|
1034
|
+
block_id: int,
|
|
1020
1035
|
# Helper inputs for hidden states split and reshape
|
|
1021
1036
|
original_hidden_states: torch.Tensor,
|
|
1022
1037
|
original_encoder_hidden_states: torch.Tensor,
|
|
@@ -1042,7 +1057,7 @@ class DBCachedTransformerBlocks(torch.nn.Module):
|
|
|
1042
1057
|
)
|
|
1043
1058
|
# Cache residuals for the non-compute Bn blocks for
|
|
1044
1059
|
# subsequent cache steps.
|
|
1045
|
-
if
|
|
1060
|
+
if block_id not in Bn_compute_blocks_ids():
|
|
1046
1061
|
Bn_i_hidden_states = hidden_states
|
|
1047
1062
|
(
|
|
1048
1063
|
Bn_i_hidden_states_residual,
|
|
@@ -1057,16 +1072,16 @@ class DBCachedTransformerBlocks(torch.nn.Module):
|
|
|
1057
1072
|
# Save original_hidden_states for diff calculation.
|
|
1058
1073
|
set_Bn_buffer(
|
|
1059
1074
|
Bn_i_original_hidden_states,
|
|
1060
|
-
prefix=f"Bn_{
|
|
1075
|
+
prefix=f"Bn_{block_id}_single_original",
|
|
1061
1076
|
)
|
|
1062
1077
|
|
|
1063
1078
|
set_Bn_buffer(
|
|
1064
1079
|
Bn_i_hidden_states_residual,
|
|
1065
|
-
prefix=f"Bn_{
|
|
1080
|
+
prefix=f"Bn_{block_id}_single_residual",
|
|
1066
1081
|
)
|
|
1067
1082
|
set_Bn_encoder_buffer(
|
|
1068
1083
|
Bn_i_encoder_hidden_states_residual,
|
|
1069
|
-
prefix=f"Bn_{
|
|
1084
|
+
prefix=f"Bn_{block_id}_single_residual",
|
|
1070
1085
|
)
|
|
1071
1086
|
del Bn_i_hidden_states
|
|
1072
1087
|
del Bn_i_hidden_states_residual
|
|
@@ -1077,7 +1092,7 @@ class DBCachedTransformerBlocks(torch.nn.Module):
|
|
|
1077
1092
|
else:
|
|
1078
1093
|
# Cache steps: Reuse the cached residuals.
|
|
1079
1094
|
# Check if the block is in the Bn_compute_blocks_ids.
|
|
1080
|
-
if
|
|
1095
|
+
if block_id in Bn_compute_blocks_ids():
|
|
1081
1096
|
hidden_states = block(
|
|
1082
1097
|
hidden_states,
|
|
1083
1098
|
*args,
|
|
@@ -1091,7 +1106,7 @@ class DBCachedTransformerBlocks(torch.nn.Module):
|
|
|
1091
1106
|
hidden_states, # curr step
|
|
1092
1107
|
parallelized=self._is_parallelized(),
|
|
1093
1108
|
threshold=non_compute_blocks_diff_threshold(),
|
|
1094
|
-
prefix=f"Bn_{
|
|
1109
|
+
prefix=f"Bn_{block_id}_single_original", # prev step
|
|
1095
1110
|
):
|
|
1096
1111
|
Bn_i_original_hidden_states = hidden_states
|
|
1097
1112
|
(
|
|
@@ -1106,7 +1121,7 @@ class DBCachedTransformerBlocks(torch.nn.Module):
|
|
|
1106
1121
|
apply_hidden_states_residual(
|
|
1107
1122
|
Bn_i_original_hidden_states,
|
|
1108
1123
|
Bn_i_original_encoder_hidden_states,
|
|
1109
|
-
prefix=f"Bn_{
|
|
1124
|
+
prefix=f"Bn_{block_id}_single_residual",
|
|
1110
1125
|
)
|
|
1111
1126
|
)
|
|
1112
1127
|
hidden_states = torch.cat(
|
|
@@ -1125,7 +1140,9 @@ class DBCachedTransformerBlocks(torch.nn.Module):
|
|
|
1125
1140
|
|
|
1126
1141
|
def _compute_and_cache_transformer_block(
|
|
1127
1142
|
self,
|
|
1128
|
-
|
|
1143
|
+
# Block index in the transformer blocks
|
|
1144
|
+
# Bn: 8, block_id should be in [0, 8)
|
|
1145
|
+
block_id: int,
|
|
1129
1146
|
# Below are the inputs to the block
|
|
1130
1147
|
block, # The transformer block to be executed
|
|
1131
1148
|
hidden_states: torch.Tensor,
|
|
@@ -1158,7 +1175,7 @@ class DBCachedTransformerBlocks(torch.nn.Module):
|
|
|
1158
1175
|
)
|
|
1159
1176
|
# Cache residuals for the non-compute Bn blocks for
|
|
1160
1177
|
# subsequent cache steps.
|
|
1161
|
-
if
|
|
1178
|
+
if block_id not in Bn_compute_blocks_ids():
|
|
1162
1179
|
Bn_i_hidden_states_residual = (
|
|
1163
1180
|
hidden_states - Bn_i_original_hidden_states
|
|
1164
1181
|
)
|
|
@@ -1169,16 +1186,16 @@ class DBCachedTransformerBlocks(torch.nn.Module):
|
|
|
1169
1186
|
# Save original_hidden_states for diff calculation.
|
|
1170
1187
|
set_Bn_buffer(
|
|
1171
1188
|
Bn_i_original_hidden_states,
|
|
1172
|
-
prefix=f"Bn_{
|
|
1189
|
+
prefix=f"Bn_{block_id}_original",
|
|
1173
1190
|
)
|
|
1174
1191
|
|
|
1175
1192
|
set_Bn_buffer(
|
|
1176
1193
|
Bn_i_hidden_states_residual,
|
|
1177
|
-
prefix=f"Bn_{
|
|
1194
|
+
prefix=f"Bn_{block_id}_residual",
|
|
1178
1195
|
)
|
|
1179
1196
|
set_Bn_encoder_buffer(
|
|
1180
1197
|
Bn_i_encoder_hidden_states_residual,
|
|
1181
|
-
prefix=f"Bn_{
|
|
1198
|
+
prefix=f"Bn_{block_id}_residual",
|
|
1182
1199
|
)
|
|
1183
1200
|
del Bn_i_hidden_states_residual
|
|
1184
1201
|
del Bn_i_encoder_hidden_states_residual
|
|
@@ -1189,7 +1206,7 @@ class DBCachedTransformerBlocks(torch.nn.Module):
|
|
|
1189
1206
|
else:
|
|
1190
1207
|
# Cache steps: Reuse the cached residuals.
|
|
1191
1208
|
# Check if the block is in the Bn_compute_blocks_ids.
|
|
1192
|
-
if
|
|
1209
|
+
if block_id in Bn_compute_blocks_ids():
|
|
1193
1210
|
hidden_states = block(
|
|
1194
1211
|
hidden_states,
|
|
1195
1212
|
encoder_hidden_states,
|
|
@@ -1211,13 +1228,13 @@ class DBCachedTransformerBlocks(torch.nn.Module):
|
|
|
1211
1228
|
hidden_states, # curr step
|
|
1212
1229
|
parallelized=self._is_parallelized(),
|
|
1213
1230
|
threshold=non_compute_blocks_diff_threshold(),
|
|
1214
|
-
prefix=f"Bn_{
|
|
1231
|
+
prefix=f"Bn_{block_id}_original", # prev step
|
|
1215
1232
|
):
|
|
1216
1233
|
hidden_states, encoder_hidden_states = (
|
|
1217
1234
|
apply_hidden_states_residual(
|
|
1218
1235
|
hidden_states,
|
|
1219
1236
|
encoder_hidden_states,
|
|
1220
|
-
prefix=f"Bn_{
|
|
1237
|
+
prefix=f"Bn_{block_id}_residual",
|
|
1221
1238
|
)
|
|
1222
1239
|
)
|
|
1223
1240
|
else:
|
|
@@ -56,7 +56,7 @@ def apply_cache_on_pipe(
|
|
|
56
56
|
shallow_patch: bool = False,
|
|
57
57
|
residual_diff_threshold=0.03,
|
|
58
58
|
downsample_factor=1,
|
|
59
|
-
# SLG is not supported in WAN with
|
|
59
|
+
# SLG is not supported in WAN with DBPrune yet
|
|
60
60
|
# slg_layers=None,
|
|
61
61
|
# slg_start: float = 0.0,
|
|
62
62
|
# slg_end: float = 0.1,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cache_dit
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: 🤗 CacheDiT: A Training-free and Easy-to-use Cache Acceleration Toolbox for Diffusion Transformers
|
|
5
5
|
Author: DefTruth, vipshop.com, etc.
|
|
6
6
|
Maintainer: DefTruth, vipshop.com, etc
|
|
@@ -44,20 +44,11 @@ Dynamic: requires-python
|
|
|
44
44
|
<img src=https://img.shields.io/badge/PyPI-pass-brightgreen.svg >
|
|
45
45
|
<img src=https://static.pepy.tech/badge/cache-dit >
|
|
46
46
|
<img src=https://img.shields.io/badge/Python-3.10|3.11|3.12-9cf.svg >
|
|
47
|
-
<img src=https://img.shields.io/badge/Release-v0.2.
|
|
47
|
+
<img src=https://img.shields.io/badge/Release-v0.2.1-brightgreen.svg >
|
|
48
48
|
</div>
|
|
49
49
|
<p align="center">
|
|
50
50
|
DeepCache is for UNet not DiT. Most DiT cache speedups are complex and not training-free. CacheDiT <br>offers a set of training-free cache accelerators for DiT: 🔥DBCache, DBPrune, FBCache, etc🔥
|
|
51
51
|
</p>
|
|
52
|
-
<p align="center">
|
|
53
|
-
<h4> 🔥Supported Models🔥</h4>
|
|
54
|
-
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀FLUX.1</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
55
|
-
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀Mochi</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
56
|
-
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀CogVideoX</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
57
|
-
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀CogVideoX1.5</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
58
|
-
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀Wan2.1</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
59
|
-
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀HunyuanVideo</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
60
|
-
</p>
|
|
61
52
|
</div>
|
|
62
53
|
|
|
63
54
|
## 👋 Highlight
|
|
@@ -160,6 +151,7 @@ Moreover, **CacheDiT** are **plug-and-play** solutions that works hand-in-hand w
|
|
|
160
151
|
<div id="contents"></div>
|
|
161
152
|
|
|
162
153
|
- [⚙️Installation](#️installation)
|
|
154
|
+
- [🔥Supported Models](#supported)
|
|
163
155
|
- [⚡️Dual Block Cache](#dbcache)
|
|
164
156
|
- [🎉First Block Cache](#fbcache)
|
|
165
157
|
- [⚡️Dynamic Block Prune](#dbprune)
|
|
@@ -183,6 +175,30 @@ Or you can install the latest develop version from GitHub:
|
|
|
183
175
|
pip3 install git+https://github.com/vipshop/cache-dit.git
|
|
184
176
|
```
|
|
185
177
|
|
|
178
|
+
## 🔥Supported Models
|
|
179
|
+
|
|
180
|
+
<div id="supported"></div>
|
|
181
|
+
|
|
182
|
+
- [🚀FLUX.1](https://github.com/vipshop/cache-dit/raw/main/examples)
|
|
183
|
+
- [🚀Mochi](https://github.com/vipshop/cache-dit/raw/main/examples)
|
|
184
|
+
- [🚀CogVideoX](https://github.com/vipshop/cache-dit/raw/main/examples)
|
|
185
|
+
- [🚀CogVideoX1.5](https://github.com/vipshop/cache-dit/raw/main/examples)
|
|
186
|
+
- [🚀Wan2.1](https://github.com/vipshop/cache-dit/raw/main/examples)
|
|
187
|
+
- [🚀HunyuanVideo](https://github.com/vipshop/cache-dit/raw/main/examples)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
<!--
|
|
191
|
+
<p align="center">
|
|
192
|
+
<h4> 🔥Supported Models🔥</h4>
|
|
193
|
+
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀FLUX.1</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
194
|
+
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀Mochi</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
195
|
+
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀CogVideoX</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
196
|
+
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀CogVideoX1.5</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
197
|
+
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀Wan2.1</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
198
|
+
<a href=https://github.com/vipshop/cache-dit/raw/main/examples> <b>🚀HunyuanVideo</b>: ✔️DBCache, ✔️DBPrune, ✔️FBCache🔥</a> <br>
|
|
199
|
+
</p>
|
|
200
|
+
-->
|
|
201
|
+
|
|
186
202
|
## ⚡️DBCache: Dual Block Cache
|
|
187
203
|
|
|
188
204
|
<div id="dbcache"></div>
|
|
@@ -340,6 +356,9 @@ cache_options = {
|
|
|
340
356
|
apply_cache_on_pipe(pipe, **cache_options)
|
|
341
357
|
```
|
|
342
358
|
|
|
359
|
+
> [!Important]
|
|
360
|
+
> Please note that for GPUs with lower VRAM, DBPrune may not be suitable for use on video DiTs, as it caches the hidden states and residuals of each block, leading to higher GPU memory requirements. In such cases, please use DBCache, which only caches the hidden states and residuals of 2 blocks.
|
|
361
|
+
|
|
343
362
|
<div align="center">
|
|
344
363
|
<p align="center">
|
|
345
364
|
DBPrune, <b> L20x1 </b>, Steps: 28, "A cat holding a sign that says hello world with complex background"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/dual_block_cache/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/dynamic_block_prune/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/dynamic_block_prune/prune_context.py
RENAMED
|
File without changes
|
{cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/first_block_cache/__init__.py
RENAMED
|
File without changes
|
{cache_dit-0.2.0 → cache_dit-0.2.1}/src/cache_dit/cache_factory/first_block_cache/cache_context.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|