Skip to main content

A PyTorch-native and Flexible Inference Engine with Hybrid Cache Acceleration and Parallelism for ๐Ÿค—DiTs.

Project description

A PyTorch-native and Flexible Inference Engine with
Hybrid Cache Acceleration and Parallelism for ๐Ÿค—DiTs
Featured๏ฝœHelloGitHub

Baseline SCM S S* SCM F D* SCM U D* +TS +compile +FP8*
24.85s 15.4s 11.4s 8.2s 8.2s ๐ŸŽ‰7.1s ๐ŸŽ‰4.5s

Scheme: DBCache + SCM(steps_computation_mask) + TS(TaylorSeer) + FP8*, L20x1, S*: static cache,
D*: dynamic cache, S: Slow, F: Fast, U: Ultra Fast, TS: TaylorSeer, FP8*: FP8 DQ + Sage, FLUX.1-Dev

SGLang Diffusion x Cache-DiT News vLLM Omni x Cache-DiT News

๐Ÿ”ฅHightlight

We are excited to announce that the ๐ŸŽ‰v1.1.0 version of cache-dit has finally been released! It brings ๐Ÿ”ฅContext Parallelism and ๐Ÿ”ฅTensor Parallelism to cache-dit, thus making it a PyTorch-native and Flexible Inference Engine for ๐Ÿค—DiTs. Key features: Unified Cache APIs, Forward Pattern Matching, Block Adapter, DBCache, DBPrune, Cache CFG, TaylorSeer, SCM, Context Parallelism (w/ UAA), Tensor Parallelism and ๐ŸŽ‰SOTA performance.

pip3 install -U cache-dit # Also, pip3 install git+https://github.com/huggingface/diffusers.git (latest)

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 ~ โ™ฅ๏ธ

>>> import cache_dit
>>> from diffusers import DiffusionPipeline
>>> pipe = DiffusionPipeline.from_pretrained("Qwen/Qwen-Image") # Can be any diffusion pipeline
>>> cache_dit.enable_cache(pipe) # One-line code with default cache options.
>>> output = pipe(...) # Just call the pipe as normal.
>>> stats = cache_dit.summary(pipe) # Then, get the summary of cache acceleration stats.
>>> cache_dit.disable_cache(pipe) # Disable cache and run original pipe.

๐Ÿ“šCore Features

๐Ÿ”ฅSupported DiTs

[!Tip] One Model Series may contain many pipelines. cache-dit applies optimizations at the Transformer level; so, any pipelines that include the supported transformer are already supported by cache-dit. โœ…: known work and official supported now; โœ–๏ธ: unofficial supported now, but maybe support in the future; Q: 4-bits models w/ nunchaku W4A4; TE: Text Encoder Parallelism; ๐Ÿ’กC*: Hybrid Cache Acceleration.

