vllm/docs/source/getting_started/installation.rst

89 lines
2.5 KiB
ReStructuredText
Raw Normal View History

2023-06-18 01:26:12 +08:00
.. _installation:
2023-05-22 17:02:44 -07:00
Installation
============
vLLM is a Python library that also contains pre-compiled C++ and CUDA (12.1) binaries.
Requirements
------------
2023-05-27 01:13:06 -07:00
* OS: Linux
* Python: 3.8 -- 3.11
* GPU: compute capability 7.0 or higher (e.g., V100, T4, RTX20xx, A100, L4, H100, etc.)
2023-05-27 01:13:06 -07:00
Install with pip
----------------
2023-06-17 03:07:40 -07:00
You can install vLLM using pip:
2023-05-27 01:13:06 -07:00
.. code-block:: console
$ # (Optional) Create a new conda environment.
$ conda create -n myenv python=3.9 -y
2023-05-27 01:13:06 -07:00
$ conda activate myenv
$ # Install vLLM with CUDA 12.1.
$ pip install vllm
2023-05-27 01:13:06 -07:00
.. note::
As of now, vLLM's binaries are compiled on CUDA 12.1 by default.
However, you can install vLLM with CUDA 11.8 by running:
.. code-block:: console
$ # Install vLLM with CUDA 11.8.
$ export VLLM_VERSION=0.2.4
$ export PYTHON_VERSION=39
$ pip install https://github.com/vllm-project/vllm/releases/download/v${VLLM_VERSION}/vllm-${VLLM_VERSION}+cu118-cp${PYTHON_VERSION}-cp${PYTHON_VERSION}-manylinux1_x86_64.whl
$ # Re-install PyTorch with CUDA 11.8.
$ pip uninstall torch -y
$ pip install torch --upgrade --index-url https://download.pytorch.org/whl/cu118
$ # Re-install xFormers with CUDA 11.8.
$ pip uninstall xformers -y
$ pip install --upgrade xformers --index-url https://download.pytorch.org/whl/cu118
2023-05-27 01:13:06 -07:00
.. _build_from_source:
2023-05-22 17:02:44 -07:00
Build from source
-----------------
You can also build and install vLLM from source:
2023-05-27 01:13:06 -07:00
2023-05-22 17:02:44 -07:00
.. code-block:: console
2023-06-19 20:03:40 -07:00
$ git clone https://github.com/vllm-project/vllm.git
2023-06-17 03:07:40 -07:00
$ cd vllm
2023-05-27 01:13:06 -07:00
$ pip install -e . # This may take 5-10 minutes.
.. tip::
To avoid your system being overloaded, you can limit the number of compilation jobs
to be run simultaneously, via the environment variable `MAX_JOBS`. For example:
.. code-block:: console
$ export MAX_JOBS=6
$ pip install -e .
.. tip::
If you have trouble building vLLM, we recommend using the NVIDIA PyTorch Docker image.
.. code-block:: console
$ # Use `--ipc=host` to make sure the shared memory is large enough.
$ docker run --gpus all -it --rm --ipc=host nvcr.io/nvidia/pytorch:23.10-py3
.. note::
If you are developing the C++ backend of vLLM, consider building vLLM with
.. code-block:: console
$ python setup.py develop
since it will give you incremental builds. The downside is that this method
is `deprecated by setuptools <https://github.com/pypa/setuptools/issues/917>`_.