[Cache Refactor 1/N] Simplify CacheDiT Integration (#2527)

Signed-off-by: Alex Brooks <albrooks@redhat.com>
This commit is contained in:
Alex Brooks authored and GitHub committed 2026-06-20 08:30:44 +08:00
1 parent 951ae28eb0
commit 6ff246bf3c
21 files changed
+508 -1332

No files matched your search

@@ -9,6 +9,7 @@ from typing import TYPE_CHECKING, Any
import torch
import torch.nn as nn
import torch.nn.functional as F
from cache_dit import ForwardPattern
from diffusers.models.modeling_outputs import Transformer2DModelOutput
from diffusers.models.transformers.transformer_glm_image import GlmImageCombinedTimestepSizeEmbeddings
from vllm.logger import init_logger
@@ -20,6 +21,8 @@ from vllm.model_executor.layers.linear import (
)
from vllm.model_executor.model_loader.weight_utils import default_weight_loader
from vllm_omni.diffusion.cache.cache_dit_backend import CacheDiTAdapterConfig
if TYPE_CHECKING:
from vllm.model_executor.layers.quantization.base_config import QuantizationConfig
@@ -935,6 +938,13 @@ class GlmImageTransformer2DModel(CachedTransformer):
`od_config.tf_model_config`.
"""
_cache_dit_adapter_config = CacheDiTAdapterConfig(
block_forward_patterns={
"transformer_blocks": ForwardPattern.Pattern_0,
},
has_separate_cfg=True,
)
_repeated_blocks = ["GlmImageTransformerBlock"]
# SP plan using GlmImagePrepare module for sharding hidden_states and RoPE together.
# Similar to Qwen-Image's ImageRopePrepare, this creates a module boundary where