[CPU] Refactor CPU attention backend (#27954)
Signed-off-by: jiang1.li <jiang1.li@intel.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
|
||||
from contextlib import contextmanager
|
||||
from typing import TYPE_CHECKING, Any
|
||||
from typing import Any
|
||||
|
||||
import torch
|
||||
import torch.nn as nn
|
||||
@@ -12,9 +12,6 @@ from vllm.model_executor.model_loader import get_model
|
||||
from vllm.v1.utils import CpuGpuBuffer
|
||||
from vllm.v1.worker.gpu_model_runner import GPUModelRunner
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from vllm.v1.core.sched.output import SchedulerOutput
|
||||
|
||||
logger = init_logger(__name__)
|
||||
|
||||
|
||||
@@ -31,15 +28,6 @@ class CPUModelRunner(GPUModelRunner):
|
||||
|
||||
self._postprocess_tensors()
|
||||
|
||||
# Note: Remove the override after new attention backend finished
|
||||
def _may_reorder_batch(self, scheduler_output: "SchedulerOutput") -> None:
|
||||
if len(self.kv_cache_config.kv_cache_groups) > 1:
|
||||
raise ValueError(
|
||||
"Multiple KVCacheGroups is not"
|
||||
"currently supported with CPU model runner."
|
||||
)
|
||||
super()._may_reorder_batch(scheduler_output)
|
||||
|
||||
def _postprocess_tensors(self) -> None:
|
||||
# Note: replace device tensors with cpu tensors
|
||||
def replace_tensor(obj: Any, cpu_attr_name: str, device_attr_name) -> None:
|
||||
|
||||
Reference in New Issue
Block a user