๐Ÿ“šModel C* CP TP TE ๐Ÿ“šModel C* CP TP TE
๐Ÿ”ฅZ-Image โœ… โœ… โœ… โœ… ๐Ÿ”ฅZ-Image-Control โœ–๏ธ โœ–๏ธ โœ… โœ…
๐Ÿ”ฅOvis-Image โœ… โœ… โœ… โœ… ๐Ÿ”ฅHuyuanVideo 1.5 โœ… โœ–๏ธ โœ–๏ธ โœ…
๐Ÿ”ฅFLUX.2 โœ… โœ… โœ… โœ… ๐ŸŽ‰FLUX.1 Q โœ… โœ… โœ–๏ธ โœ…
๐ŸŽ‰FLUX.1 โœ… โœ… โœ… โœ… ๐ŸŽ‰Qwen-Image Q โœ… โœ… โœ–๏ธ โœ…
๐ŸŽ‰Qwen-Image โœ… โœ… โœ… โœ… ๐ŸŽ‰Qwen...Edit Q โœ… โœ… โœ–๏ธ โœ…
๐ŸŽ‰Qwen...Edit โœ… โœ… โœ… โœ… ๐ŸŽ‰Qwen.E.Plus Q โœ… โœ… โœ–๏ธ โœ…
๐ŸŽ‰Qwen..Light โœ… โœ… โœ… โœ… ๐ŸŽ‰Qwen...Light Q โœ… โœ… โœ–๏ธ โœ…
๐ŸŽ‰Wan 2.2 T2V/ITV โœ… โœ… โœ… โœ… ๐ŸŽ‰Qwen.E.Light Q โœ… โœ… โœ–๏ธ โœ…
๐ŸŽ‰Wan 2.2 VACE โœ… โœ… โœ… โœ… ๐ŸŽ‰Mochi โœ… โœ–๏ธ โœ… โœ…
๐ŸŽ‰Wan 2.1 T2V/ITV โœ… โœ… โœ… โœ… ๐ŸŽ‰HiDream โœ… โœ–๏ธ โœ–๏ธ โœ…
๐ŸŽ‰Wan 2.1 VACE โœ… โœ… โœ… โœ… ๐ŸŽ‰HunyuanDiT โœ… โœ–๏ธ โœ… โœ…
๐ŸŽ‰HunyuanVideo โœ… โœ… โœ… โœ… ๐ŸŽ‰Sana โœ… โœ–๏ธ โœ–๏ธ โœ…
๐ŸŽ‰ChronoEdit โœ… โœ… โœ… โœ… ๐ŸŽ‰Bria โœ… โœ–๏ธ โœ–๏ธ โœ…
๐ŸŽ‰CogVideoX โœ… โœ… โœ… โœ… ๐ŸŽ‰SkyReelsV2 โœ… โœ… โœ… โœ…
๐ŸŽ‰CogVideoX 1.5 โœ… โœ… โœ… โœ… ๐ŸŽ‰Lumina 1/2 โœ… โœ–๏ธ โœ… โœ…
๐ŸŽ‰CogView4 โœ… โœ… โœ… โœ… ๐ŸŽ‰DiT-XL โœ… โœ… โœ–๏ธ โœ…
๐ŸŽ‰CogView3Plus โœ… โœ… โœ… โœ… ๐ŸŽ‰Allegro โœ… โœ–๏ธ โœ–๏ธ โœ…
๐ŸŽ‰PixArt Sigma โœ… โœ… โœ… โœ… ๐ŸŽ‰Cosmos โœ… โœ–๏ธ โœ–๏ธ โœ…
๐ŸŽ‰PixArt Alpha โœ… โœ… โœ… โœ… ๐ŸŽ‰OmniGen โœ… โœ–๏ธ โœ–๏ธ โœ…
๐ŸŽ‰Chroma-HD โœ… โœ… ๏ธโœ… โœ… ๐ŸŽ‰EasyAnimate โœ… โœ–๏ธ โœ–๏ธ โœ…
๐ŸŽ‰VisualCloze โœ… โœ… โœ… โœ… ๐ŸŽ‰StableDiffusion3 โœ… โœ–๏ธ โœ–๏ธ โœ…
๐ŸŽ‰HunyuanImage โœ… โœ… โœ… โœ… ๐ŸŽ‰PRX T2I โœ… โœ–๏ธ โœ–๏ธ โœ…
๐ŸŽ‰Kandinsky5 โœ… โœ…๏ธ โœ…๏ธ โœ… ๐ŸŽ‰Amused โœ… โœ–๏ธ โœ–๏ธ โœ…
๐ŸŽ‰LTXVideo โœ… โœ… โœ… โœ… ๐ŸŽ‰AuraFlow โœ… โœ–๏ธ โœ–๏ธ โœ…
๐ŸŽ‰ConsisID โœ… โœ… โœ… โœ… ๐ŸŽ‰LongCatVideo โœ… โœ–๏ธ โœ–๏ธ โœ…
๐Ÿ”ฅClick here to show many Image/Video cases๐Ÿ”ฅ

๐ŸŽ‰Now, cache-dit covers almost All Diffusers' DiT Pipelines๐ŸŽ‰
๐Ÿ”ฅQwen-Image | Qwen-Image-Edit | Qwen-Image-Edit-Plus ๐Ÿ”ฅ
๐Ÿ”ฅFLUX.1 | Qwen-Image-Lightning 4/8 Steps | Wan 2.1 | Wan 2.2 ๐Ÿ”ฅ
๐Ÿ”ฅHunyuanImage-2.1 | HunyuanVideo | HunyuanDiT | HiDream | AuraFlow๐Ÿ”ฅ
๐Ÿ”ฅCogView3Plus | CogView4 | LTXVideo | CogVideoX | CogVideoX 1.5 | ConsisID๐Ÿ”ฅ
๐Ÿ”ฅCosmos | SkyReelsV2 | VisualCloze | OmniGen 1/2 | Lumina 1/2 | PixArt๐Ÿ”ฅ
๐Ÿ”ฅChroma | Sana | Allegro | Mochi | SD 3/3.5 | Amused | ... | DiT-XL๐Ÿ”ฅ

๐Ÿ”ฅWan2.2 MoE | +cache-dit:2.0xโ†‘๐ŸŽ‰ | HunyuanVideo | +cache-dit:2.1xโ†‘๐ŸŽ‰

๐Ÿ”ฅQwen-Image | +cache-dit:1.8xโ†‘๐ŸŽ‰ | FLUX.1-dev | +cache-dit:2.1xโ†‘๐ŸŽ‰

๐Ÿ”ฅQwen...Lightning | +cache-dit:1.14xโ†‘๐ŸŽ‰ | HunyuanImage | +cache-dit:1.7xโ†‘๐ŸŽ‰

๐Ÿ”ฅQwen-Image-Edit | Input w/o Edit | Baseline | +cache-dit:1.6xโ†‘๐ŸŽ‰ | 1.9xโ†‘๐ŸŽ‰

๐Ÿ”ฅFLUX-Kontext-dev | Baseline | +cache-dit:1.3xโ†‘๐ŸŽ‰ | 1.7xโ†‘๐ŸŽ‰ | 2.0xโ†‘ ๐ŸŽ‰

๐Ÿ”ฅHiDream-I1 | +cache-dit:1.9xโ†‘๐ŸŽ‰ | CogView4 | +cache-dit:1.4xโ†‘๐ŸŽ‰ | 1.7xโ†‘๐ŸŽ‰

๐Ÿ”ฅCogView3 | +cache-dit:1.5xโ†‘๐ŸŽ‰ | 2.0xโ†‘๐ŸŽ‰| Chroma1-HD | +cache-dit:1.9xโ†‘๐ŸŽ‰

๐Ÿ”ฅMochi-1-preview | +cache-dit:1.8xโ†‘๐ŸŽ‰ | SkyReelsV2 | +cache-dit:1.6xโ†‘๐ŸŽ‰

๐Ÿ”ฅVisualCloze-512 | Model | Cloth | Baseline | +cache-dit:1.4xโ†‘๐ŸŽ‰ | 1.7xโ†‘๐ŸŽ‰

๐Ÿ”ฅLTX-Video-0.9.7 | +cache-dit:1.7xโ†‘๐ŸŽ‰ | CogVideoX1.5 | +cache-dit:2.0xโ†‘๐ŸŽ‰

๐Ÿ”ฅOmniGen-v1 | +cache-dit:1.5xโ†‘๐ŸŽ‰ | 3.3xโ†‘๐ŸŽ‰ | Lumina2 | +cache-dit:1.9xโ†‘๐ŸŽ‰

๐Ÿ”ฅAllegro | +cache-dit:1.36xโ†‘๐ŸŽ‰ | AuraFlow-v0.3 | +cache-dit:2.27xโ†‘๐ŸŽ‰

๐Ÿ”ฅSana | +cache-dit:1.3xโ†‘๐ŸŽ‰ | 1.6xโ†‘๐ŸŽ‰| PixArt-Sigma | +cache-dit:2.3xโ†‘๐ŸŽ‰

