From 4b6998d8c92a8ad0e93dff13f0bc2d9e40606ded Mon Sep 17 00:00:00 2001 From: Cody Yu Date: Wed, 12 Feb 2025 14:00:35 -0800 Subject: [PATCH 1/3] temp Signed-off-by: Cody Yu --- .../installation/gpu/cuda.inc.md | 15 ++++++++-- setup.py | 28 ++++++++++++++++--- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/docs/source/getting_started/installation/gpu/cuda.inc.md b/docs/source/getting_started/installation/gpu/cuda.inc.md index 5c2ea30dbfde..6a62ffffbfba 100644 --- a/docs/source/getting_started/installation/gpu/cuda.inc.md +++ b/docs/source/getting_started/installation/gpu/cuda.inc.md @@ -89,12 +89,21 @@ cd vllm VLLM_USE_PRECOMPILED=1 pip install --editable . ``` -This will download the [latest nightly wheel](https://wheels.vllm.ai/nightly/vllm-1.0.0.dev-cp38-abi3-manylinux1_x86_64.whl) and use the compiled libraries from there in the installation. +This command will do the following: +1. Look for the current branch in your vLLM clone. +2. Identify the corresponding base commit in the main branch. +3. Download the pre-built wheel of the base commit. +4. Use its compiled libraries in the installation. -The `VLLM_PRECOMPILED_WHEEL_LOCATION` environment variable can be used instead of `VLLM_USE_PRECOMPILED` to specify a custom path or URL to the wheel file. For example, to use the [0.6.1.post1 PyPi wheel](https://pypi.org/project/vllm/#files): +:::{note} +If you change C++ or kernel code, you cannot use Python-only build; otherwise you will see an import error about library not found or undefined symbol. +::: + +In case you see an error about wheel not found when running the above command, it might be because the commit you based on in the main branch was just merged and the wheel is being built. In this case, you can wait for around an hour to try again, or manually assign the previous commit in the installation using the `VLLM_PRECOMPILED_WHEEL_LOCATION` environment variable. ```console -export VLLM_PRECOMPILED_WHEEL_LOCATION=https://files.pythonhosted.org/packages/4a/4c/ee65ba33467a4c0de350ce29fbae39b9d0e7fcd887cc756fa993654d1228/vllm-0.6.3.post1-cp38-abi3-manylinux1_x86_64.whl +export VLLM_COMMIT=72d9c316d3f6ede485146fe5aabd4e61dbc59069 # use full commit hash from the main branch +export VLLM_PRECOMPILED_WHEEL_LOCATION=https://wheels.vllm.ai/${VLLM_COMMIT}/vllm-1.0.0.dev-cp38-abi3-manylinux1_x86_64.whl pip install --editable . ``` diff --git a/setup.py b/setup.py index 27e5aab760f9..67e3c7f95850 100755 --- a/setup.py +++ b/setup.py @@ -268,15 +268,35 @@ def run(self): class repackage_wheel(build_ext): """Extracts libraries and other files from an existing wheel.""" - default_wheel = "https://wheels.vllm.ai/nightly/vllm-1.0.0.dev-cp38-abi3-manylinux1_x86_64.whl" - def run(self) -> None: - wheel_location = os.getenv("VLLM_PRECOMPILED_WHEEL_LOCATION", - self.default_wheel) + def get_base_commit_in_main_branch(self) -> str: + import subprocess + + try: + current_branch = subprocess.check_output( + ["git", "branch", "--show-current"]).decode("utf-8").strip() + + base_commit = subprocess.check_output( + ["git", "merge-base", "main", + current_branch]).decode("utf-8").strip() + return base_commit + except Exception as err: + logger.warning( + "Failed to get the base commit in the main branch: %s", err) + logger.warning("Using the latest commit in the main branch as " + "the base commit. The libraries in this commit may " + "not be compatible with your dev branch.") + return "nightly" + def run(self) -> None: assert _is_cuda( ), "VLLM_USE_PRECOMPILED is only supported for CUDA builds" + wheel_location = os.getenv("VLLM_PRECOMPILED_WHEEL_LOCATION", None) + if wheel_location is None: + base_commit = self.get_base_commit_in_main_branch() + wheel_location = f"https://wheels.vllm.ai/{base_commit}/vllm-1.0.0.dev-cp38-abi3-manylinux1_x86_64.whl" + import zipfile if os.path.isfile(wheel_location): From 94cbcd86cfe108f3e11413d0f0c51912a9899aa4 Mon Sep 17 00:00:00 2001 From: Cody Yu Date: Wed, 12 Feb 2025 14:13:39 -0800 Subject: [PATCH 2/3] setup Signed-off-by: Cody Yu --- docs/source/getting_started/installation/gpu/cuda.inc.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/source/getting_started/installation/gpu/cuda.inc.md b/docs/source/getting_started/installation/gpu/cuda.inc.md index 6a62ffffbfba..948bdbffbeb7 100644 --- a/docs/source/getting_started/installation/gpu/cuda.inc.md +++ b/docs/source/getting_started/installation/gpu/cuda.inc.md @@ -96,7 +96,8 @@ This command will do the following: 4. Use its compiled libraries in the installation. :::{note} -If you change C++ or kernel code, you cannot use Python-only build; otherwise you will see an import error about library not found or undefined symbol. +1. If you change C++ or kernel code, you cannot use Python-only build; otherwise you will see an import error about library not found or undefined symbol. +2. If you rebase your dev branch, it is recommended to uninstall vllm and re-run the above command to make sure your libraries are up to date. ::: In case you see an error about wheel not found when running the above command, it might be because the commit you based on in the main branch was just merged and the wheel is being built. In this case, you can wait for around an hour to try again, or manually assign the previous commit in the installation using the `VLLM_PRECOMPILED_WHEEL_LOCATION` environment variable. From ba5670247c99e19a42c797544fd8e1de5fdb4414 Mon Sep 17 00:00:00 2001 From: Cody Yu Date: Wed, 12 Feb 2025 14:15:30 -0800 Subject: [PATCH 3/3] msg Signed-off-by: Cody Yu --- setup.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 67e3c7f95850..5a74a44c0a60 100755 --- a/setup.py +++ b/setup.py @@ -282,10 +282,9 @@ def get_base_commit_in_main_branch(self) -> str: return base_commit except Exception as err: logger.warning( - "Failed to get the base commit in the main branch: %s", err) - logger.warning("Using the latest commit in the main branch as " - "the base commit. The libraries in this commit may " - "not be compatible with your dev branch.") + "Failed to get the base commit in the main branch. " + "Using the nightly wheel. The libraries in this " + "wheel may not be compatible with your dev branch: %s", err) return "nightly" def run(self) -> None: