Skip to content

Commit 3a3cc3d

Browse files
authored
chore: add cache-dit docs, bump the version (#854)
* update * update * update * update * update the transformers version
1 parent f8dd1dc commit 3a3cc3d

8 files changed

Lines changed: 66 additions & 25 deletions

File tree

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Check out `DeepCompressor <github_deepcompressor_>`_ for the quantization librar
2525
usage/qencoder.rst
2626
usage/offload.rst
2727
usage/attention.rst
28-
usage/fbcache.rst
28+
usage/cache.rst
2929
usage/pulid.rst
3030
usage/ip_adapter.rst
3131
usage/zimage.rst

docs/source/usage/cache.rst

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
Cache
2+
=====
3+
4+
.. _usage-fbcache:
5+
6+
First-Block Cache
7+
-----------------
8+
9+
Nunchaku supports `First-Block Cache (FB Cache) <fbcache>`_ for faster long-step denoising. Example usage:
10+
11+
.. literalinclude:: ../../../examples/flux.1-dev-cache.py
12+
:language: python
13+
:caption: Running FLUX.1-dev with FB Cache (`examples/flux.1-dev-cache.py <https://github.com/nunchaku-tech/nunchaku/blob/main/examples/flux.1-dev-cache.py>`__)
14+
:linenos:
15+
:emphasize-lines: 15-17
16+
17+
Enable it with :func:`~nunchaku.caching.diffusers_adapters.flux.apply_cache_on_pipe`:
18+
19+
.. code-block:: python
20+
21+
apply_cache_on_pipe(pipeline, residual_diff_threshold=0.12)
22+
23+
Adjust ``residual_diff_threshold`` to trade speed for quality - higher values are faster but lower quality.
24+
Recommended value 0.12 gives 2× speedup for 50-step and 1.4× for 30-step denoising.
25+
26+
.. _usage-cache-dit:
27+
28+
Cache-DiT
29+
---------
30+
31+
Nunchaku supports `Cache-DiT <https://github.com/vipshop/cache-dit>`__ to enable further accelerated inference through various caching strategies, such as DB Cache.
32+
33+
Install the required package:
34+
35+
.. code-block:: bash
36+
37+
pip install cache-dit
38+
39+
.. tabs::
40+
41+
.. tab:: FLUX.1
42+
43+
.. literalinclude:: ../../../examples/v1/flux.1-dev-cache-dit.py
44+
:language: python
45+
:caption: FLUX.1-dev with Cache-DiT (`examples/v1/flux.1-dev-cache-dit.py <https://github.com/nunchaku-tech/nunchaku/blob/main/examples/v1/flux.1-dev-cache-dit.py>`__)
46+
:linenos:
47+
48+
.. tab:: Qwen-Image
49+
50+
.. literalinclude:: ../../../examples/v1/qwen-image-cache-dit.py
51+
:language: python
52+
:caption: Qwen-Image with Cache-DiT (`examples/v1/qwen-image-cache-dit.py <https://github.com/nunchaku-tech/nunchaku/blob/main/examples/v1/qwen-image-cache-dit.py>`__)
53+
:linenos:
54+
55+
For more information, refer to the `Cache-DiT documentation <https://github.com/vipshop/cache-dit/blob/main/docs/User_Guide.md#unified-cache-apis>`__.

docs/source/usage/fbcache.rst

Lines changed: 0 additions & 21 deletions
This file was deleted.

docs/source/usage/ip_adapter.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
IP Adapter
22
==========
33

4+
.. warning::
5+
IP Adapter support will be deprecated in March, 2026.
6+
47
.. image:: https://huggingface.co/datasets/nunchaku-tech/cdn/resolve/main/ComfyUI-nunchaku/workflows/nunchaku-flux.1-ip-adapter.png
58

69
Nunchaku supports `IP Adapter <hf_ip-adapterv2_>`_, an adapter achieving image prompt capability for the FLUX.1-dev
@@ -28,7 +31,7 @@ The IP Adapter integration in Nunchaku follows these main steps:
2831

2932
**Caching (Optional)**:
3033

31-
Enable caching for faster inference and reduced memory usage with :func:`~nunchaku.caching.diffusers_adapters.apply_cache_on_pipe`. See :doc:`fbcache` for more details.
34+
Enable caching for faster inference and reduced memory usage with :func:`~nunchaku.caching.diffusers_adapters.apply_cache_on_pipe`. See :doc:`cache` for more details.
3235

3336
**Image Generation**:
3437

examples/v1/flux.1-dev-cache-dit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Please install cache-dit with `pip install cache-dit`.
12
import cache_dit
23
import torch
34
from cache_dit import DBCacheConfig

examples/v1/qwen-image-cache-dit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Please install cache-dit with `pip install cache-dit`.
12
import cache_dit
23
import torch
34
from cache_dit import DBCacheConfig

nunchaku/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.1.0"
1+
__version__ = "1.2.0dev"

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ dependencies = [
3434
]
3535
optional-dependencies.ci = [
3636
"accelerate==1.9",
37+
"cache-dit==1.1.9",
3738
"controlnet-aux==0.0.10",
3839
"datasets==3.6",
3940
"diffusers==0.36",
@@ -48,7 +49,7 @@ optional-dependencies.ci = [
4849
"pytest-rerunfailures==16.0.1",
4950
"timm==1.0.19",
5051
"torchmetrics==1.8",
51-
"transformers==4.54",
52+
"transformers==4.55.2",
5253
]
5354

5455
optional-dependencies.demo = [
@@ -58,6 +59,7 @@ optional-dependencies.demo = [
5859
"spaces",
5960
]
6061
optional-dependencies.dev = [
62+
"cache-dit>=1.1.9",
6163
"controlnet-aux",
6264
"datasets<4",
6365
"facexlib",

0 commit comments

Comments
 (0)