[Hardware][openvino] is_openvino --> current_platform.is_openvino (#9716)

This commit is contained in:
Mengqing Cao
2024-10-26 10:59:06 +00:00
committed by GitHub
parent 067e77f9a8
commit 5cbdccd151
10 changed files with 69 additions and 38 deletions
+31
View File
@@ -0,0 +1,31 @@
import torch
import vllm.envs as envs
from vllm.utils import print_warning_once
from .interface import Platform, PlatformEnum
class OpenVinoPlatform(Platform):
_enum = PlatformEnum.OPENVINO
@classmethod
def get_device_name(self, device_id: int = 0) -> str:
return "openvino"
@classmethod
def inference_mode(self):
return torch.inference_mode(mode=True)
@classmethod
def is_openvino_cpu(self) -> bool:
return "CPU" in envs.VLLM_OPENVINO_DEVICE
@classmethod
def is_openvino_gpu(self) -> bool:
return "GPU" in envs.VLLM_OPENVINO_DEVICE
@classmethod
def is_pin_memory_available(self) -> bool:
print_warning_once("Pin memory is not supported on OpenViNO.")
return False