vipshop/cache-dit
A PyTorch-native inference engine with cache, parallelism, quantization and cpu offload for DiTs.
What it solves
Generating images, videos, and audio with modern Diffusion Transformer (DiT) models can be slow and memory-hungry, especially for large models that need heavy computation. Cache-DiT tackles this by providing a single, easy-to-use layer that makes DiT inference faster and more memory-efficient, without requiring users to rewrite their existing pipelines.
How it works
Cache-DiT builds on the Hugging Face Diffusers library and adds several acceleration techniques that work together:
- Hybrid cache acceleration (e.g., DBCache, TaylorSeer, SCM) reuses intermediate results to skip redundant computations.
- Parallelism splits the work across multiple devices or processors using Context Parallelism, Tensor Parallelism, and combined 2D/3D parallelism. It also has dedicated support for parallelizing the text encoder, VAE, and ControlNet components.
- Quantization reduces the precision of model weights (like SVDQuant) to cut memory usage and speed up math, with both post-training quantization (PTQ) and distribution-aware quantization (DQ) options.
- Bucket-style layerwise CPU offload moves parts of the model to CPU memory when they are not being used, so large models can run on a single GPU with limited VRAM.
You enable these features with just a few lines of code around your existing Diffusers pipeline, then call the pipeline as usual. Cache-DiT is compatible with other optimizations like compilation and integrates with runtimes such as SGLang Diffusion, vLLM-Omni, TensorRT-LLM, and xDiT.
Who it’s for
Developers, researchers, and engineers who work with DiT-based generative models (image, video, audio, and even 3D shapes) and need to run them faster or on limited hardware. It is especially useful for production deployments where many model variants must be supported without changing the application logic. Cache-DiT runs on NVIDIA GPUs, Huawei Ascend NPUs, and AMD GPUs.
Highlights
- Supports 60+ pipeline families and 150+ variants from Diffusers, covering most DiT-based models.
- One-line cache enablement:
cache_dit.enable_cache(pipe)for instant speedup. - Hybrid cache, parallelism, quantization, and offload can be combined through simple config objects.
- Built-in pipelines beyond Diffusers for newer models like Pika H3 Flex, SANA-Video 2.0, and more.
- Reports up to 9x speedup when combining cache, context parallelism, and compilation.
- Works on multiple hardware backends (NVIDIA, Huawei, AMD).
Related
- Project
- Project
- Project
- Dispatch
- Project