[Mamba] enable prefix cache by default (#50991)
Signed-off-by: zjy0516 <riverclouds.zhu@qq.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent
7b50d2c0bc
commit
f9c74b4b9c
@@ -135,10 +135,10 @@ class CacheConfig:
|
||||
"""The cache strategy for Mamba layers:
|
||||
|
||||
- "none": set when prefix caching is disabled.
|
||||
- "all": cache the mamba state of all tokens at position i * block_size. This is
|
||||
the default behavior (for models that support it) when prefix caching is enabled.
|
||||
- "all": cache the mamba state of all tokens at position i * block_size.
|
||||
- "align": only cache the mamba state of the last token of each scheduler step and
|
||||
when the token is at position i * block_size.
|
||||
when the token is at position i * block_size. This is the default when prefix
|
||||
caching is enabled.
|
||||
"""
|
||||
replayssm_buffer_len: int = Field(default=16, gt=0)
|
||||
"""ReplaySSM history buffer length B: with use_replayssm, standard decode
|
||||
|
||||
@@ -2587,11 +2587,7 @@ class EngineArgs:
|
||||
self, model_config: ModelConfig
|
||||
) -> None:
|
||||
default_chunked_prefill = model_config.is_chunked_prefill_supported
|
||||
# Hybrid models support prefix caching but keep it opt-in for now
|
||||
# while the feature matures.
|
||||
default_prefix_caching = (
|
||||
model_config.is_prefix_caching_supported and not model_config.is_hybrid
|
||||
)
|
||||
default_prefix_caching = model_config.is_prefix_caching_supported
|
||||
|
||||
if self.enable_chunked_prefill is None:
|
||||
self.enable_chunked_prefill = default_chunked_prefill
|
||||
|
||||
@@ -595,10 +595,8 @@ class MambaModelConfig(VerifyAndUpdateConfig):
|
||||
|
||||
if cache_config.enable_prefix_caching:
|
||||
if cache_config.mamba_cache_mode == "none":
|
||||
cache_config.mamba_cache_mode = (
|
||||
"all" if model_config.supports_mamba_prefix_caching else "align"
|
||||
)
|
||||
logger.warning(
|
||||
cache_config.mamba_cache_mode = "align"
|
||||
logger.info(
|
||||
"Mamba cache mode is set to '%s' for %s by default "
|
||||
"when prefix caching is enabled",
|
||||
cache_config.mamba_cache_mode,
|
||||
@@ -618,13 +616,6 @@ class MambaModelConfig(VerifyAndUpdateConfig):
|
||||
assert vllm_config.scheduler_config.enable_chunked_prefill, (
|
||||
"Chunked prefill is required for mamba cache mode 'align'."
|
||||
)
|
||||
logger.info(
|
||||
"Warning: Prefix caching in Mamba cache '%s' "
|
||||
"mode is currently enabled. "
|
||||
"Its support for Mamba layers is experimental. "
|
||||
"Please report any issues you may observe.",
|
||||
cache_config.mamba_cache_mode,
|
||||
)
|
||||
# By default, mamba block size will be set to max_model_len (see
|
||||
# below). When enabling prefix caching, we align mamba block size
|
||||
# to the block size as the basic granularity for prefix caching.
|
||||
|
||||
Reference in New Issue
Block a user