From 74bb395c967af2aaf2f03d6ad57173ef8cba9195 Mon Sep 17 00:00:00 2001 From: "Kevin H. Luu" Date: Mon, 10 Feb 2025 00:39:29 -0800 Subject: [PATCH 1/2] Update setup.py --- setup.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/setup.py b/setup.py index 3e2adadf6704..4bd768ef4d3f 100755 --- a/setup.py +++ b/setup.py @@ -47,11 +47,6 @@ def load_module_from_path(module_name, path): "Building on %s, " "so vLLM may not be able to run correctly", sys.platform) VLLM_TARGET_DEVICE = "empty" -elif (sys.platform.startswith("linux") and torch.version.cuda is None - and os.getenv("VLLM_TARGET_DEVICE") is None): - # if cuda is not available and VLLM_TARGET_DEVICE is not set, - # fallback to cpu - VLLM_TARGET_DEVICE = "cpu" MAIN_CUDA_VERSION = "12.1" @@ -519,8 +514,7 @@ def get_vllm_version() -> str: elif _is_tpu(): version += f"{sep}tpu" elif _is_cpu(): - if envs.VLLM_TARGET_DEVICE == "cpu": - version += f"{sep}cpu" + version += f"{sep}cpu" elif _is_xpu(): version += f"{sep}xpu" else: From 7e2170d4789ae9da578131ecf33c190d37d0f5a7 Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 10 Feb 2025 09:22:20 +0000 Subject: [PATCH 2/2] fix Signed-off-by: kevin --- setup.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4bd768ef4d3f..27e5aab760f9 100755 --- a/setup.py +++ b/setup.py @@ -47,6 +47,12 @@ def load_module_from_path(module_name, path): "Building on %s, " "so vLLM may not be able to run correctly", sys.platform) VLLM_TARGET_DEVICE = "empty" +elif (sys.platform.startswith("linux") and torch.version.cuda is None + and os.getenv("VLLM_TARGET_DEVICE") is None + and torch.version.hip is None): + # if cuda or hip is not available and VLLM_TARGET_DEVICE is not set, + # fallback to cpu + VLLM_TARGET_DEVICE = "cpu" MAIN_CUDA_VERSION = "12.1" @@ -514,7 +520,8 @@ def get_vllm_version() -> str: elif _is_tpu(): version += f"{sep}tpu" elif _is_cpu(): - version += f"{sep}cpu" + if envs.VLLM_TARGET_DEVICE == "cpu": + version += f"{sep}cpu" elif _is_xpu(): version += f"{sep}xpu" else: