From faa7a5daac8244376a3a182d6eee8d2e0f6d8127 Mon Sep 17 00:00:00 2001 From: lianyibo Date: Wed, 17 Sep 2025 01:36:58 +0800 Subject: [PATCH] [Bugfix] Fix unable to run encoder model when disable_hybrid_kv_cache_manager is true (#24571) Signed-off-by: lianyibo Co-authored-by: Chen Zhang --- vllm/v1/core/kv_cache_utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vllm/v1/core/kv_cache_utils.py b/vllm/v1/core/kv_cache_utils.py index f225b73264049..9fab36aba91b3 100644 --- a/vllm/v1/core/kv_cache_utils.py +++ b/vllm/v1/core/kv_cache_utils.py @@ -754,6 +754,10 @@ def is_kv_cache_type_uniform(kv_cache_spec: dict[str, KVCacheSpec]) -> bool: True if all layers have the same type, False otherwise. """ + if not kv_cache_spec: + # Encoder-only models do not have KV cache, kv_cache_type can be + # regarded as uniform. + return True try: kv_cache_spec_values = list(kv_cache_spec.values()) _ = kv_cache_spec_values[0].merge(kv_cache_spec_values)