Skip to content
المشاريع

حول

محرك استدلال أصلي لـ PyTorch، يوفّر التخزين المؤقت والتوازي والتكميم ونقل البيانات إلى وحدة المعالجة المركزية (CPU) لتفريغ الذاكرة المستخدمة في DiTs.

الذكاء الاصطناعي وتعلّم الآلة

كيف تُقاس هذه الأرقام

النمو المقاس للنجوم

خلال 24 ساعة
٠
خلال 7 أيام
+٤
خلال 15 يومًا
+٩
خلال شهر
+١٦

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل

⚡️🎉A PyTorch-native Inference Engine with Cache,
Parallelism, Quantization and CPU Offload for DiTs
Featured|HelloGitHub

Cache-DiT is fast, easy to use, and flexible for various DiTs. It is a PyTorch-native inference engine with cache, quantization, offload, parallelism and attention backends (FA-2/3, ffpa-attn, Sage-2/3), and runs natively on NVIDIA GPUs, Huawei Ascend NPUs and AMD GPUs. It covers 60+ DiT pipeline families (150+ Variants).

🚀Quick Start

pip install -U "cache-dit[core]" # core: cache, parallelism, quantization and serving.
# cu13 wheel: CUDA extensions (SVDQuant-W{2,3,4,6,8}-A{4,6,8}, FP8/FP6/FP4 communication, etc).
pip install -U "cache-dit[core]" --extra-index-url https://vipshop.github.io/cache-dit/whl/cu13/

Generate CLI: The FLUX command below demonstrates the cache_dit.generate CLI with cache acceleration, parallelism, FP6 communication, FP8 GEMM/attention and compilation.

# FP6 Ulysses (CP4) + Cache + FP8 GEMM + FP8 Attn + Compile (PRO 5000: 16.7s -> ⚡️1.57s).
CUDA_VISIBLE_DEVICES=0,1,2,3 python3 -m cache_dit.generate black-forest-labs/FLUX.1-dev \
  --prompt "A cat holding a sign that says hello world" \
  --parallel-config 'ulysses=4' \
  --quant-communicate-config 'bits=6' \
  --cache-config 'DBCache,rdt=0.15' \
  --calibrator-config 'taylorseer,order=1' \
  --quantize-config 'float8_per_row' \
  --attn-config 'FFPA,bits=8' \
  --compile-config 'transformer'

Serve CLI: To serve a model through the OpenAI-compatible API, use cache_dit.serve. The MiniMax-H3 command below is the validated eight-GPU full recipe for T2VA:

# TP2 + Ulysses4 + TE/VAE-P + Cache + FP8 GEMM + FP4 Attn + Compile (PRO 5000: 1027s -> ⚡️53s).
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python3 -m cache_dit.serve MiniMaxAI/MiniMax-H3 \
  --parallel-config 'ulysses=4,tp=2,ulysses_anything=true,text=true,vae=true' \
  --quant-communicate-config 'bits=6' \
  --cache-config 'DBCache,rdt=0.12' \
  --quantize-config 'float8_per_row' \
  --attn-config 'FFPA,bits=4' \
  --compile-config 'transformer' \
  --port 8000

Call the OpenAI-compatible videos endpoint with a prompt; size, frames, and sampling use the server defaults:

curl -s http://localhost:8000/v1/videos --json '{"prompt":"The astronaut crosses the lunar surface as the camera pushes in towards the crater rim, dust drifting in the low gravity, earthrise on the horizon, cinematic."}'

Quantization workflow: Quantization is a train-free path from a full-precision checkpoint to a smaller, faster one. For example, you can convert the model once into a self-contained directory, then serve that directory with FFPA 8-bit attention and a compiled transformer:

# 1) Convert: NVFP4 transformer + FP8 weight-only text encoder once (31G -> 14G).
python3 -m cache_dit.convert Qwen/Qwen-Image-2.1-Turbo \
  --quantize-config 'nvfp4,text:float8_wo' \
  --save-dir QUANT_DIR

# 2) Serve the quantized checkpoint (PRO 5000 BF16: 3.50s -> NVFP4: ⚡️1.60s).
CUDA_VISIBLE_DEVICES=0 python3 -m cache_dit.serve QUANT_DIR \
  --attn-config 'FFPA,bits=8' \
  --compile-config 'transformer' \
  --port 8000

Then, query the OpenAI-compatible endpoint and decode. Three prompts, identical seeds: BF16 baseline (left of each pair) vs NVFP4 + FFPA (bits=8) served from the converted directory (right).

curl -s http://localhost:8000/v1/images/generations --json '{"prompt": "A glass teapot on a sunlit wooden table, steam curling upward, soft morning light.", "size": "1024x1024", "seed": 0, "response_format": "b64_json", "output_format": "png"}'

More commands: 📘quick examples. Detailed usage and the full documentation are available at 📘cache-dit.io.

🌐Community Integration

Cache-DiT is integrated with xDiT, ComfyUI, TensorRT-LLM, SGLang Omni, SGLang Diffusion, vLLM-Omni, and SD.Next. Cache-DiT is also recommended for use with Diffusers, Nunchaku, and MindIE-SD.

©️Acknowledgements

Special thanks to vipshop's Computer Vision AI Team for supporting testing and deployment of this project. We learned and reused codes from: Diffusers, SGLang, vLLM-Omni, Nunchaku, xDiT and TaylorSeer.

©️Citations

@misc{cache-dit@2025,
  title={Cache-DiT: A PyTorch-native Inference Engine with Cache, Parallelism, Quantization and CPU Offload 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, etc.},
  year={2025}
}

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…