cache-dit 1.0.0__py3-none-any.whl → 1.0.2__py3-none-any.whl

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.

Potentially problematic release.


This version of cache-dit might be problematic. Click here for more details.

@@ -0,0 +1,263 @@
1
+ import torch
2
+ import numpy as np
3
+ from typing import Tuple, Optional, Dict, Any, Union, List
4
+ from diffusers import QwenImageTransformer2DModel
5
+ from diffusers.models.transformers.transformer_qwenimage import (
6
+ QwenImageTransformerBlock,
7
+ Transformer2DModelOutput,
8
+ )
9
+ from diffusers.utils import (
10
+ USE_PEFT_BACKEND,
11
+ scale_lora_layers,
12
+ unscale_lora_layers,
13
+ )
14
+ from cache_dit.cache_factory.patch_functors.functor_base import (
15
+ PatchFunctor,
16
+ )
17
+ from cache_dit.logger import init_logger
18
+
19
+ logger = init_logger(__name__)
20
+
21
+
22
+ class QwenImageControlNetPatchFunctor(PatchFunctor):
23
+
24
+ def apply(
25
+ self,
26
+ transformer: QwenImageTransformer2DModel,
27
+ **kwargs,
28
+ ) -> QwenImageTransformer2DModel:
29
+ if hasattr(transformer, "_is_patched"):
30
+ return transformer
31
+
32
+ is_patched = False
33
+
34
+ _index_block = 0
35
+ _num_blocks = len(transformer.transformer_blocks)
36
+ for block in transformer.transformer_blocks:
37
+ assert isinstance(block, QwenImageTransformerBlock)
38
+ block._index_block = _index_block
39
+ block._num_blocks = _num_blocks
40
+ block.forward = __patch_block_forward__.__get__(block)
41
+ _index_block += 1
42
+
43
+ is_patched = True
44
+ cls_name = transformer.__class__.__name__
45
+
46
+ if is_patched:
47
+ logger.warning(f"Patched {cls_name} for cache-dit.")
48
+ assert not getattr(transformer, "_is_parallelized", False), (
49
+ "Please call `cache_dit.enable_cache` before Parallelize, "
50
+ "the __patch_transformer_forward__ will overwrite the "
51
+ "parallized forward and cause a downgrade of performance."
52
+ )
53
+ transformer.forward = __patch_transformer_forward__.__get__(
54
+ transformer
55
+ )
56
+
57
+ transformer._is_patched = is_patched # True or False
58
+
59
+ logger.info(
60
+ f"Applied {self.__class__.__name__} for {cls_name}, "
61
+ f"Patch: {is_patched}."
62
+ )
63
+
64
+ return transformer
65
+
66
+
67
+ def __patch_block_forward__(
68
+ self: QwenImageTransformerBlock,
69
+ hidden_states: torch.Tensor,
70
+ encoder_hidden_states: torch.Tensor,
71
+ encoder_hidden_states_mask: torch.Tensor,
72
+ temb: torch.Tensor,
73
+ image_rotary_emb: Optional[Tuple[torch.Tensor, torch.Tensor]] = None,
74
+ joint_attention_kwargs: Optional[Dict[str, Any]] = None,
75
+ controlnet_block_samples: Optional[List[torch.Tensor]] = None,
76
+ ) -> Tuple[torch.Tensor, torch.Tensor]:
77
+ # Get modulation parameters for both streams
78
+ img_mod_params = self.img_mod(temb) # [B, 6*dim]
79
+ txt_mod_params = self.txt_mod(temb) # [B, 6*dim]
80
+
81
+ # Split modulation parameters for norm1 and norm2
82
+ img_mod1, img_mod2 = img_mod_params.chunk(2, dim=-1) # Each [B, 3*dim]
83
+ txt_mod1, txt_mod2 = txt_mod_params.chunk(2, dim=-1) # Each [B, 3*dim]
84
+
85
+ # Process image stream - norm1 + modulation
86
+ img_normed = self.img_norm1(hidden_states)
87
+ img_modulated, img_gate1 = self._modulate(img_normed, img_mod1)
88
+
89
+ # Process text stream - norm1 + modulation
90
+ txt_normed = self.txt_norm1(encoder_hidden_states)
91
+ txt_modulated, txt_gate1 = self._modulate(txt_normed, txt_mod1)
92
+
93
+ # Use QwenAttnProcessor2_0 for joint attention computation
94
+ # This directly implements the DoubleStreamLayerMegatron logic:
95
+ # 1. Computes QKV for both streams
96
+ # 2. Applies QK normalization and RoPE
97
+ # 3. Concatenates and runs joint attention
98
+ # 4. Splits results back to separate streams
99
+ joint_attention_kwargs = joint_attention_kwargs or {}
100
+ attn_output = self.attn(
101
+ hidden_states=img_modulated, # Image stream (will be processed as "sample")
102
+ encoder_hidden_states=txt_modulated, # Text stream (will be processed as "context")
103
+ encoder_hidden_states_mask=encoder_hidden_states_mask,
104
+ image_rotary_emb=image_rotary_emb,
105
+ **joint_attention_kwargs,
106
+ )
107
+
108
+ # QwenAttnProcessor2_0 returns (img_output, txt_output) when encoder_hidden_states is provided
109
+ img_attn_output, txt_attn_output = attn_output
110
+
111
+ # Apply attention gates and add residual (like in Megatron)
112
+ hidden_states = hidden_states + img_gate1 * img_attn_output
113
+ encoder_hidden_states = encoder_hidden_states + txt_gate1 * txt_attn_output
114
+
115
+ # Process image stream - norm2 + MLP
116
+ img_normed2 = self.img_norm2(hidden_states)
117
+ img_modulated2, img_gate2 = self._modulate(img_normed2, img_mod2)
118
+ img_mlp_output = self.img_mlp(img_modulated2)
119
+ hidden_states = hidden_states + img_gate2 * img_mlp_output
120
+
121
+ # Process text stream - norm2 + MLP
122
+ txt_normed2 = self.txt_norm2(encoder_hidden_states)
123
+ txt_modulated2, txt_gate2 = self._modulate(txt_normed2, txt_mod2)
124
+ txt_mlp_output = self.txt_mlp(txt_modulated2)
125
+ encoder_hidden_states = encoder_hidden_states + txt_gate2 * txt_mlp_output
126
+
127
+ # Clip to prevent overflow for fp16
128
+ if encoder_hidden_states.dtype == torch.float16:
129
+ encoder_hidden_states = encoder_hidden_states.clip(-65504, 65504)
130
+ if hidden_states.dtype == torch.float16:
131
+ hidden_states = hidden_states.clip(-65504, 65504)
132
+
133
+ if controlnet_block_samples is not None:
134
+ # Add ControlNet conditioning
135
+ num_blocks = self._num_blocks
136
+ index_block = self._index_block
137
+ interval_control = num_blocks / len(controlnet_block_samples)
138
+ interval_control = int(np.ceil(interval_control))
139
+ hidden_states = (
140
+ hidden_states
141
+ + controlnet_block_samples[index_block // interval_control]
142
+ )
143
+
144
+ return encoder_hidden_states, hidden_states
145
+
146
+
147
+ def __patch_transformer_forward__(
148
+ self: QwenImageTransformer2DModel,
149
+ hidden_states: torch.Tensor,
150
+ encoder_hidden_states: torch.Tensor = None,
151
+ encoder_hidden_states_mask: torch.Tensor = None,
152
+ timestep: torch.LongTensor = None,
153
+ img_shapes: Optional[List[Tuple[int, int, int]]] = None,
154
+ txt_seq_lens: Optional[List[int]] = None,
155
+ guidance: torch.Tensor = None, # TODO: this should probably be removed
156
+ attention_kwargs: Optional[Dict[str, Any]] = None,
157
+ controlnet_block_samples=None,
158
+ return_dict: bool = True,
159
+ ) -> Union[torch.Tensor, Transformer2DModelOutput]:
160
+ """
161
+ The [`QwenTransformer2DModel`] forward method.
162
+
163
+ Args:
164
+ hidden_states (`torch.Tensor` of shape `(batch_size, image_sequence_length, in_channels)`):
165
+ Input `hidden_states`.
166
+ encoder_hidden_states (`torch.Tensor` of shape `(batch_size, text_sequence_length, joint_attention_dim)`):
167
+ Conditional embeddings (embeddings computed from the input conditions such as prompts) to use.
168
+ encoder_hidden_states_mask (`torch.Tensor` of shape `(batch_size, text_sequence_length)`):
169
+ Mask of the input conditions.
170
+ timestep ( `torch.LongTensor`):
171
+ Used to indicate denoising step.
172
+ attention_kwargs (`dict`, *optional*):
173
+ A kwargs dictionary that if specified is passed along to the `AttentionProcessor` as defined under
174
+ `self.processor` in
175
+ [diffusers.models.attention_processor](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py).
176
+ return_dict (`bool`, *optional*, defaults to `True`):
177
+ Whether or not to return a [`~models.transformer_2d.Transformer2DModelOutput`] instead of a plain
178
+ tuple.
179
+
180
+ Returns:
181
+ If `return_dict` is True, an [`~models.transformer_2d.Transformer2DModelOutput`] is returned, otherwise a
182
+ `tuple` where the first element is the sample tensor.
183
+ """
184
+ if attention_kwargs is not None:
185
+ attention_kwargs = attention_kwargs.copy()
186
+ lora_scale = attention_kwargs.pop("scale", 1.0)
187
+ else:
188
+ lora_scale = 1.0
189
+
190
+ if USE_PEFT_BACKEND:
191
+ # weight the lora layers by setting `lora_scale` for each PEFT layer
192
+ scale_lora_layers(self, lora_scale)
193
+ else:
194
+ if (
195
+ attention_kwargs is not None
196
+ and attention_kwargs.get("scale", None) is not None
197
+ ):
198
+ logger.warning(
199
+ "Passing `scale` via `joint_attention_kwargs` when not using the PEFT backend is ineffective."
200
+ )
201
+
202
+ hidden_states = self.img_in(hidden_states)
203
+
204
+ timestep = timestep.to(hidden_states.dtype)
205
+ encoder_hidden_states = self.txt_norm(encoder_hidden_states)
206
+ encoder_hidden_states = self.txt_in(encoder_hidden_states)
207
+
208
+ if guidance is not None:
209
+ guidance = guidance.to(hidden_states.dtype) * 1000
210
+
211
+ temb = (
212
+ self.time_text_embed(timestep, hidden_states)
213
+ if guidance is None
214
+ else self.time_text_embed(timestep, guidance, hidden_states)
215
+ )
216
+
217
+ image_rotary_emb = self.pos_embed(
218
+ img_shapes, txt_seq_lens, device=hidden_states.device
219
+ )
220
+
221
+ for index_block, block in enumerate(self.transformer_blocks):
222
+ if torch.is_grad_enabled() and self.gradient_checkpointing:
223
+ encoder_hidden_states, hidden_states = (
224
+ self._gradient_checkpointing_func(
225
+ block,
226
+ hidden_states,
227
+ encoder_hidden_states,
228
+ encoder_hidden_states_mask,
229
+ temb,
230
+ image_rotary_emb,
231
+ controlnet_block_samples,
232
+ )
233
+ )
234
+
235
+ else:
236
+ encoder_hidden_states, hidden_states = block(
237
+ hidden_states=hidden_states,
238
+ encoder_hidden_states=encoder_hidden_states,
239
+ encoder_hidden_states_mask=encoder_hidden_states_mask,
240
+ temb=temb,
241
+ image_rotary_emb=image_rotary_emb,
242
+ controlnet_block_samples=controlnet_block_samples,
243
+ joint_attention_kwargs=attention_kwargs,
244
+ )
245
+
246
+ # # controlnet residual
247
+ # if controlnet_block_samples is not None:
248
+ # interval_control = len(self.transformer_blocks) / len(controlnet_block_samples)
249
+ # interval_control = int(np.ceil(interval_control))
250
+ # hidden_states = hidden_states + controlnet_block_samples[index_block // interval_control]
251
+
252
+ # Use only the image part (hidden_states) from the dual-stream blocks
253
+ hidden_states = self.norm_out(hidden_states, temb)
254
+ output = self.proj_out(hidden_states)
255
+
256
+ if USE_PEFT_BACKEND:
257
+ # remove `lora_scale` from each PEFT layer
258
+ unscale_lora_layers(self, lora_scale)
259
+
260
+ if not return_dict:
261
+ return (output,)
262
+
263
+ return Transformer2DModelOutput(sample=output)
@@ -646,6 +646,7 @@ def entrypoint():
646
646
  not os.path.exists(img_test),
647
647
  )
