-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Build] Make pypi install work on CPU platform #12874
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,11 @@ 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" | ||
|
||
|
@@ -482,7 +487,6 @@ def get_vllm_version() -> str: | |
version = get_version( | ||
write_to="vllm/_version.py", # TODO: move this to pyproject.toml | ||
) | ||
|
||
sep = "+" if "+" not in version else "." # dev versions might contain + | ||
|
||
if _no_device(): | ||
|
@@ -520,7 +524,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" | ||
Comment on lines
-523
to
+528
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need this guard now for cpu? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a little tricky here. Like L491 does,
it's used for check if the When users build vllm by hand like When use |
||
elif _is_xpu(): | ||
version += f"{sep}xpu" | ||
else: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to check for torch.version.hip alongside torch.version.cuda, otherwise on ROCm it'll fall back to CPU