Skip to content

Repository files navigation

ChituDiffusion

中文  ·  English

支持 EPE、Fast CP、NCCL CP 与 FlexCache 的 Diffusers 推理运行时

Python CUDA License

ChituDiffusion 基于 Diffusers 生命周期提供模型生成、上下文并行、缓存加速和常驻服务。

项目处于开发者预览阶段。服务不保证任意 rank 故障后的恢复。

核心能力

提供 Fast AGKV 与 Fast Ulysses,并保留 NCCL fallback。面向具备 GPU P2P、 NVSHMEM 和目标架构扩展的兼容单机环境优化通信路径。

根据实测代价和端到端 SLO,在 pulse 边界调整 CP lane,并通过统一 executor 处理 队列、状态迁移和 worker 生命周期。

提供 MagCache、MeanCache、TeaCache、TaylorSeer 与 PAB 的统一 API,可叠加单卡或 静态 CP。查看 速度与质量评测

保留 tokenizer、文本编码器、scheduler、VAE 和输出处理流程,只适配模型相关的 DiT 执行与 tensor 布局。

支持模型

模型 生成能力 并行与服务能力
FLUX.1 文生图 NCCL/Fast CP、EPE executor、FlexCache model spec
FLUX.2-klein 文生图 固定 full-world 静态 CP
Hunyuan Image 3 固定尺寸文生图与图生图基础服务链路 可配置 TP×CFG×CP×EP decoder(72 GiB 参考配置 TP2×CFG2×CP2×EP2)、NCCL/Fast AGKV/Fast Ulysses、EPE static CP、变长 expert dispatch、独立 VAEP
MiniMax-H3 T2VA、first/last-frame FL2VA 基础服务链路 TP×CP DiT、EPE、Fast Ulysses/NCCL CP、独立 VAEP、音视频解码与 MP4 输出
Qwen-Image 文生图 NCCL/Fast CP、EPE executor
Wan 2.1 T2V 文生视频 NCCL/Fast CP、EPE executor、FlexCache profiles
Z-Image 文生图 NCCL/Fast CP、统一 EPE 服务入口、FlexCache integration

安装

要求 Linux、Python 3.12 或 3.13、NVIDIA GPU 和可用的 CUDA 环境。按机器 CUDA 版本选择 pyproject.toml 中的 PyTorch index,然后运行:

uv sync --group dev
source .venv/bin/activate
chitu --help

pyproject.toml 是唯一构建入口。

生成

chitu generate \
  --model zimage \
  --model-path /path/to/Z-Image \
  --prompt "a red cube on a white table" \
  --output outputs/zimage.png

静态多卡 NCCL CP:

torchrun --standalone --nproc-per-node=4 -m chitu_diffusion.cli \
  generate \
  --model flux1 \
  --model-path /path/to/FLUX.1-dev \
  --output outputs/flux1.png

单机 TP×CFG×CP×EP MoE,例如 Hunyuan Image 3 的默认 8 卡拓扑:

torchrun --standalone --nproc-per-node=8 -m chitu_diffusion.cli \
  generate \
  --model hunyuan-image3 \
  --model-path /path/to/HunyuanImage-3 \
  --steps 50 \
  --output outputs/hunyuan_image3.png

Fast CP 需要兼容的单机 GPU、GPU P2P、NVSHMEM 和针对目标环境编译的扩展。参数和安装 步骤见 Fast CP README

FlexCache

chitu generate \
  --model wan \
  --model-path /path/to/Wan2.1-T2V-1.3B \
  --steps 50 \
  --cache-strategy magcache \
  --output outputs/wan-magcache.mp4

缓存支持与模型、步数和 profile 绑定。不支持的组合会在运行前报错。原理、支持范围和 测试结果见 FlexCache 文档

EPE 服务

chitu serve --stage-config examples/stage-zimage.yaml

所有 rank 进入服务生命周期,leader 提供 HTTP,其他 rank 执行 worker loop。配置和 限制见运行说明EPE 文档

文档与开发

