[Config] Infer HiSparse attention config from HiSparseConnector (#57041)
Signed-off-by: NickLucche <nicolo.lucchesi@mistral.ai>
This commit is contained in:
@@ -88,7 +88,9 @@ class AttentionConfig:
|
||||
|
||||
hisparse_config: HiSparseConfig | None = None
|
||||
"""HiSparse host-resident KV configuration. Setting this enables experimental
|
||||
Model Runner V2-only HiSparse sparse-MLA decode hot-buffering."""
|
||||
Model Runner V2-only HiSparse sparse-MLA decode hot-buffering. It is inferred
|
||||
with defaults when HiSparseConnector is configured (directly or via
|
||||
MultiConnector); set it explicitly only to tune its fields."""
|
||||
|
||||
use_non_causal: bool = False
|
||||
"""Whether to use non-causal (bidirectional) attention."""
|
||||
|
||||
+8
-1
@@ -27,7 +27,7 @@ from vllm.triton_utils import HAS_TRITON
|
||||
from vllm.utils import random_uuid
|
||||
from vllm.utils.hashing import safe_hash
|
||||
|
||||
from .attention import AttentionConfig
|
||||
from .attention import AttentionConfig, HiSparseConfig
|
||||
from .cache import CacheConfig
|
||||
from .compilation import CompilationConfig, CompilationMode, CUDAGraphMode
|
||||
from .device import DeviceConfig
|
||||
@@ -1630,6 +1630,13 @@ class VllmConfig:
|
||||
self._maybe_disable_dynamic_sd_for_data_parallel()
|
||||
self._maybe_override_dynamic_sd_cudagraph_mode()
|
||||
|
||||
if (
|
||||
self.attention_config.hisparse_config is None
|
||||
and self.kv_transfer_config is not None
|
||||
and self.kv_transfer_config.has_connector("HiSparseConnector")
|
||||
):
|
||||
self.attention_config.hisparse_config = HiSparseConfig()
|
||||
|
||||
if self.attention_config.hisparse_config is not None:
|
||||
if not current_platform.is_cuda():
|
||||
raise ValueError("HiSparse currently requires NVIDIA CUDA.")
|
||||
|
||||
Reference in New Issue
Block a user