2025-01-07 11:20:01 +08:00
|
|
|
(serving-llamaindex)=
|
2024-12-23 17:35:38 -05:00
|
|
|
|
2025-01-07 11:20:01 +08:00
|
|
|
# LlamaIndex
|
2024-12-23 17:35:38 -05:00
|
|
|
|
2025-01-07 11:20:01 +08:00
|
|
|
vLLM is also available via [LlamaIndex](https://github.com/run-llama/llama_index) .
|
2024-12-23 17:35:38 -05:00
|
|
|
|
2025-01-07 11:20:01 +08:00
|
|
|
To install LlamaIndex, run
|
2024-12-23 17:35:38 -05:00
|
|
|
|
|
|
|
```console
|
2025-01-12 03:17:13 -05:00
|
|
|
pip install llama-index-llms-vllm -q
|
2024-12-23 17:35:38 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
To run inference on a single or multiple GPUs, use `Vllm` class from `llamaindex`.
|
|
|
|
|
|
|
|
```python
|
|
|
|
from llama_index.llms.vllm import Vllm
|
|
|
|
|
|
|
|
llm = Vllm(
|
|
|
|
model="microsoft/Orca-2-7b",
|
|
|
|
tensor_parallel_size=4,
|
|
|
|
max_new_tokens=100,
|
|
|
|
vllm_kwargs={"swap_space": 1, "gpu_memory_utilization": 0.5},
|
|
|
|
)
|
|
|
|
```
|
|
|
|
|
|
|
|
Please refer to this [Tutorial](https://docs.llamaindex.ai/en/latest/examples/llm/vllm/) for more details.
|