[Cache Refactor 1/N] Simplify CacheDiT Integration (#2527)
Signed-off-by: Alex Brooks <albrooks@redhat.com>
This commit is contained in:
1 parent
951ae28eb0
commit
6ff246bf3c
21 files changed
+508
-1332
No files matched your search
@@ -6,6 +6,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.embeddings import (
|
||||
CombinedTimestepGuidanceTextProjEmbeddings,
|
||||
CombinedTimestepTextProjEmbeddings,
|
||||
@@ -25,6 +26,7 @@ from vllm.model_executor.layers.linear import (
|
||||
from vllm.model_executor.model_loader.weight_utils import default_weight_loader
|
||||
|
||||
from vllm_omni.diffusion.attention.backends.abstract import AttentionMetadata
|
||||
from vllm_omni.diffusion.cache.cache_dit_backend import CacheDiTAdapterConfig
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from vllm.model_executor.layers.quantization.base_config import QuantizationConfig
|
||||
@@ -524,6 +526,13 @@ class FluxTransformer2DModel(nn.Module):
|
||||
The dimensions to use for the rotary positional embeddings.
|
||||
"""
|
||||
|
||||
_cache_dit_adapter_config = CacheDiTAdapterConfig(
|
||||
block_forward_patterns={
|
||||
"transformer_blocks": ForwardPattern.Pattern_1,
|
||||
"single_transformer_blocks": ForwardPattern.Pattern_1,
|
||||
}
|
||||
)
|
||||
|
||||
# the small and frequently-repeated block(s) of a model
|
||||
# -- typically a transformer layer
|
||||
# used for torch compile optimizations
|
||||
|
||||
Reference in new issue
Block a user