Skip to content

Commit d1822fa

Browse files
committed
up
Signed-off-by: Rui Qiao <[email protected]>
1 parent 9111a91 commit d1822fa

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

vllm/v1/engine/core.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,12 @@ def _initialize_kv_caches(self,
8383
kv_cache_config = get_kv_cache_config(vllm_config, kv_cache_spec,
8484
available_gpu_memory)
8585
kv_cache_configs.append(kv_cache_config)
86-
assert len(set(config.num_blocks for config in kv_cache_configs)) == 1, \
87-
f"num_gpu_blocks need to be the same across workers: {num_gpu_blocks} != {kv_cache_config.num_blocks}"
88-
num_gpu_blocks = kv_cache_configs[0].num_blocks
86+
num_gpu_blocks_set = set(config.num_blocks
87+
for config in kv_cache_configs)
88+
assert len(num_gpu_blocks_set) == 1, (
89+
f"num_gpu_blocks need to be the same across workers, "
90+
f"but they are different: {num_gpu_blocks_set}")
91+
num_gpu_blocks = num_gpu_blocks_set.pop()
8992
num_cpu_blocks = 0
9093

9194
# Initialize kv cache and warmup the execution

0 commit comments

Comments
 (0)