Serving with llama_index

vLLM is also available via llama_index .

To install llamaindex, run

  1. $ pip install llama-index-llms-vllm -q

To run inference on a single or multiple GPUs, use Vllm class from llamaindex.

  1. from llama_index.llms.vllm import Vllm
  2. llm = Vllm(
  3. model="microsoft/Orca-2-7b",
  4. tensor_parallel_size=4,
  5. max_new_tokens=100,
  6. vllm_kwargs={"swap_space": 1, "gpu_memory_utilization": 0.5},
  7. )

Please refer to this Tutorial for more details.