Guides
High-throughput serving with vLLM
Serve many requests at once from 16-bit or quantised models.
vLLM batches requests continuously and is the usual choice when many users or an agent pipeline hit one model at the same time. It runs on NVIDIA machines.
Rent a machine with the pytorch image
The model's 16-bit weights plus room for the KV cache must fit: an 8B model wants 24 GB or more, a 32B model 80 GB or two GPUs.
Install and start
pip install -U vllm
vllm serve Qwen/Qwen2.5-7B-Instruct --host 127.0.0.1 --port 8000 --max-model-len 16384On a machine with several GPUs, split the model with --tensor-parallel-size 2 (or 4).
Tunnel and call
ssh -p 40122 -N -L 8000:localhost:8000 [email protected]from openai import OpenAI
client = OpenAI(base_url="http://localhost:8000/v1", api_key="none")
r = client.chat.completions.create(
model="Qwen/Qwen2.5-7B-Instruct",
messages=[{"role": "user", "content": "Write a haiku about GPUs."}],
)
print(r.choices[0].message.content)