"tests/vscode:/vscode.git/clone" did not exist on "1be5a73571ab2e2570b79a7474c98c496cc80de2"
Unverified Commit dd6a3a02 authored by Harry Mellor's avatar Harry Mellor Committed by GitHub
Browse files

[Doc] Convert docs to use colon fences (#12471)


Signed-off-by: default avatarHarry Mellor <19981378+hmellor@users.noreply.github.com>
parent a7e3eba6
sphinx==6.2.1 sphinx==6.2.1
sphinx-argparse==0.4.0
sphinx-book-theme==1.0.1 sphinx-book-theme==1.0.1
sphinx-copybutton==0.5.2 sphinx-copybutton==0.5.2
myst-parser==3.0.1
sphinx-argparse==0.4.0
sphinx-design==0.6.1 sphinx-design==0.6.1
sphinx-togglebutton==0.3.2 sphinx-togglebutton==0.3.2
myst-parser==3.0.1
msgspec msgspec
cloudpickle cloudpickle
......
...@@ -8,10 +8,10 @@ ...@@ -8,10 +8,10 @@
.. currentmodule:: vllm.engine .. currentmodule:: vllm.engine
``` ```
```{toctree} :::{toctree}
:caption: Engines :caption: Engines
:maxdepth: 2 :maxdepth: 2
llm_engine llm_engine
async_llm_engine async_llm_engine
``` :::
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
## Submodules ## Submodules
```{toctree} :::{toctree}
:maxdepth: 1 :maxdepth: 1
interfaces_base interfaces_base
interfaces interfaces
adapters adapters
``` :::
...@@ -17,7 +17,7 @@ Looking to add your own multi-modal model? Please follow the instructions listed ...@@ -17,7 +17,7 @@ Looking to add your own multi-modal model? Please follow the instructions listed
## Submodules ## Submodules
```{toctree} :::{toctree}
:maxdepth: 1 :maxdepth: 1
inputs inputs
...@@ -25,4 +25,4 @@ parse ...@@ -25,4 +25,4 @@ parse
processing processing
profiling profiling
registry registry
``` :::
# Offline Inference # Offline Inference
```{toctree} :::{toctree}
:caption: Contents :caption: Contents
:maxdepth: 1 :maxdepth: 1
llm llm
llm_inputs llm_inputs
``` :::
...@@ -17,11 +17,11 @@ The edges of the build graph represent: ...@@ -17,11 +17,11 @@ The edges of the build graph represent:
- `RUN --mount=(.\*)from=...` dependencies (with a dotted line and an empty diamond arrow head) - `RUN --mount=(.\*)from=...` dependencies (with a dotted line and an empty diamond arrow head)
> ```{figure} /assets/contributing/dockerfile-stages-dependency.png > :::{figure} /assets/contributing/dockerfile-stages-dependency.png
> :align: center > :align: center
> :alt: query > :alt: query
> :width: 100% > :width: 100%
> ``` > :::
> >
> Made using: <https://github.com/patrickhoefler/dockerfilegraph> > Made using: <https://github.com/patrickhoefler/dockerfilegraph>
> >
......
...@@ -10,9 +10,9 @@ First, clone the PyTorch model code from the source repository. ...@@ -10,9 +10,9 @@ First, clone the PyTorch model code from the source repository.
For instance, vLLM's [OPT model](gh-file:vllm/model_executor/models/opt.py) was adapted from For instance, vLLM's [OPT model](gh-file:vllm/model_executor/models/opt.py) was adapted from
HuggingFace's [modeling_opt.py](https://github.com/huggingface/transformers/blob/main/src/transformers/models/opt/modeling_opt.py) file. HuggingFace's [modeling_opt.py](https://github.com/huggingface/transformers/blob/main/src/transformers/models/opt/modeling_opt.py) file.
```{warning} :::{warning}
Make sure to review and adhere to the original code's copyright and licensing terms! Make sure to review and adhere to the original code's copyright and licensing terms!
``` :::
## 2. Make your code compatible with vLLM ## 2. Make your code compatible with vLLM
...@@ -80,10 +80,10 @@ def forward( ...@@ -80,10 +80,10 @@ def forward(
... ...
``` ```
```{note} :::{note}
Currently, vLLM supports the basic multi-head attention mechanism and its variant with rotary positional embeddings. Currently, vLLM supports the basic multi-head attention mechanism and its variant with rotary positional embeddings.
If your model employs a different attention mechanism, you will need to implement a new attention layer in vLLM. If your model employs a different attention mechanism, you will need to implement a new attention layer in vLLM.
``` :::
For reference, check out our [Llama implementation](gh-file:vllm/model_executor/models/llama.py). vLLM already supports a large number of models. It is recommended to find a model similar to yours and adapt it to your model's architecture. Check out <gh-dir:vllm/model_executor/models> for more examples. For reference, check out our [Llama implementation](gh-file:vllm/model_executor/models/llama.py). vLLM already supports a large number of models. It is recommended to find a model similar to yours and adapt it to your model's architecture. Check out <gh-dir:vllm/model_executor/models> for more examples.
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
This section provides more information on how to integrate a [PyTorch](https://pytorch.org/) model into vLLM. This section provides more information on how to integrate a [PyTorch](https://pytorch.org/) model into vLLM.
```{toctree} :::{toctree}
:caption: Contents :caption: Contents
:maxdepth: 1 :maxdepth: 1
...@@ -12,16 +12,16 @@ basic ...@@ -12,16 +12,16 @@ basic
registration registration
tests tests
multimodal multimodal
``` :::
```{note} :::{note}
The complexity of adding a new model depends heavily on the model's architecture. The complexity of adding a new model depends heavily on the model's architecture.
The process is considerably straightforward if the model shares a similar architecture with an existing model in vLLM. The process is considerably straightforward if the model shares a similar architecture with an existing model in vLLM.
However, for models that include new operators (e.g., a new attention mechanism), the process can be a bit more complex. However, for models that include new operators (e.g., a new attention mechanism), the process can be a bit more complex.
``` :::
```{tip} :::{tip}
If you are encountering issues while integrating your model into vLLM, feel free to open a [GitHub issue](https://github.com/vllm-project/vllm/issues) If you are encountering issues while integrating your model into vLLM, feel free to open a [GitHub issue](https://github.com/vllm-project/vllm/issues)
or ask on our [developer slack](https://slack.vllm.ai). or ask on our [developer slack](https://slack.vllm.ai).
We will be happy to help you out! We will be happy to help you out!
``` :::
...@@ -48,9 +48,9 @@ Further update the model as follows: ...@@ -48,9 +48,9 @@ Further update the model as follows:
return vision_embeddings return vision_embeddings
``` ```
```{important} :::{important}
The returned `multimodal_embeddings` must be either a **3D {class}`torch.Tensor`** of shape `(num_items, feature_size, hidden_size)`, or a **list / tuple of 2D {class}`torch.Tensor`'s** of shape `(feature_size, hidden_size)`, so that `multimodal_embeddings[i]` retrieves the embeddings generated from the `i`-th multimodal data item (e.g, image) of the request. The returned `multimodal_embeddings` must be either a **3D {class}`torch.Tensor`** of shape `(num_items, feature_size, hidden_size)`, or a **list / tuple of 2D {class}`torch.Tensor`'s** of shape `(feature_size, hidden_size)`, so that `multimodal_embeddings[i]` retrieves the embeddings generated from the `i`-th multimodal data item (e.g, image) of the request.
``` :::
- Implement {meth}`~vllm.model_executor.models.interfaces.SupportsMultiModal.get_input_embeddings` to merge `multimodal_embeddings` with text embeddings from the `input_ids`. If input processing for the model is implemented correctly (see sections below), then you can leverage the utility function we provide to easily merge the embeddings. - Implement {meth}`~vllm.model_executor.models.interfaces.SupportsMultiModal.get_input_embeddings` to merge `multimodal_embeddings` with text embeddings from the `input_ids`. If input processing for the model is implemented correctly (see sections below), then you can leverage the utility function we provide to easily merge the embeddings.
...@@ -89,10 +89,10 @@ Further update the model as follows: ...@@ -89,10 +89,10 @@ Further update the model as follows:
+ class YourModelForImage2Seq(nn.Module, SupportsMultiModal): + class YourModelForImage2Seq(nn.Module, SupportsMultiModal):
``` ```
```{note} :::{note}
The model class does not have to be named {code}`*ForCausalLM`. The model class does not have to be named {code}`*ForCausalLM`.
Check out [the HuggingFace Transformers documentation](https://huggingface.co/docs/transformers/model_doc/auto#multimodal) for some examples. Check out [the HuggingFace Transformers documentation](https://huggingface.co/docs/transformers/model_doc/auto#multimodal) for some examples.
``` :::
## 2. Specify processing information ## 2. Specify processing information
...@@ -120,8 +120,8 @@ When calling the model, the output embeddings from the visual encoder are assign ...@@ -120,8 +120,8 @@ When calling the model, the output embeddings from the visual encoder are assign
containing placeholder feature tokens. Therefore, the number of placeholder feature tokens should be equal containing placeholder feature tokens. Therefore, the number of placeholder feature tokens should be equal
to the size of the output embeddings. to the size of the output embeddings.
::::{tab-set} :::::{tab-set}
:::{tab-item} Basic example: LLaVA ::::{tab-item} Basic example: LLaVA
:sync: llava :sync: llava
Looking at the code of HF's `LlavaForConditionalGeneration`: Looking at the code of HF's `LlavaForConditionalGeneration`:
...@@ -254,12 +254,12 @@ def get_mm_max_tokens_per_item(self, seq_len: int) -> Mapping[str, int]: ...@@ -254,12 +254,12 @@ def get_mm_max_tokens_per_item(self, seq_len: int) -> Mapping[str, int]:
return {"image": self.get_max_image_tokens()} return {"image": self.get_max_image_tokens()}
``` ```
```{note} :::{note}
Our [actual code](gh-file:vllm/model_executor/models/llava.py) is more abstracted to support vision encoders other than CLIP. Our [actual code](gh-file:vllm/model_executor/models/llava.py) is more abstracted to support vision encoders other than CLIP.
```
::: :::
:::: ::::
:::::
## 3. Specify dummy inputs ## 3. Specify dummy inputs
...@@ -315,17 +315,17 @@ def get_dummy_processor_inputs( ...@@ -315,17 +315,17 @@ def get_dummy_processor_inputs(
Afterwards, create a subclass of {class}`~vllm.multimodal.processing.BaseMultiModalProcessor` Afterwards, create a subclass of {class}`~vllm.multimodal.processing.BaseMultiModalProcessor`
to fill in the missing details about HF processing. to fill in the missing details about HF processing.
```{seealso} :::{seealso}
[Multi-Modal Data Processing](#mm-processing) [Multi-Modal Data Processing](#mm-processing)
``` :::
### Multi-modal fields ### Multi-modal fields
Override {class}`~vllm.multimodal.processing.BaseMultiModalProcessor._get_mm_fields_config` to Override {class}`~vllm.multimodal.processing.BaseMultiModalProcessor._get_mm_fields_config` to
return a schema of the tensors outputted by the HF processor that are related to the input multi-modal items. return a schema of the tensors outputted by the HF processor that are related to the input multi-modal items.
::::{tab-set} :::::{tab-set}
:::{tab-item} Basic example: LLaVA ::::{tab-item} Basic example: LLaVA
:sync: llava :sync: llava
Looking at the model's `forward` method: Looking at the model's `forward` method:
...@@ -367,13 +367,13 @@ def _get_mm_fields_config( ...@@ -367,13 +367,13 @@ def _get_mm_fields_config(
) )
``` ```
```{note} :::{note}
Our [actual code](gh-file:vllm/model_executor/models/llava.py) additionally supports Our [actual code](gh-file:vllm/model_executor/models/llava.py) additionally supports
pre-computed image embeddings, which can be passed to be model via the `image_embeds` argument. pre-computed image embeddings, which can be passed to be model via the `image_embeds` argument.
```
::: :::
:::: ::::
:::::
### Prompt replacements ### Prompt replacements
......
...@@ -17,17 +17,17 @@ After you have implemented your model (see [tutorial](#new-model-basic)), put it ...@@ -17,17 +17,17 @@ After you have implemented your model (see [tutorial](#new-model-basic)), put it
Then, add your model class to `_VLLM_MODELS` in <gh-file:vllm/model_executor/models/registry.py> so that it is automatically registered upon importing vLLM. Then, add your model class to `_VLLM_MODELS` in <gh-file:vllm/model_executor/models/registry.py> so that it is automatically registered upon importing vLLM.
Finally, update our [list of supported models](#supported-models) to promote your model! Finally, update our [list of supported models](#supported-models) to promote your model!
```{important} :::{important}
The list of models in each section should be maintained in alphabetical order. The list of models in each section should be maintained in alphabetical order.
``` :::
## Out-of-tree models ## Out-of-tree models
You can load an external model using a plugin without modifying the vLLM codebase. You can load an external model using a plugin without modifying the vLLM codebase.
```{seealso} :::{seealso}
[vLLM's Plugin System](#plugin-system) [vLLM's Plugin System](#plugin-system)
``` :::
To register the model, use the following code: To register the model, use the following code:
...@@ -45,11 +45,11 @@ from vllm import ModelRegistry ...@@ -45,11 +45,11 @@ from vllm import ModelRegistry
ModelRegistry.register_model("YourModelForCausalLM", "your_code:YourModelForCausalLM") ModelRegistry.register_model("YourModelForCausalLM", "your_code:YourModelForCausalLM")
``` ```
```{important} :::{important}
If your model is a multimodal model, ensure the model class implements the {class}`~vllm.model_executor.models.interfaces.SupportsMultiModal` interface. If your model is a multimodal model, ensure the model class implements the {class}`~vllm.model_executor.models.interfaces.SupportsMultiModal` interface.
Read more about that [here](#supports-multimodal). Read more about that [here](#supports-multimodal).
``` :::
```{note} :::{note}
Although you can directly put these code snippets in your script using `vllm.LLM`, the recommended way is to place these snippets in a vLLM plugin. This ensures compatibility with various vLLM features like distributed inference and the API server. Although you can directly put these code snippets in your script using `vllm.LLM`, the recommended way is to place these snippets in a vLLM plugin. This ensures compatibility with various vLLM features like distributed inference and the API server.
``` :::
...@@ -14,14 +14,14 @@ Without them, the CI for your PR will fail. ...@@ -14,14 +14,14 @@ Without them, the CI for your PR will fail.
Include an example HuggingFace repository for your model in <gh-file:tests/models/registry.py>. Include an example HuggingFace repository for your model in <gh-file:tests/models/registry.py>.
This enables a unit test that loads dummy weights to ensure that the model can be initialized in vLLM. This enables a unit test that loads dummy weights to ensure that the model can be initialized in vLLM.
```{important} :::{important}
The list of models in each section should be maintained in alphabetical order. The list of models in each section should be maintained in alphabetical order.
``` :::
```{tip} :::{tip}
If your model requires a development version of HF Transformers, you can set If your model requires a development version of HF Transformers, you can set
`min_transformers_version` to skip the test in CI until the model is released. `min_transformers_version` to skip the test in CI until the model is released.
``` :::
## Optional Tests ## Optional Tests
......
...@@ -35,17 +35,17 @@ pre-commit run --all-files ...@@ -35,17 +35,17 @@ pre-commit run --all-files
pytest tests/ pytest tests/
``` ```
```{note} :::{note}
Currently, the repository is not fully checked by `mypy`. Currently, the repository is not fully checked by `mypy`.
``` :::
## Issues ## Issues
If you encounter a bug or have a feature request, please [search existing issues](https://github.com/vllm-project/vllm/issues?q=is%3Aissue) first to see if it has already been reported. If not, please [file a new issue](https://github.com/vllm-project/vllm/issues/new/choose), providing as much relevant information as possible. If you encounter a bug or have a feature request, please [search existing issues](https://github.com/vllm-project/vllm/issues?q=is%3Aissue) first to see if it has already been reported. If not, please [file a new issue](https://github.com/vllm-project/vllm/issues/new/choose), providing as much relevant information as possible.
```{important} :::{important}
If you discover a security vulnerability, please follow the instructions [here](gh-file:SECURITY.md#reporting-a-vulnerability). If you discover a security vulnerability, please follow the instructions [here](gh-file:SECURITY.md#reporting-a-vulnerability).
``` :::
## Pull Requests & Code Reviews ## Pull Requests & Code Reviews
...@@ -81,9 +81,9 @@ appropriately to indicate the type of change. Please use one of the following: ...@@ -81,9 +81,9 @@ appropriately to indicate the type of change. Please use one of the following:
- `[Misc]` for PRs that do not fit the above categories. Please use this - `[Misc]` for PRs that do not fit the above categories. Please use this
sparingly. sparingly.
```{note} :::{note}
If the PR spans more than one category, please include all relevant prefixes. If the PR spans more than one category, please include all relevant prefixes.
``` :::
### Code Quality ### Code Quality
......
...@@ -6,21 +6,21 @@ The OpenAI server also needs to be started with the `VLLM_TORCH_PROFILER_DIR` en ...@@ -6,21 +6,21 @@ The OpenAI server also needs to be started with the `VLLM_TORCH_PROFILER_DIR` en
When using `benchmarks/benchmark_serving.py`, you can enable profiling by passing the `--profile` flag. When using `benchmarks/benchmark_serving.py`, you can enable profiling by passing the `--profile` flag.
```{warning} :::{warning}
Only enable profiling in a development environment. Only enable profiling in a development environment.
``` :::
Traces can be visualized using <https://ui.perfetto.dev/>. Traces can be visualized using <https://ui.perfetto.dev/>.
```{tip} :::{tip}
Only send a few requests through vLLM when profiling, as the traces can get quite large. Also, no need to untar the traces, they can be viewed directly. Only send a few requests through vLLM when profiling, as the traces can get quite large. Also, no need to untar the traces, they can be viewed directly.
``` :::
```{tip} :::{tip}
To stop the profiler - it flushes out all the profile trace files to the directory. This takes time, for example for about 100 requests worth of data for a llama 70b, it takes about 10 minutes to flush out on a H100. To stop the profiler - it flushes out all the profile trace files to the directory. This takes time, for example for about 100 requests worth of data for a llama 70b, it takes about 10 minutes to flush out on a H100.
Set the env variable VLLM_RPC_TIMEOUT to a big number before you start the server. Say something like 30 minutes. Set the env variable VLLM_RPC_TIMEOUT to a big number before you start the server. Say something like 30 minutes.
`export VLLM_RPC_TIMEOUT=1800000` `export VLLM_RPC_TIMEOUT=1800000`
``` :::
## Example commands and usage ## Example commands and usage
......
...@@ -21,11 +21,11 @@ $ docker run --runtime nvidia --gpus all \ ...@@ -21,11 +21,11 @@ $ docker run --runtime nvidia --gpus all \
You can add any other <project:#engine-args> you need after the image tag (`vllm/vllm-openai:latest`). You can add any other <project:#engine-args> you need after the image tag (`vllm/vllm-openai:latest`).
```{note} :::{note}
You can either use the `ipc=host` flag or `--shm-size` flag to allow the You can either use the `ipc=host` flag or `--shm-size` flag to allow the
container to access the host's shared memory. vLLM uses PyTorch, which uses shared container to access the host's shared memory. vLLM uses PyTorch, which uses shared
memory to share data between processes under the hood, particularly for tensor parallel inference. memory to share data between processes under the hood, particularly for tensor parallel inference.
``` :::
(deployment-docker-build-image-from-source)= (deployment-docker-build-image-from-source)=
...@@ -38,25 +38,25 @@ You can build and run vLLM from source via the provided <gh-file:Dockerfile>. To ...@@ -38,25 +38,25 @@ You can build and run vLLM from source via the provided <gh-file:Dockerfile>. To
DOCKER_BUILDKIT=1 docker build . --target vllm-openai --tag vllm/vllm-openai DOCKER_BUILDKIT=1 docker build . --target vllm-openai --tag vllm/vllm-openai
``` ```
```{note} :::{note}
By default vLLM will build for all GPU types for widest distribution. If you are just building for the By default vLLM will build for all GPU types for widest distribution. If you are just building for the
current GPU type the machine is running on, you can add the argument `--build-arg torch_cuda_arch_list=""` current GPU type the machine is running on, you can add the argument `--build-arg torch_cuda_arch_list=""`
for vLLM to find the current GPU type and build for that. for vLLM to find the current GPU type and build for that.
If you are using Podman instead of Docker, you might need to disable SELinux labeling by If you are using Podman instead of Docker, you might need to disable SELinux labeling by
adding `--security-opt label=disable` when running `podman build` command to avoid certain [existing issues](https://github.com/containers/buildah/discussions/4184). adding `--security-opt label=disable` when running `podman build` command to avoid certain [existing issues](https://github.com/containers/buildah/discussions/4184).
``` :::
## Building for Arm64/aarch64 ## Building for Arm64/aarch64
A docker container can be built for aarch64 systems such as the Nvidia Grace-Hopper. At time of this writing, this requires the use A docker container can be built for aarch64 systems such as the Nvidia Grace-Hopper. At time of this writing, this requires the use
of PyTorch Nightly and should be considered **experimental**. Using the flag `--platform "linux/arm64"` will attempt to build for arm64. of PyTorch Nightly and should be considered **experimental**. Using the flag `--platform "linux/arm64"` will attempt to build for arm64.
```{note} :::{note}
Multiple modules must be compiled, so this process can take a while. Recommend using `--build-arg max_jobs=` & `--build-arg nvcc_threads=` Multiple modules must be compiled, so this process can take a while. Recommend using `--build-arg max_jobs=` & `--build-arg nvcc_threads=`
flags to speed up build process. However, ensure your `max_jobs` is substantially larger than `nvcc_threads` to get the most benefits. flags to speed up build process. However, ensure your `max_jobs` is substantially larger than `nvcc_threads` to get the most benefits.
Keep an eye on memory usage with parallel jobs as it can be substantial (see example below). Keep an eye on memory usage with parallel jobs as it can be substantial (see example below).
``` :::
```console ```console
# Example of building on Nvidia GH200 server. (Memory usage: ~15GB, Build time: ~1475s / ~25 min, Image size: 6.93GB) # Example of building on Nvidia GH200 server. (Memory usage: ~15GB, Build time: ~1475s / ~25 min, Image size: 6.93GB)
...@@ -85,6 +85,6 @@ $ docker run --runtime nvidia --gpus all \ ...@@ -85,6 +85,6 @@ $ docker run --runtime nvidia --gpus all \
The argument `vllm/vllm-openai` specifies the image to run, and should be replaced with the name of the custom-built image (the `-t` tag from the build command). The argument `vllm/vllm-openai` specifies the image to run, and should be replaced with the name of the custom-built image (the `-t` tag from the build command).
```{note} :::{note}
**For version 0.4.1 and 0.4.2 only** - the vLLM docker images under these versions are supposed to be run under the root user since a library under the root user's home directory, i.e. `/root/.config/vllm/nccl/cu12/libnccl.so.2.18.1` is required to be loaded during runtime. If you are running the container under a different user, you may need to first change the permissions of the library (and all the parent directories) to allow the user to access it, then run vLLM with environment variable `VLLM_NCCL_SO_PATH=/root/.config/vllm/nccl/cu12/libnccl.so.2.18.1` . **For version 0.4.1 and 0.4.2 only** - the vLLM docker images under these versions are supposed to be run under the root user since a library under the root user's home directory, i.e. `/root/.config/vllm/nccl/cu12/libnccl.so.2.18.1` is required to be loaded during runtime. If you are running the container under a different user, you may need to first change the permissions of the library (and all the parent directories) to allow the user to access it, then run vLLM with environment variable `VLLM_NCCL_SO_PATH=/root/.config/vllm/nccl/cu12/libnccl.so.2.18.1` .
``` :::
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
# Cerebrium # Cerebrium
```{raw} html :::{raw} html
<p align="center"> <p align="center">
<img src="https://i.ibb.co/hHcScTT/Screenshot-2024-06-13-at-10-14-54.png" alt="vLLM_plus_cerebrium"/> <img src="https://i.ibb.co/hHcScTT/Screenshot-2024-06-13-at-10-14-54.png" alt="vLLM_plus_cerebrium"/>
</p> </p>
``` :::
vLLM can be run on a cloud based GPU machine with [Cerebrium](https://www.cerebrium.ai/), a serverless AI infrastructure platform that makes it easier for companies to build and deploy AI based applications. vLLM can be run on a cloud based GPU machine with [Cerebrium](https://www.cerebrium.ai/), a serverless AI infrastructure platform that makes it easier for companies to build and deploy AI based applications.
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
# dstack # dstack
```{raw} html :::{raw} html
<p align="center"> <p align="center">
<img src="https://i.ibb.co/71kx6hW/vllm-dstack.png" alt="vLLM_plus_dstack"/> <img src="https://i.ibb.co/71kx6hW/vllm-dstack.png" alt="vLLM_plus_dstack"/>
</p> </p>
``` :::
vLLM can be run on a cloud based GPU machine with [dstack](https://dstack.ai/), an open-source framework for running LLMs on any cloud. This tutorial assumes that you have already configured credentials, gateway, and GPU quotas on your cloud environment. vLLM can be run on a cloud based GPU machine with [dstack](https://dstack.ai/), an open-source framework for running LLMs on any cloud. This tutorial assumes that you have already configured credentials, gateway, and GPU quotas on your cloud environment.
...@@ -97,6 +97,6 @@ completion = client.chat.completions.create( ...@@ -97,6 +97,6 @@ completion = client.chat.completions.create(
print(completion.choices[0].message.content) print(completion.choices[0].message.content)
``` ```
```{note} :::{note}
dstack automatically handles authentication on the gateway using dstack's tokens. Meanwhile, if you don't want to configure a gateway, you can provision dstack `Task` instead of `Service`. The `Task` is for development purpose only. If you want to know more about hands-on materials how to serve vLLM using dstack, check out [this repository](https://github.com/dstackai/dstack-examples/tree/main/deployment/vllm) dstack automatically handles authentication on the gateway using dstack's tokens. Meanwhile, if you don't want to configure a gateway, you can provision dstack `Task` instead of `Service`. The `Task` is for development purpose only. If you want to know more about hands-on materials how to serve vLLM using dstack, check out [this repository](https://github.com/dstackai/dstack-examples/tree/main/deployment/vllm)
``` :::
...@@ -38,213 +38,213 @@ chart **including persistent volumes** and deletes the release. ...@@ -38,213 +38,213 @@ chart **including persistent volumes** and deletes the release.
## Architecture ## Architecture
```{image} /assets/deployment/architecture_helm_deployment.png :::{image} /assets/deployment/architecture_helm_deployment.png
``` :::
## Values ## Values
```{list-table} :::{list-table}
:widths: 25 25 25 25 :widths: 25 25 25 25
:header-rows: 1 :header-rows: 1
* - Key - * Key
- Type * Type
- Default * Default
- Description * Description
* - autoscaling - * autoscaling
- object * object
- {"enabled":false,"maxReplicas":100,"minReplicas":1,"targetCPUUtilizationPercentage":80} * {"enabled":false,"maxReplicas":100,"minReplicas":1,"targetCPUUtilizationPercentage":80}
- Autoscaling configuration * Autoscaling configuration
* - autoscaling.enabled - * autoscaling.enabled
- bool * bool
- false * false
- Enable autoscaling * Enable autoscaling
* - autoscaling.maxReplicas - * autoscaling.maxReplicas
- int * int
- 100 * 100
- Maximum replicas * Maximum replicas
* - autoscaling.minReplicas - * autoscaling.minReplicas
- int * int
- 1 * 1
- Minimum replicas * Minimum replicas
* - autoscaling.targetCPUUtilizationPercentage - * autoscaling.targetCPUUtilizationPercentage
- int * int
- 80 * 80
- Target CPU utilization for autoscaling * Target CPU utilization for autoscaling
* - configs - * configs
- object * object
- {} * {}
- Configmap * Configmap
* - containerPort - * containerPort
- int * int
- 8000 * 8000
- Container port * Container port
* - customObjects - * customObjects
- list * list
- [] * []
- Custom Objects configuration * Custom Objects configuration
* - deploymentStrategy - * deploymentStrategy
- object * object
- {} * {}
- Deployment strategy configuration * Deployment strategy configuration
* - externalConfigs - * externalConfigs
- list * list
- [] * []
- External configuration * External configuration
* - extraContainers - * extraContainers
- list * list
- [] * []
- Additional containers configuration * Additional containers configuration
* - extraInit - * extraInit
- object * object
- {"pvcStorage":"1Gi","s3modelpath":"relative_s3_model_path/opt-125m", "awsEc2MetadataDisabled": true} * {"pvcStorage":"1Gi","s3modelpath":"relative_s3_model_path/opt-125m", "awsEc2MetadataDisabled": true}
- Additional configuration for the init container * Additional configuration for the init container
* - extraInit.pvcStorage - * extraInit.pvcStorage
- string * string
- "50Gi" * "50Gi"
- Storage size of the s3 * Storage size of the s3
* - extraInit.s3modelpath - * extraInit.s3modelpath
- string * string
- "relative_s3_model_path/opt-125m" * "relative_s3_model_path/opt-125m"
- Path of the model on the s3 which hosts model weights and config files * Path of the model on the s3 which hosts model weights and config files
* - extraInit.awsEc2MetadataDisabled - * extraInit.awsEc2MetadataDisabled
- boolean * boolean
- true * true
- Disables the use of the Amazon EC2 instance metadata service * Disables the use of the Amazon EC2 instance metadata service
* - extraPorts - * extraPorts
- list * list
- [] * []
- Additional ports configuration * Additional ports configuration
* - gpuModels - * gpuModels
- list * list
- ["TYPE_GPU_USED"] * ["TYPE_GPU_USED"]
- Type of gpu used * Type of gpu used
* - image - * image
- object * object
- {"command":["vllm","serve","/data/","--served-model-name","opt-125m","--host","0.0.0.0","--port","8000"],"repository":"vllm/vllm-openai","tag":"latest"} * {"command":["vllm","serve","/data/","--served-model-name","opt-125m","--host","0.0.0.0","--port","8000"],"repository":"vllm/vllm-openai","tag":"latest"}
- Image configuration * Image configuration
* - image.command - * image.command
- list * list
- ["vllm","serve","/data/","--served-model-name","opt-125m","--host","0.0.0.0","--port","8000"] * ["vllm","serve","/data/","--served-model-name","opt-125m","--host","0.0.0.0","--port","8000"]
- Container launch command * Container launch command
* - image.repository - * image.repository
- string * string
- "vllm/vllm-openai" * "vllm/vllm-openai"
- Image repository * Image repository
* - image.tag - * image.tag
- string * string
- "latest" * "latest"
- Image tag * Image tag
* - livenessProbe - * livenessProbe
- object * object
- {"failureThreshold":3,"httpGet":{"path":"/health","port":8000},"initialDelaySeconds":15,"periodSeconds":10} * {"failureThreshold":3,"httpGet":{"path":"/health","port":8000},"initialDelaySeconds":15,"periodSeconds":10}
- Liveness probe configuration * Liveness probe configuration
* - livenessProbe.failureThreshold - * livenessProbe.failureThreshold
- int * int
- 3 * 3
- Number of times after which if a probe fails in a row, Kubernetes considers that the overall check has failed: the container is not alive * Number of times after which if a probe fails in a row, Kubernetes considers that the overall check has failed: the container is not alive
* - livenessProbe.httpGet - * livenessProbe.httpGet
- object * object
- {"path":"/health","port":8000} * {"path":"/health","port":8000}
- Configuration of the Kubelet http request on the server * Configuration of the Kubelet http request on the server
* - livenessProbe.httpGet.path - * livenessProbe.httpGet.path
- string * string
- "/health" * "/health"
- Path to access on the HTTP server * Path to access on the HTTP server
* - livenessProbe.httpGet.port - * livenessProbe.httpGet.port
- int * int
- 8000 * 8000
- Name or number of the port to access on the container, on which the server is listening * Name or number of the port to access on the container, on which the server is listening
* - livenessProbe.initialDelaySeconds - * livenessProbe.initialDelaySeconds
- int * int
- 15 * 15
- Number of seconds after the container has started before liveness probe is initiated * Number of seconds after the container has started before liveness probe is initiated
* - livenessProbe.periodSeconds - * livenessProbe.periodSeconds
- int * int
- 10 * 10
- How often (in seconds) to perform the liveness probe * How often (in seconds) to perform the liveness probe
* - maxUnavailablePodDisruptionBudget - * maxUnavailablePodDisruptionBudget
- string * string
- "" * ""
- Disruption Budget Configuration * Disruption Budget Configuration
* - readinessProbe - * readinessProbe
- object * object
- {"failureThreshold":3,"httpGet":{"path":"/health","port":8000},"initialDelaySeconds":5,"periodSeconds":5} * {"failureThreshold":3,"httpGet":{"path":"/health","port":8000},"initialDelaySeconds":5,"periodSeconds":5}
- Readiness probe configuration * Readiness probe configuration
* - readinessProbe.failureThreshold - * readinessProbe.failureThreshold
- int * int
- 3 * 3
- Number of times after which if a probe fails in a row, Kubernetes considers that the overall check has failed: the container is not ready * Number of times after which if a probe fails in a row, Kubernetes considers that the overall check has failed: the container is not ready
* - readinessProbe.httpGet - * readinessProbe.httpGet
- object * object
- {"path":"/health","port":8000} * {"path":"/health","port":8000}
- Configuration of the Kubelet http request on the server * Configuration of the Kubelet http request on the server
* - readinessProbe.httpGet.path - * readinessProbe.httpGet.path
- string * string
- "/health" * "/health"
- Path to access on the HTTP server * Path to access on the HTTP server
* - readinessProbe.httpGet.port - * readinessProbe.httpGet.port
- int * int
- 8000 * 8000
- Name or number of the port to access on the container, on which the server is listening * Name or number of the port to access on the container, on which the server is listening
* - readinessProbe.initialDelaySeconds - * readinessProbe.initialDelaySeconds
- int * int
- 5 * 5
- Number of seconds after the container has started before readiness probe is initiated * Number of seconds after the container has started before readiness probe is initiated
* - readinessProbe.periodSeconds - * readinessProbe.periodSeconds
- int * int
- 5 * 5
- How often (in seconds) to perform the readiness probe * How often (in seconds) to perform the readiness probe
* - replicaCount - * replicaCount
- int * int
- 1 * 1
- Number of replicas * Number of replicas
* - resources - * resources
- object * object
- {"limits":{"cpu":4,"memory":"16Gi","nvidia.com/gpu":1},"requests":{"cpu":4,"memory":"16Gi","nvidia.com/gpu":1}} * {"limits":{"cpu":4,"memory":"16Gi","nvidia.com/gpu":1},"requests":{"cpu":4,"memory":"16Gi","nvidia.com/gpu":1}}
- Resource configuration * Resource configuration
* - resources.limits."nvidia.com/gpu" - * resources.limits."nvidia.com/gpu"
- int * int
- 1 * 1
- Number of gpus used * Number of gpus used
* - resources.limits.cpu - * resources.limits.cpu
- int * int
- 4 * 4
- Number of CPUs * Number of CPUs
* - resources.limits.memory - * resources.limits.memory
- string * string
- "16Gi" * "16Gi"
- CPU memory configuration * CPU memory configuration
* - resources.requests."nvidia.com/gpu" - * resources.requests."nvidia.com/gpu"
- int * int
- 1 * 1
- Number of gpus used * Number of gpus used
* - resources.requests.cpu - * resources.requests.cpu
- int * int
- 4 * 4
- Number of CPUs * Number of CPUs
* - resources.requests.memory - * resources.requests.memory
- string * string
- "16Gi" * "16Gi"
- CPU memory configuration * CPU memory configuration
* - secrets - * secrets
- object * object
- {} * {}
- Secrets configuration * Secrets configuration
* - serviceName - * serviceName
- string * string
- *
- Service name * Service name
* - servicePort - * servicePort
- int * int
- 80 * 80
- Service port * Service port
* - labels.environment - * labels.environment
- string * string
- test * test
- Environment name * Environment name
* - labels.release - * labels.release
- string * string
- test * test
- Release name * Release name
``` :::
# Using other frameworks # Using other frameworks
```{toctree} :::{toctree}
:maxdepth: 1 :maxdepth: 1
bentoml bentoml
...@@ -11,4 +11,4 @@ lws ...@@ -11,4 +11,4 @@ lws
modal modal
skypilot skypilot
triton triton
``` :::
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
# SkyPilot # SkyPilot
```{raw} html :::{raw} html
<p align="center"> <p align="center">
<img src="https://imgur.com/yxtzPEu.png" alt="vLLM"/> <img src="https://imgur.com/yxtzPEu.png" alt="vLLM"/>
</p> </p>
``` :::
vLLM can be **run and scaled to multiple service replicas on clouds and Kubernetes** with [SkyPilot](https://github.com/skypilot-org/skypilot), an open-source framework for running LLMs on any cloud. More examples for various open models, such as Llama-3, Mixtral, etc, can be found in [SkyPilot AI gallery](https://skypilot.readthedocs.io/en/latest/gallery/index.html). vLLM can be **run and scaled to multiple service replicas on clouds and Kubernetes** with [SkyPilot](https://github.com/skypilot-org/skypilot), an open-source framework for running LLMs on any cloud. More examples for various open models, such as Llama-3, Mixtral, etc, can be found in [SkyPilot AI gallery](https://skypilot.readthedocs.io/en/latest/gallery/index.html).
...@@ -104,10 +104,10 @@ service: ...@@ -104,10 +104,10 @@ service:
max_completion_tokens: 1 max_completion_tokens: 1
``` ```
```{raw} html :::{raw} html
<details> <details>
<summary>Click to see the full recipe YAML</summary> <summary>Click to see the full recipe YAML</summary>
``` :::
```yaml ```yaml
service: service:
...@@ -153,9 +153,9 @@ run: | ...@@ -153,9 +153,9 @@ run: |
2>&1 | tee api_server.log 2>&1 | tee api_server.log
``` ```
```{raw} html :::{raw} html
</details> </details>
``` :::
Start the serving the Llama-3 8B model on multiple replicas: Start the serving the Llama-3 8B model on multiple replicas:
...@@ -169,10 +169,10 @@ Wait until the service is ready: ...@@ -169,10 +169,10 @@ Wait until the service is ready:
watch -n10 sky serve status vllm watch -n10 sky serve status vllm
``` ```
```{raw} html :::{raw} html
<details> <details>
<summary>Example outputs:</summary> <summary>Example outputs:</summary>
``` :::
```console ```console
Services Services
...@@ -185,9 +185,9 @@ vllm 1 1 xx.yy.zz.121 18 mins ago 1x GCP([Spot]{'L4': 1}) R ...@@ -185,9 +185,9 @@ vllm 1 1 xx.yy.zz.121 18 mins ago 1x GCP([Spot]{'L4': 1}) R
vllm 2 1 xx.yy.zz.245 18 mins ago 1x GCP([Spot]{'L4': 1}) READY us-east4 vllm 2 1 xx.yy.zz.245 18 mins ago 1x GCP([Spot]{'L4': 1}) READY us-east4
``` ```
```{raw} html :::{raw} html
</details> </details>
``` :::
After the service is READY, you can find a single endpoint for the service and access the service with the endpoint: After the service is READY, you can find a single endpoint for the service and access the service with the endpoint:
...@@ -223,10 +223,10 @@ service: ...@@ -223,10 +223,10 @@ service:
This will scale the service up to when the QPS exceeds 2 for each replica. This will scale the service up to when the QPS exceeds 2 for each replica.
```{raw} html :::{raw} html
<details> <details>
<summary>Click to see the full recipe YAML</summary> <summary>Click to see the full recipe YAML</summary>
``` :::
```yaml ```yaml
service: service:
...@@ -275,9 +275,9 @@ run: | ...@@ -275,9 +275,9 @@ run: |
2>&1 | tee api_server.log 2>&1 | tee api_server.log
``` ```
```{raw} html :::{raw} html
</details> </details>
``` :::
To update the service with the new config: To update the service with the new config:
...@@ -295,10 +295,10 @@ sky serve down vllm ...@@ -295,10 +295,10 @@ sky serve down vllm
It is also possible to access the Llama-3 service with a separate GUI frontend, so the user requests send to the GUI will be load-balanced across replicas. It is also possible to access the Llama-3 service with a separate GUI frontend, so the user requests send to the GUI will be load-balanced across replicas.
```{raw} html :::{raw} html
<details> <details>
<summary>Click to see the full GUI YAML</summary> <summary>Click to see the full GUI YAML</summary>
``` :::
```yaml ```yaml
envs: envs:
...@@ -328,9 +328,9 @@ run: | ...@@ -328,9 +328,9 @@ run: |
--stop-token-ids 128009,128001 | tee ~/gradio.log --stop-token-ids 128009,128001 | tee ~/gradio.log
``` ```
```{raw} html :::{raw} html
</details> </details>
``` :::
1. Start the chat web UI: 1. Start the chat web UI:
......
# External Integrations # External Integrations
```{toctree} :::{toctree}
:maxdepth: 1 :maxdepth: 1
kserve kserve
kubeai kubeai
llamastack llamastack
``` :::
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment