[Chore] Bump Python version and apply formatting changes for v0.12 release (#126)
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
1 parent
31fedcfa2b
commit
c091a03d82
61 files changed
+534
-553
No files matched your search
+4
-3
@@ -7,7 +7,8 @@ This module provides a CacheDiTBackend class to enable cache-dit acceleration on
|
||||
pipelines in vllm-omni, supporting both single and dual-transformer architectures.
|
||||
"""
|
||||
|
||||
from typing import Any, Callable, Optional
|
||||
from collections.abc import Callable
|
||||
from typing import Any, Optional
|
||||
|
||||
from vllm.logger import init_logger
|
||||
|
||||
@@ -311,8 +312,8 @@ class CacheDiTBackend(CacheBackend):
|
||||
super().__init__(config)
|
||||
|
||||
# Cache-dit specific attributes
|
||||
self._refresh_func: Optional[Callable[[Any, int, bool], None]] = None
|
||||
self._last_num_inference_steps: Optional[int] = None
|
||||
self._refresh_func: Callable[[Any, int, bool], None] | None = None
|
||||
self._last_num_inference_steps: int | None = None
|
||||
|
||||
def enable(self, pipeline: Any) -> None:
|
||||
"""Enable cache-dit on the pipeline if configured.
|
||||
|
||||
+1
-2
@@ -2,7 +2,6 @@
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
||||
# Model-specific polynomial coefficients for rescaling L1 distances
|
||||
# These coefficients account for model-specific characteristics in how embeddings change
|
||||
@@ -51,7 +50,7 @@ class TeaCacheConfig:
|
||||
"""
|
||||
|
||||
rel_l1_thresh: float = 0.2
|
||||
coefficients: Optional[list[float]] = None
|
||||
coefficients: list[float] | None = None
|
||||
model_type: str = "QwenImagePipeline"
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
|
||||
+3
-2
@@ -13,8 +13,9 @@ all model-specific information needed for generic caching, including preprocessi
|
||||
transformer execution, and postprocessing logic.
|
||||
"""
|
||||
|
||||
from collections.abc import Callable
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, Callable, Union
|
||||
from typing import Any
|
||||
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
@@ -146,7 +147,7 @@ def extract_qwen_context(
|
||||
hidden_states: torch.Tensor,
|
||||
encoder_hidden_states: torch.Tensor,
|
||||
encoder_hidden_states_mask: torch.Tensor,
|
||||
timestep: Union[torch.Tensor, float, int],
|
||||
timestep: torch.Tensor | float | int,
|
||||
img_shapes: torch.Tensor,
|
||||
txt_seq_lens: torch.Tensor,
|
||||
guidance: torch.Tensor | None = None,
|
||||
|
||||
+3
-5
@@ -7,8 +7,6 @@ TeaCache state management.
|
||||
This module manages the state for TeaCache hooks across diffusion timesteps.
|
||||
"""
|
||||
|
||||
from typing import Optional
|
||||
|
||||
import torch
|
||||
|
||||
|
||||
@@ -27,9 +25,9 @@ class TeaCacheState:
|
||||
|
||||
# Caching state
|
||||
self.accumulated_rel_l1_distance = 0.0
|
||||
self.previous_modulated_input: Optional[torch.Tensor] = None
|
||||
self.previous_residual: Optional[torch.Tensor] = None
|
||||
self.previous_residual_encoder: Optional[torch.Tensor] = None
|
||||
self.previous_modulated_input: torch.Tensor | None = None
|
||||
self.previous_residual: torch.Tensor | None = None
|
||||
self.previous_residual_encoder: torch.Tensor | None = None
|
||||
|
||||
def reset(self) -> None:
|
||||
"""Reset all state variables for a new inference run."""
|
||||
|
||||
Reference in new issue
Block a user