๐Ÿ”ฅPixArt-Alpha | +cache-dit:1.6xโ†‘๐ŸŽ‰ | 1.8xโ†‘๐ŸŽ‰| SD 3.5 | +cache-dit:2.5xโ†‘๐ŸŽ‰

๐Ÿ”ฅAsumed | +cache-dit:1.1xโ†‘๐ŸŽ‰ | 1.2xโ†‘๐ŸŽ‰ | DiT-XL-256 | +cache-dit:1.8xโ†‘๐ŸŽ‰
โ™ฅ๏ธ Please consider to leave a โญ๏ธ Star to support us ~ โ™ฅ๏ธ

๐Ÿ“–Table of Contents

For more advanced features such as Unified Cache APIs, Forward Pattern Matching, Automatic Block Adapter, Hybrid Forward Pattern, Patch Functor, DBCache, DBPrune, TaylorSeer Calibrator, SCM, Hybrid Cache CFG, Context Parallelism (w/ UAA) and Tensor Parallelism, please refer to the ๐ŸŽ‰User_Guide.md for details.

๐Ÿš€Quick Links

  • ๐Ÿ“ŠExamples - The easiest way to enable hybrid cache acceleration and parallelism for DiTs with cache-dit is to start with our examples for popular models: FLUX, Z-Image, Qwen-Image, Wan, etc.
  • ๐ŸŒHTTP Serving - Deploy cache-dit models with HTTP API for text-to-image, image editing, multi-image editing, and text-to-video generation.
  • โ“FAQ - Frequently asked questions including attention backend configuration, troubleshooting, and optimization tips.

๐Ÿ“šDocumentation

๐Ÿ‘‹Contribute

How to contribute? Star โญ๏ธ this repo to support us or check CONTRIBUTE.md.

๐ŸŽ‰Projects Using CacheDiT

Here is a curated list of open-source projects integrating CacheDiT, including popular repositories like jetson-containers, flux-fast, sdnext, ๐Ÿ”ฅvLLM-Omni, and ๐Ÿ”ฅSGLang Diffusion. ๐ŸŽ‰CacheDiT has been recommended by many famous opensource projects: ๐Ÿ”ฅZ-Image, ๐Ÿ”ฅWan 2.2, ๐Ÿ”ฅQwen-Image, ๐Ÿ”ฅLongCat-Video, Qwen-Image-Lightning, Kandinsky-5, LeMiCa, ๐Ÿค—diffusers, HelloGitHub and GaintPandaCV.

ยฉ๏ธAcknowledgements

Special thanks to vipshop's Computer Vision AI Team for supporting document, testing and production-level deployment of this project. We learned the design and reused code from the following projects: ๐Ÿค—diffusers, SGLang, ParaAttention, xDiT, TaylorSeer and LeMiCa.

ยฉ๏ธCitations

@misc{cache-dit@2025,
  title={cache-dit: A PyTorch-native and Flexible Inference Engine with Hybrid Cache Acceleration and Parallelism for DiTs.},
  url={https://github.com/vipshop/cache-dit.git},
  note={Open-source software available at https://github.com/vipshop/cache-dit.git},
  author={DefTruth, vipshop.com},
  year={2025}
}

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cache_dit-1.1.9-py3-none-any.whl (258.1 kB view details)

Uploaded Python 3

File details

Details for the file cache_dit-1.1.9-py3-none-any.whl.

File metadata

  • Download URL: cache_dit-1.1.9-py3-none-any.whl
  • Upload date:
  • Size: 258.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for cache_dit-1.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 65aab5aaed9acbaaaefca3ce7d19d9796cccdd19f3943fff6ece5309ebe2636a
MD5 9c9f6aecc439d26a5fa0af2dc7daf3e5
BLAKE2b-256 e9a182765fde11ce63c89def01e3418245cc84eceb06ce6a2ceacfa10ae37a21

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page