A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 14, 05:30 UTC
Directly get max encoder len from VLLM config in V1 (#24866)
Signed-off-by: Sugar-zsg <952242923@qq.com>
Sugar committed
Sep 17, 2025 at 01:52 UTC
cd1f885bcfe3b1731c552495ce70d2abf63d1373
1 file changed
+7
-4
vllm/attention/layers/cross_attention.py
+7
-4
@@ -14,7 +14,6 @@ from vllm.attention.layer import Attention
14
from vllm.attention.selector import get_attn_backend
15
from vllm.config import CacheConfig, VllmConfig
16
from vllm.logger import init_logger
17
-from vllm.multimodal import MULTIMODAL_REGISTRY
17
from vllm.utils import cdiv
18
from vllm.v1.attention.backends.utils import (CommonAttentionMetadata,
19
subclass_attention_backend)
@@ -23,9 +22,13 @@ from vllm.v1.kv_cache_interface import CrossAttentionSpec
22
logger = init_logger(__name__)
23
24
26
-def _get_max_encoder_len(vllm_config: VllmConfig) -> int:
27
- return MULTIMODAL_REGISTRY.get_encdec_max_encoder_len(
28
- vllm_config.model_config)
25
+def _get_max_encoder_len(vllm_config: "VllmConfig") -> int:
26
+ """Gets the max number of encoder input tokens from the config.
27
+ """
28
+ sc = vllm_config.scheduler_config
29
+ assert sc and isinstance(sc.max_num_encoder_input_tokens, int), \
30
+ "max_num_encoder_input_tokens must be int for enc-dec models"
31
+ return sc.max_num_encoder_input_tokens
32
33
34
def _get_cross_slot_mapping(encoder_seq_lens: np.ndarray,