648
648
  ):
649
+ logger.error(f"Not exist: {img_true} or {img_test}, skip.")
649
650
  return
650
651
  # img_true and img_test can be files or dirs
651
652
  img_true_info = os.path.basename(img_true)
@@ -684,6 +685,7 @@ def entrypoint():
684
685
  not os.path.exists(img_test), # dir
685
686
  )
686
687
  ):
688
+ logger.error(f"Not exist: {prompt_true} or {img_test}, skip.")
687
689
  return
688
690
 
689
691
  # img_true and img_test can be files or dirs
@@ -714,6 +716,7 @@ def entrypoint():
714
716
  not os.path.exists(video_test),
715
717
  )
716
718
  ):
719
+ logger.error(f"Not exist: {video_true} or {video_test}, skip.")
717
720
  return
718
721
 
719
722
  # video_true and video_test can be files or dirs
@@ -182,12 +182,16 @@ def quantize_ao(
182
182
  force_empty_cache()
183
183
 
184
184
  logger.info(
185
+ f"Quantized Module: {module.__class__.__name__:>5}\n"
185
186
  f"Quantized Method: {quant_type:>5}\n"
186
187
  f"Quantized Linear Layers: {num_quant_linear:>5}\n"
187
188
  f"Skipped Linear Layers: {num_skip_linear:>5}\n"
188
189
  f"Total Linear Layers: {num_linear_layers:>5}\n"
189
190
  f"Total (all) Layers: {num_layers:>5}"
190
191
  )
192
+
193
+ module._quantize_type = quant_type
194
+ module._is_quantized = True
191
195
  return module
192
196
 
193
197
 
@@ -0,0 +1,287 @@
1
+ Metadata-Version: 2.4
2
+ Name: cache_dit
3
+ Version: 1.0.2
4
+ Summary: A Unified, Flexible and Training-free Cache Acceleration Framework for 🤗Diffusers.
5
+ Author: DefTruth, vipshop.com, etc.
6
+ Maintainer: DefTruth, vipshop.com, etc
7
+ Project-URL: Repository, https://github.com/vipshop/cache-dit.git
8
+ Project-URL: Homepage, https://github.com/vipshop/cache-dit.git
9
+ Requires-Python: >=3.10
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: packaging
13
+ Requires-Dist: pyyaml
14
+ Requires-Dist: torch>=2.7.1
15
+ Requires-Dist: transformers>=4.55.2
16
+ Requires-Dist: diffusers>=0.35.1
17
+ Requires-Dist: scikit-image
18
+ Requires-Dist: scipy
19
+ Requires-Dist: lpips==0.1.4
20
+ Requires-Dist: torchao>=0.12.0
21
+ Requires-Dist: image-reward
22
+ Provides-Extra: all
23
+ Provides-Extra: metrics
24
+ Requires-Dist: image-reward; extra == "metrics"
25
+ Requires-Dist: pytorch-fid; extra == "metrics"
26
+ Requires-Dist: lpips==0.1.4; extra == "metrics"
27
+ Provides-Extra: dev
28
+ Requires-Dist: pre-commit; extra == "dev"
29
+ Requires-Dist: pytest<8.0.0,>=7.0.0; extra == "dev"
30
+ Requires-Dist: pytest-html; extra == "dev"
31
+ Requires-Dist: expecttest; extra == "dev"
32
+ Requires-Dist: hypothesis; extra == "dev"
33
+ Requires-Dist: transformers; extra == "dev"
34
+ Requires-Dist: diffusers; extra == "dev"
35
+ Requires-Dist: accelerate; extra == "dev"
36
+ Requires-Dist: peft; extra == "dev"
37
+ Requires-Dist: protobuf; extra == "dev"
38
+ Requires-Dist: sentencepiece; extra == "dev"
39
+ Requires-Dist: opencv-python-headless; extra == "dev"
40
+ Requires-Dist: ftfy; extra == "dev"
41
+ Requires-Dist: scikit-image; extra == "dev"
42
+ Requires-Dist: pytorch-fid; extra == "dev"
43
+ Dynamic: license-file
44
+ Dynamic: provides-extra
45
+ Dynamic: requires-dist
46
+ Dynamic: requires-python
47
+
48
+ <a href="./README.md">📚English</a> | <a href="./README_CN.md">📚中文阅读 </a>
49
+
50
+ <div align="center">
51
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/cache-dit-logo.png height="120">
52
+ <p align="center">
53
+ A <b>Unified</b>, Flexible and Training-free <b>Cache Acceleration</b> Framework for <b>🤗Diffusers</b> <br>
54
+ ♥️ Cache Acceleration with <b>One-line</b> Code ~ ♥️
55
+ </p>
56
+ <div align='center'>
57
+ <img src=https://img.shields.io/badge/Language-Python-brightgreen.svg >
58
+ <img src=https://img.shields.io/badge/PRs-welcome-blue.svg >
59
+ <img src=https://img.shields.io/badge/PyPI-pass-brightgreen.svg >
60
+ <img src=https://static.pepy.tech/badge/cache-dit >
61
+ <img src=https://img.shields.io/github/stars/vipshop/cache-dit.svg?style=dark >
62
+ <img src=https://img.shields.io/badge/Release-v1.0-brightgreen.svg >
63
+ </div>
64
+ <p align="center">
65
+ 🎉Now, <b>cache-dit</b> covers almost <b>All</b> Diffusers' <b>DiT</b> Pipelines🎉<br>
66
+ 🔥<a href="./examples/pipeline">Qwen-Image</a> | <a href="./examples/pipeline">Qwen-Image-Edit</a> | <a href="./examples/pipeline">Qwen-Image-Edit-Plus </a> 🔥<br>
67
+ 🔥<a href="./examples/pipeline">FLUX.1</a> | <a href="./examples/pipeline">Qwen-Image-Lightning 4/8 Steps</a> | <a href="./examples/pipeline"> Wan 2.1 </a> | <a href="./examples/pipeline"> Wan 2.2 </a>🔥<br>
68
+ 🔥<a href="./examples/pipeline">HunyuanImage-2.1</a> | <a href="./examples/pipeline">HunyuanVideo</a> | <a href="./examples/pipeline">HunyuanDiT</a> | <a href="./examples/pipeline">HiDream</a> | <a href="./examples/pipeline">AuraFlow</a>🔥<br>
69
+ 🔥<a href="./examples/pipeline">CogView3Plus</a> | <a href="./examples/pipeline">CogView4</a> | <a href="./examples/pipeline">LTXVideo</a> | <a href="./examples/pipeline">CogVideoX</a> | <a href="./examples/">CogVideoX 1.5</a> | <a href="./examples/">ConsisID</a>🔥<br>
70
+ 🔥<a href="./examples/pipeline">Cosmos</a> | <a href="./examples/pipeline">SkyReelsV2</a> | <a href="./examples/pipeline">VisualCloze</a> | <a href="./examples/pipeline">OmniGen 1/2</a> | <a href="./examples/pipeline">Lumina 1/2</a> | <a href="./examples/pipeline">PixArt</a>🔥<br>
71
+ 🔥<a href="./examples/pipeline">Chroma</a> | <a href="./examples/pipeline">Sana</a> | <a href="./examples/pipeline">Allegro</a> | <a href="./examples/pipeline">Mochi</a> | <a href="./examples/pipeline">SD 3/3.5</a> | <a href="./examples/pipeline">Amused</a> | <a href="./examples/pipeline"> ... </a> | <a href="./examples/pipeline">DiT-XL</a>🔥
72
+ <br>♥️ Please consider to leave a <b>⭐️ Star</b> to support us ~ ♥️
73
+ </p>
74
+ </div>
75
+
76
+ <div align='center'>
77
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/gifs/wan2.2.C0_Q0_NONE.gif width=124px>
78
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/gifs/wan2.2.C1_Q0_DBCACHE_F1B0_W2M8MC2_T1O2_R0.08.gif width=124px>
79
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/gifs/hunyuan_video.C0_L0_Q0_NONE.gif width=126px>
80
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/gifs/hunyuan_video.C0_L0_Q0_DBCACHE_F1B0_W8M0MC2_T0O2_R0.12_S27.gif width=126px>
81
+ <p><b>🔥Wan2.2 MoE</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:2.0x↑🎉 | <b>HunyuanVideo</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:2.1x↑🎉</p>
82
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/qwen-image.C0_Q0_NONE.png width=160px>
83
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/qwen-image.C1_Q0_DBCACHE_F8B0_W8M0MC0_T1O4_R0.12_S23.png width=160px>
84
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/flux.C0_Q0_NONE_T23.69s.png width=90px>
85
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/flux.C0_Q0_DBCACHE_F1B0_W4M0MC0_T1O2_R0.15_S16_T11.39s.png width=90px>
86
+ <p><b>🔥Qwen-Image</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:1.8x↑🎉 | <b>FLUX.1-dev</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:2.1x↑🎉</p>
87
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/qwen-image-lightning.4steps.C0_L1_Q0_NONE.png width=160px>
88
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/qwen-image-lightning.4steps.C0_L1_Q0_DBCACHE_F16B16_W2M1MC1_T0O2_R0.9_S1.png width=160px>
89
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/hunyuan-image-2.1.C0_L0_Q1_fp8_w8a16_wo_NONE.png width=90px>
90
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/hunyuan-image-2.1.C0_L0_Q1_fp8_w8a16_wo_DBCACHE_F8B0_W8M0MC2_T1O2_R0.12_S25.png width=90px>
91
+ <p><b>🔥Qwen...Lightning</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:1.14x↑🎉 | <b>HunyuanImage</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:1.7x↑🎉</p>
92
+ <img src=https://github.com/vipshop/cache-dit/raw/main/examples/data/bear.png width=125px>
93
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/qwen-image-edit.C0_L0_Q0_NONE.png width=125px>
94
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/qwen-image-edit.C0_L0_Q0_DBCACHE_F8B0_W8M0MC0_T0O2_R0.08_S18.png width=125px>
95
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/qwen-image-edit.C0_L0_Q0_DBCACHE_F1B0_W8M0MC2_T0O2_R0.12_S24.png width=125px>
96
+ <p><b>🔥Qwen-Image-Edit</b> | Input w/o Edit | Baseline | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:1.6x↑🎉 | 1.9x↑🎉 </p>
97
+ </div>
98
+
99
+ <details align='center'>
100
+ <summary>🔥<b>Click</b> here to show many <b>Image/Video</b> cases🔥</summary>
101
+
102
+ <div align='center'>
103
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/flux-kontext-cat.C0_L0_Q0_NONE.png width=100px>
104
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/flux-kontext.C0_L0_Q0_NONE.png width=100px>
105
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/flux-kontext.C0_L0_Q0_DBCACHE_F8B0_W8M0MC0_T0O2_R0.08_S10.png width=100px>
106
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/flux-kontext.C0_L0_Q0_DBCACHE_F1B0_W8M0MC2_T0O2_R0.12_S12.png width=100px>
107
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/flux-kontext.C0_L0_Q0_DBCACHE_F1B0_W2M0MC2_T0O2_R0.15_S15.png width=100px>
108
+ <p><b>🔥FLUX-Kontext-dev</b> | Baseline | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:1.3x↑🎉 | 1.7x↑🎉 | 2.0x↑ 🎉</p>
109
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/hidream.C0_L0_Q0_NONE.png width=100px>
110
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/hidream.C0_L0_Q0_DBCACHE_F1B0_W8M0MC0_T0O2_R0.08_S24.png width=100px>
111
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/cogview4.C0_L0_Q0_NONE.png width=100px>
112
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/cogview4.C0_L0_Q0_DBCACHE_F8B0_W8M0MC0_T0O2_R0.08_S15.png width=100px>
113
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/cogview4.C0_L0_Q0_DBCACHE_F1B0_W4M0MC4_T0O2_R0.2_S22.png width=100px>
114
+ <p><b>🔥HiDream-I1</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:1.9x↑🎉 | <b>CogView4</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:1.4x↑🎉 | 1.7x↑🎉</p>
115
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/cogview3_plus.C0_L0_Q0_NONE.png width=100px>
116
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/cogview3_plus.C0_L0_Q0_DBCACHE_F8B0_W8M0MC0_T0O2_R0.08_S15.png width=100px>
117
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/cogview3_plus.C0_L0_Q0_DBCACHE_F1B0_W8M0MC2_T0O2_R0.08_S25.png width=100px>
118
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/chroma1-hd.C0_L0_Q0_NONE.png width=100px>
119
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/chroma1-hd.C0_L0_Q0_DBCACHE_F1B0_W8M0MC0_T0O2_R0.08_S20.png width=100px>
120
+ <p><b>🔥CogView3</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:1.5x↑🎉 | 2.0x↑🎉| <b>Chroma1-HD</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:1.9x↑🎉</p>
121
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/gifs/mochi.C0_L0_Q0_NONE.gif width=125px>
122
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/gifs/mochi.C0_L0_Q0_DBCACHE_F8B0_W8M0MC0_T0O2_R0.08_S34.gif width=125px>
123
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/gifs/skyreels_v2.C0_L0_Q0_NONE.gif width=125px>
124
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/gifs/skyreels_v2.C0_L0_Q0_DBCACHE_F8B0_W8M0MC0_T0O2_R0.12_S17.gif width=125px>
125
+ <p><b>🔥Mochi-1-preview</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:1.8x↑🎉 | <b>SkyReelsV2</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:1.6x↑🎉</p>
126
+ <img src=https://github.com/vipshop/cache-dit/raw/main/examples/data/visualcloze/00555_00.jpg width=100px>
127
+ <img src=https://github.com/vipshop/cache-dit/raw/main/examples/data/visualcloze/12265_00.jpg width=100px>
128
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/visualcloze-512.C0_L0_Q0_NONE.png width=100px>
129
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/visualcloze-512.C0_L0_Q0_DBCACHE_F8B0_W8M0MC0_T0O2_R0.08_S15.png width=100px>
130
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/visualcloze-512.C0_L0_Q0_DBCACHE_F1B0_W8M0MC0_T0O2_R0.08_S18.png width=100px>
131
+ <p><b>🔥VisualCloze-512</b> | Model | Cloth | Baseline | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:1.4x↑🎉 | 1.7x↑🎉 </p>
132
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/gifs/ltx-video.C0_L0_Q0_NONE.gif width=144px>
133
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/gifs/ltx-video.C0_L0_Q0_DBCACHE_F1B0_W8M0MC0_T0O2_R0.15_S13.gif width=144px>
134
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/gifs/cogvideox1.5.C0_L0_Q0_NONE.gif width=105px>
135
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/gifs/cogvideox1.5.C0_L0_Q0_DBCACHE_F1B0_W8M0MC0_T0O2_R0.12_S22.gif width=105px>
136
+ <p><b>🔥LTX-Video-0.9.7</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:1.7x↑🎉 | <b>CogVideoX1.5</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:2.0x↑🎉</p>
137
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/omingen-v1.C0_L0_Q0_NONE.png width=100px>
138
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/omingen-v1.C0_L0_Q0_DBCACHE_F8B0_W8M0MC0_T0O2_R0.08_S24.png width=100px>
139
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/omingen-v1.C0_L0_Q0_DBCACHE_F1B0_W8M0MC0_T1O2_R0.08_S38.png width=100px>
140
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/lumina2.C0_L0_Q0_NONE.png width=100px>
141
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/lumina2.C0_L0_Q0_DBCACHE_F1B0_W2M0MC2_T0O2_R0.12_S14.png width=100px>
142
+ <p><b>🔥OmniGen-v1</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:1.5x↑🎉 | 3.3x↑🎉 | <b>Lumina2</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:1.9x↑🎉</p>
143
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/gifs/allegro.C0_L0_Q0_NONE.gif width=117px>
144
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/gifs/allegro.C0_L0_Q0_DBCACHE_F8B0_W8M0MC0_T0O2_R0.26_S27.gif width=117px>
145
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/auraflow.C0_L0_Q0_NONE.png width=133px>
146
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/auraflow.C0_L0_Q0_DBCACHE_F1B0_W8M0MC2_T0O2_R0.08_S28.png width=133px>
147
+ <p><b>🔥Allegro</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:1.36x↑🎉 | <b>AuraFlow-v0.3</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:2.27x↑🎉 </p>
148
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/sana.C0_L0_Q0_NONE.png width=100px>
149
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/sana.C0_L0_Q0_DBCACHE_F8B0_W8M0MC2_T0O2_R0.25_S6.png width=100px>
150
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/sana.C0_L0_Q0_DBCACHE_F1B0_W8M0MC2_T0O2_R0.3_S8.png width=100px>
151
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/pixart-sigma.C0_L0_Q0_NONE.png width=100px>
152
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/pixart-sigma.C0_L0_Q0_DBCACHE_F8B0_W8M0MC0_T0O2_R0.08_S28.png width=100px>
153
+ <p><b>🔥Sana</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:1.3x↑🎉 | 1.6x↑🎉| <b>PixArt-Sigma</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:2.3x↑🎉</p>
154
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/pixart-alpha.C0_L0_Q0_NONE.png width=100px>
155
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/pixart-alpha.C0_L0_Q0_DBCACHE_F8B0_W8M0MC0_T0O2_R0.05_S27.png width=100px>
156
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/pixart-alpha.C0_L0_Q0_DBCACHE_F8B0_W8M0MC0_T0O2_R0.08_S32.png width=100px>
157
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/sd_3_5.C0_L0_Q0_NONE.png width=100px>
158
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/sd_3_5.C0_L0_Q0_DBCACHE_F1B0_W8M0MC3_T0O2_R0.12_S30.png width=100px>
159
+ <p><b>🔥PixArt-Alpha</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:1.6x↑🎉 | 1.8x↑🎉| <b>SD 3.5</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:2.5x↑🎉</p>
160
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/amused.C0_L0_Q0_NONE.png width=100px>
161
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/amused.C0_L0_Q0_DBCACHE_F8B0_W8M0MC0_T0O2_R0.34_S1.png width=100px>
162
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/amused.C0_L0_Q0_DBCACHE_F8B0_W8M0MC0_T0O2_R0.38_S2.png width=100px>
163
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/dit-xl.C0_L0_Q0_NONE.png width=100px>
164
+ <img src=https://github.com/vipshop/cache-dit/raw/main/assets/dit-xl.C0_L0_Q0_DBCACHE_F1B0_W8M0MC2_T0O2_R0.15_S11.png width=100px>
165
+ <p><b>🔥Asumed</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:1.1x↑🎉 | 1.2x↑🎉 | <b>DiT-XL-256</b> | <a href="https://github.com/vipshop/cache-dit">+cache-dit</a>:1.8x↑🎉
166
+ <br>♥️ Please consider to leave a <b>⭐️ Star</b> to support us ~ ♥️</p>
167
+ </div>
168
+
169
+ </details>
170
+
171
+ ## 🔥Hightlight <a href="https://huggingface.co/docs/diffusers/main/en/optimization/cache_dit"><img src=https://img.shields.io/badge/🤗Diffusers-ecosystem-yellow.svg ></a>
172
+
173
+ We are excited to announce that the **first API-stable version (v1.0.0)** of cache-dit has finally been released!
174
+ **[cache-dit](https://github.com/vipshop/cache-dit)** is a **Unified**, **Flexible**, and **Training-free** cache acceleration framework for 🤗 Diffusers, enabling cache acceleration with just **one line** of code. Key features include **Unified Cache APIs**, **Forward Pattern Matching**, **Automatic Block Adapter**, **Hybrid Forward Pattern**, **DBCache**, **TaylorSeer Calibrator**, and **Cache CFG**.
175
+
176
+ ```bash
177
+ pip3 install -U cache-dit # pip3 install git+https://github.com/vipshop/cache-dit.git
178
+ ```
179
+ You can install the stable release of cache-dit from PyPI, or the latest development version from GitHub. Then try ♥️ Cache Acceleration with just **one line** of code ~ ♥️
180
+ ```python
181
+ >>> import cache_dit
182
+ >>> from diffusers import DiffusionPipeline
183
+ >>> pipe = DiffusionPipeline.from_pretrained("Qwen/Qwen-Image") # Can be any diffusion pipeline
184
+ >>> cache_dit.enable_cache(pipe) # One-line code with default cache options.
185
+ >>> output = pipe(...) # Just call the pipe as normal.
186
+ >>> stats = cache_dit.summary(pipe) # Then, get the summary of cache acceleration stats.
187
+ >>> cache_dit.disable_cache(pipe) # Disable cache and run original pipe.
188
+ ```
189
+
190
+ ### 📚Core Features
191
+
192
+ - **[🎉Full 🤗Diffusers Support](./docs/User_Guide.md#supported-pipelines)**: Notably, **[cache-dit](https://github.com/vipshop/cache-dit)** now supports nearly **all** of Diffusers' **DiT-based** pipelines, such as Qwen-Image, FLUX.1, Qwen-Image-Lightning, HunyuanImage-2.1, HunyuanVideo, HunyuanDiT, Wan 2.1/2.2, HiDream, AuraFlow, CogView3Plus, CogView4, LTXVideo, CogVideoX 1.5, ConsisID, SkyReelsV2, VisualCloze, OmniGen, Lumina, PixArt, Chroma, Sana, Allegro, Mochi, SD 3.5, Amused, and DiT-XL.
193
+ - **[🎉Extremely Easy to Use](./docs/User_Guide.md#unified-cache-apis)**: In most cases, you only need **one line** of code: `cache_dit.enable_cache(...)`. After calling this API, just use the pipeline as normal.
194
+ - **[🎉Easy New Model Integration](./docs/User_Guide.md#automatic-block-adapter)**: Features like **Unified Cache APIs**, **Forward Pattern Matching**, **Automatic Block Adapter**, **Hybrid Forward Pattern**, and **Patch Functor** make it highly functional and flexible. For example, we achieved 🎉 Day 1 support for [HunyuanImage-2.1](https://github.com/Tencent-Hunyuan/HunyuanImage-2.1) with 1.7x speedup w/o precision loss—even before it was available in the Diffusers library.
195
+ - **[🎉State-of-the-Art Performance](./bench/)**: Compared with algorithms including Δ-DiT, Chipmunk, FORA, DuCa, TaylorSeer and FoCa, cache-dit achieves the best accuracy when the speedup ratio is below 4x.
196
+ - **[🎉Support for 4/8-Steps Distilled Models](./bench/)**: Surprisingly, cache-dit's **DBCache** works for extremely few-step distilled models—something many other methods fail to do.
197
+ - **[🎉Compatibility with Other Optimizations](./docs/User_Guide.md#️torch-compile)**: Designed to work seamlessly with torch.compile, model CPU offload, sequential CPU offload, group offloading, etc.
198
+ - **[🎉Hybrid Cache Acceleration](./docs/User_Guide.md#taylorseer-calibrator)**: Now supports hybrid **DBCache + Calibrator** schemes (e.g., DBCache + TaylorSeerCalibrator). DBCache acts as the **Indicator** to decide *when* to cache, while the Calibrator decides *how* to cache. More mainstream cache acceleration algorithms (e.g., FoCa) will be supported in the future, along with additional benchmarks—stay tuned for updates!
199
+ - **[🤗Diffusers Ecosystem Integration](https://huggingface.co/docs/diffusers/main/en/optimization/cache_dit)**: 🔥**cache-dit** has joined the Diffusers community ecosystem as the **first** DiT-specific cache acceleration framework! Check out the documentation here: <a href="https://huggingface.co/docs/diffusers/main/en/optimization/cache_dit"><img src=https://img.shields.io/badge/🤗Diffusers-ecosystem-yellow.svg ></a>
200
+
201
+ ![image-reward-bench](https://github.com/vipshop/cache-dit/raw/main/assets/image-reward-bench.png)
202
+
203
+ ## 🔥Important News
204
+
205
+ - 2025.10.10: 🔥[**Qwen-Image-ControlNet-Inpainting**](https://huggingface.co/InstantX/Qwen-Image-ControlNet-Inpainting) **2.3x↑🎉** speedup! Check the [example](https://github.com/vipshop/cache-dit/blob/main/examples/pipeline/run_qwen_image_controlnet_inpaint.py).
206
+ - 2025.09.26: 🔥[**Qwen-Image-Edit-Plus(2509)**](https://github.com/QwenLM/Qwen-Image) **2.1x↑🎉** speedup! Please check the [example](https://github.com/vipshop/cache-dit/blob/main/examples/pipeline/run_qwen_image_edit_plus.py).
207
+ - 2025.09.25: 🎉The **first API-stable version (v1.0.0)** of cache-dit has finally been released!
208
+ - 2025.09.25: 🔥**cache-dit** has joined the Diffusers community ecosystem: <a href="https://huggingface.co/docs/diffusers/main/en/optimization/cache_dit"><img src=https://img.shields.io/badge/🤗Diffusers-ecosystem-yellow.svg ></a>
209
+ - 2025.09.10: 🎉Day 1 support [**HunyuanImage-2.1**](https://github.com/Tencent-Hunyuan/HunyuanImage-2.1) with **1.7x↑🎉** speedup! Check this [example](https://github.com/vipshop/cache-dit/blob/main/examples/pipeline/run_hunyuan_image_2.1.py).
210
+ - 2025.09.08: 🔥[**Qwen-Image-Lightning**](https://github.com/vipshop/cache-dit/blob/main/examples/pipeline/run_qwen_image_lightning.py) **7.1/3.5 steps🎉** inference with **[DBCache: F16B16](https://github.com/vipshop/cache-dit)**.
211
+ - 2025.09.03: 🎉[**Wan2.2-MoE**](https://github.com/Wan-Video) **2.4x↑🎉** speedup! Please refer to [run_wan_2.2.py](https://github.com/vipshop/cache-dit/blob/main/examples/pipeline/run_wan_2.2.py) as an example.
212
+ - 2025.08.19: 🔥[**Qwen-Image-Edit**](https://github.com/QwenLM/Qwen-Image) **2x↑🎉** speedup! Check the example: [run_qwen_image_edit.py](https://github.com/vipshop/cache-dit/blob/main/examples/pipeline/run_qwen_image_edit.py).
213
+ - 2025.08.11: 🔥[**Qwen-Image**](https://github.com/QwenLM/Qwen-Image) **1.8x↑🎉** speedup! Please refer to [run_qwen_image.py](https://github.com/vipshop/cache-dit/blob/main/examples/pipeline/run_qwen_image.py) as an example.
214
+
215
+ <details>
216
+ <summary>Previous News</summary>
217
+
218
+ - 2025.09.08: 🎉First caching mechanism in [Wan2.2](https://github.com/Wan-Video/Wan2.2) with **[cache-dit](https://github.com/vipshop/cache-dit)**, check this [PR](https://github.com/Wan-Video/Wan2.2/pull/127) for more details.
219
+ - 2025.09.08: 🎉First caching mechanism in [Qwen-Image-Lightning](https://github.com/ModelTC/Qwen-Image-Lightning) with **[cache-dit](https://github.com/vipshop/cache-dit)**, check this [PR](https://github.com/ModelTC/Qwen-Image-Lightning/pull/35).
220
+ - 2025.08.10: 🔥[**FLUX.1-Kontext-dev**](https://huggingface.co/black-forest-labs/FLUX.1-Kontext-dev) is supported! Please refer [run_flux_kontext.py](https://github.com/vipshop/cache-dit/blob/main/examples/pipeline/run_flux_kontext.py) as an example.
221
+ - 2025.08.12: 🎉First caching mechanism in [QwenLM/Qwen-Image](https://github.com/QwenLM/Qwen-Image) with **[cache-dit](https://github.com/vipshop/cache-dit)**, check this [PR](https://github.com/QwenLM/Qwen-Image/pull/61).
222
+ - 2025.07.18: 🎉First caching mechanism in [🤗huggingface/flux-fast](https://github.com/huggingface/flux-fast) with **[cache-dit](https://github.com/vipshop/cache-dit)**, check the [PR](https://github.com/huggingface/flux-fast/pull/13).
223
+ - 2025.07.13: 🎉[**FLUX.1-dev**](https://github.com/xlite-dev/flux-faster) **3.3x↑🎉** speedup! NVIDIA L20 with **[cache-dit](https://github.com/vipshop/cache-dit)** + **compile + FP8 DQ**.
224
+
225
+ </details>
226
+
227
+ ## 📚User Guide
228
+
229
+ <div id="user-guide"></div>
230
+
231
+ For more advanced features such as **Unified Cache APIs**, **Forward Pattern Matching**, **Automatic Block Adapter**, **Hybrid Forward Pattern**, **Patch Functor**, **DBCache**, **TaylorSeer Calibrator**, and **Hybrid Cache CFG**, please refer to the [🎉User_Guide.md](./docs/User_Guide.md) for details.
232
+
233
+ - [⚙️Installation](./docs/User_Guide.md#️installation)
234
+ - [🔥Benchmarks](./docs/User_Guide.md#benchmarks)
235
+ - [🔥Supported Pipelines](./docs/User_Guide.md#supported-pipelines)
236
+ - [🎉Unified Cache APIs](./docs/User_Guide.md#unified-cache-apis)
237
+ - [📚Forward Pattern Matching](./docs/User_Guide.md#forward-pattern-matching)
238
+ - [📚Cache with One-line Code](./docs/User_Guide.md#%EF%B8%8Fcache-acceleration-with-one-line-code)
239
+ - [🔥Automatic Block Adapter](./docs/User_Guide.md#automatic-block-adapter)
240
+ - [📚Hybird Forward Pattern](./docs/User_Guide.md#hybird-forward-pattern)
241
+ - [📚Implement Patch Functor](./docs/User_Guide.md#implement-patch-functor)
242
+ - [🤖Cache Acceleration Stats](./docs/User_Guide.md#cache-acceleration-stats-summary)
243
+ - [⚡️Dual Block Cache](./docs/User_Guide.md#️dbcache-dual-block-cache)
244
+ - [🔥TaylorSeer Calibrator](./docs/User_Guide.md#taylorseer-calibrator)
245
+ - [⚡️Hybrid Cache CFG](./docs/User_Guide.md#️hybrid-cache-cfg)
246
+ - [🛠Metrics CLI](./docs/User_Guide.md#metrics-cli)
247
+ - [⚙️Torch Compile](./docs/User_Guide.md#️torch-compile)
248
+ - [📚API Documents](./docs/User_Guide.md#api-documentation)
249
+
250
+ ## 👋Contribute
251
+ <div id="contribute"></div>
252
+
253
+ How to contribute? Star ⭐️ this repo to support us or check [CONTRIBUTE.md](https://github.com/vipshop/cache-dit/raw/main/CONTRIBUTE.md).
254
+
255
+ <div align='center'>
256
+ <a href="https://star-history.com/#vipshop/cache-dit&Date">
257
+ <picture align='center'>
258
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=vipshop/cache-dit&type=Date&theme=dark" />
259
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=vipshop/cache-dit&type=Date" />
260
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=vipshop/cache-dit&type=Date" width=400px />
261
+ </picture>
262
+ </a>
263
+ </div>
264
+
265
+ ## ©️Acknowledgements
266
+
267
+ <div id="Acknowledgements"></div>
268
+
269
+ The **cache-dit** codebase is adapted from FBCache. Over time its codebase diverged a lot, and **cache-dit** API is no longer compatible with FBCache.
270
+
271
+ ## ©️Special Acknowledgements
272
+
273
+ Special thanks to vipshop's Computer Vision AI Team for supporting document, testing and production-level deployment of this project.
274
+
275
+ ## ©️Citations
276
+
277
+ <div id="citations"></div>
278
+
279
+ ```BibTeX
280
+ @misc{cache-dit@2025,
281
+ title={cache-dit: A Unified, Flexible and Training-free Cache Acceleration Framework for Diffusers.},
282
+ url={https://github.com/vipshop/cache-dit.git},
283
+ note={Open-source software available at https://github.com/vipshop/cache-dit.git},
284
+ author={vipshop.com},
285
+ year={2025}
286
+ }
287
+ ```