From 101435817a71298f083b0a015509b16a898ea813 Mon Sep 17 00:00:00 2001 From: handsomezhuzhu <2658601135@qq.com> Date: Tue, 10 Feb 2026 19:42:32 +0800 Subject: [PATCH] fix: add initialize_cache method to NPU worker --- vllm_npu/worker/worker_v1.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vllm_npu/worker/worker_v1.py b/vllm_npu/worker/worker_v1.py index 7cb7bfe..772e524 100644 --- a/vllm_npu/worker/worker_v1.py +++ b/vllm_npu/worker/worker_v1.py @@ -184,6 +184,12 @@ class NPUWorker(WorkerBase): def get_kv_cache_spec(self) -> KVCacheSpec: return self.model_runner.get_kv_cache_spec() + def initialize_cache(self, num_gpu_blocks: int, + num_cpu_blocks: int) -> None: + """Store the number of KV cache blocks.""" + self.cache_config.num_gpu_blocks = num_gpu_blocks + self.cache_config.num_cpu_blocks = num_cpu_blocks + def initialize_from_config(self, kv_cache_config: KVCacheConfig) -> None: """Allocate KV caches on NPU.""" self.model_runner.initialize_kv_cache(kv_cache_config)