serving-llms-vllm
Serves LLMs with high throughput using vLLM's PagedAttention and continuous batching. Use when deploying production LLM APIs, optimizing inference latency/throughput, or serving models with limited GPU memory. Supports OpenAI-compatible endpoints, quantization (GPTQ/AWQ/FP8),
Installation
Pick a client and clone the repository into its skills directory.
Installation
About this skill
Serves LLMs with high throughput using vLLM's PagedAttention and continuous batching. Use when deploying production LLM APIs, optimizing inference latency/throughput, or serving models with limited GPU memory. Supports OpenAI-compatible endpoints, quantization (GPTQ/AWQ/FP8), and tensor parallelism.
How to use
Zainstaluj vLLM poleceniem
pip install vllm. Upewnij się, że masz zainstalowane zależności: torch i transformers.Aby uruchomić serwer kompatybilny z API OpenAI, wykonaj
vllm serve meta-llama/Llama-3-8B-Instruct. Serwer będzie dostępny nahttp://localhost:8000/v1.Wysyłaj zapytania do serwera za pomocą OpenAI SDK. Utwórz klienta z adresem
http://localhost:8000/v1i kluczem API ustawionym na 'EMPTY', następnie użyjclient.chat.completions.create()z nazwą modelu i wiadomościami.Dla wnioskowania offline bez serwera zaimportuj
LLMiSamplingParamsz vllm, załaduj model, ustaw parametry (temperatura, max_tokens), a następnie wywołajllm.generate()z listą promptów.W produkcji skonfiguruj ustawienia serwera w zależności od rozmiaru modelu (np. dla modeli 7B-13B na jednym GPU dostosuj parametry pamięci i batching'u).
Monitoruj metryki wydajności i przepustowości, aby upewnić się, że osiągasz oczekiwaną optymalizację latencji i wykorzystania zasobów GPU.