python -m pytest -q
python -m ruff check chitu_diffusion tests examples
python -m build
mkdocs build --strict

许可证

MIT License


ChituDiffusion

中文  ·  English

Diffusers inference with EPE, Fast CP, NCCL CP, and FlexCache

Python CUDA License

ChituDiffusion provides model generation, context parallelism, cache acceleration, and persistent serving while preserving the Diffusers pipeline lifecycle.

The project is a developer preview. The service does not recover from an arbitrary rank failure.

Core capabilities

Fast AGKV and Fast Ulysses with an NCCL fallback. The fast paths target compatible single-node systems with GPU P2P, NVSHMEM, and extensions built for the target architecture.

Adjusts CP lanes at pulse boundaries using measured costs and end-to-end SLOs, with one executor lifecycle for queues, state migration, and workers.

One API for MagCache, MeanCache, TeaCache, TaylorSeer, and PAB, composable with single-GPU or static CP generation. See the speed and quality evaluations.

Preserves tokenizers, text encoders, schedulers, VAEs, and output processing. Adapters only supply model-specific DiT execution and tensor layouts.

Supported models

Model Generation Parallelism and serving
FLUX.1 Text to image NCCL/Fast CP, EPE executor, and FlexCache model spec
FLUX.2-klein Text to image Fixed full-world static CP
Hunyuan Image 3 Foundational fixed-size text-to-image and image-to-image service path Configurable TP×CFG×CP×EP decoder (72 GiB reference: TP2×CFG2×CP2×EP2), NCCL/Fast AGKV/Fast Ulysses, EPE static CP, variable-length expert dispatch, and independent VAEP
MiniMax-H3 Foundational T2VA and first/last-frame FL2VA service path TP×CP DiT, EPE, Fast Ulysses/NCCL CP, independent VAEP, audio/video decode, and MP4 output
Qwen-Image Text to image NCCL/Fast CP and EPE executor
Wan 2.1 T2V Text to video NCCL/Fast CP, EPE executor, and FlexCache profiles
Z-Image Text to image NCCL/Fast CP, unified EPE serving, and FlexCache integration

Installation

ChituDiffusion requires Linux, Python 3.12 or 3.13, an NVIDIA GPU, and a working CUDA environment. Select the matching PyTorch index in pyproject.toml, then run:

uv sync --group dev
source .venv/bin/activate
chitu --help

pyproject.toml is the only build entry point.

Generation

chitu generate \
  --model zimage \
  --model-path /path/to/Z-Image \
  --prompt "a red cube on a white table" \
  --output outputs/zimage.png

Static multi-GPU NCCL CP:

torchrun --standalone --nproc-per-node=4 -m chitu_diffusion.cli \
  generate \
  --model flux1 \
  --model-path /path/to/FLUX.1-dev \
  --output outputs/flux1.png

A single-node TP×CFG×CP×EP MoE stage, for example Hunyuan Image 3 on its default eight-GPU topology:

torchrun --standalone --nproc-per-node=8 -m chitu_diffusion.cli \
  generate \
  --model hunyuan-image3 \
  --model-path /path/to/HunyuanImage-3 \
  --steps 50 \
  --output outputs/hunyuan_image3.png

Fast CP requires compatible single-node GPUs, GPU P2P, NVSHMEM, and extensions built for the target environment. See the Fast CP README.

FlexCache

chitu generate \
  --model wan \
  --model-path /path/to/Wan2.1-T2V-1.3B \
  --steps 50 \
  --cache-strategy magcache \
  --output outputs/wan-magcache.mp4

Cache support is tied to the model, step count, and profile. Unsupported combinations fail before execution. See the FlexCache documentation for principles, support, and measured results.

EPE serving

chitu serve --stage-config examples/stage-zimage.yaml

All ranks enter the service lifecycle. The leader hosts HTTP while the remaining ranks execute worker loops. See the running guide and EPE documentation.

Documentation and development

python -m pytest -q
python -m ruff check chitu_diffusion tests examples
python -m build
mkdocs build --strict

License

MIT License

Releases

Packages

Contributors

Languages