distributed serving with vllm

server

./run_cluster.sh 698668586297dd30428a9f3bbcadb8a2034732ed13fdcd49218c8c3c9eb1cbd6 ip_address --head /home/prometheus/module-test/llama-factory/LLM-Model/Qwen2.5-Coder-7B-Instruct

./run_cluster.sh 698668586297dd30428a9f3bbcadb8a2034732ed13fdcd49218c8c3c9eb1cbd6 ip_address --worker /home/prometheus/module-test/llama-factory/LLM-Model/Qwen2.5-Coder-7B-Instruct

container

docker exec -it node /bin/bash		
vllm serve /root/.cache/huggingface/  --tensor-parallel-size 1   --pipeline-parallel-size 1

use model in container

curl http://localhost:8000/v1/models

{
    "object": "list",
    "data": [
        {
            "id": "/root/.cache/huggingface/",
            "object": "model",
            "created": 1733322900,
            "owned_by": "vllm",
            "root": "/root/.cache/huggingface/",
            "parent": null,
            "max_model_len": 32768,
            "permission": [
                {
                    "id": "modelperm-19491f4adebc4075b2871384cf1c3a11",
                    "object": "model_permission",
                    "created": 1733322900,
                    "allow_create_engine": false,
                    "allow_sampling": true,
                    "allow_logprobs": true,
                    "allow_search_indices": false,
                    "allow_view": true,
                    "allow_fine_tuning": false,
                    "organization": "*",
                    "group": null,
                    "is_blocking": false
                }
            ]
        }
    ]
}
		curl http://localhost:8000/v1/completions \
			-H "Content-Type: application/json" \
			-d '{
				"model": "/root/.cache/huggingface/",
				"prompt": "San Francisco is a",
				"max_tokens": 7,
				"temperature": 0
			}'

{
    "id": "cmpl-c3de13b28c57437f8de33169dc211516",
    "object": "text_completion",
    "created": 1733323053,
    "model": "/root/.cache/huggingface/",
    "choices": [
        {
            "index": 0,
            "text": " city in California, United States.",
            "logprobs": null,
            "finish_reason": "length",
            "stop_reason": null,
            "prompt_logprobs": null
        }
    ],
    "usage": {
        "prompt_tokens": 4,
        "total_tokens": 11,
        "completion_tokens": 7,
        "prompt_tokens_details": null
    }
}

OpenAI Compatible Server

vllm serve NousResearch/Meta-Llama-3-8B-Instruct --dtype auto --api-key token-abc123

how to call the server

from openai import OpenAI
client = OpenAI(
    base_url="http://localhost:8000/v1",
    api_key="token-abc123",
)

completion = client.chat.completions.create(
  model="NousResearch/Meta-Llama-3-8B-Instruct",
  messages=[
    {"role": "user", "content": "Hello!"}
  ]
)

print(completion.choices[0].message)
--served-model-name
	The model name(s) used in the API. 
	If multiple names are provided, the server will respond to any of the provided names. 
	The model name in the model field of a response will be the first name in this list. 
	If not specified, the model name will be the same as the –model argument. 
	Noted that this name(s)will also be used in model_name tag content of prometheus metrics, 
		if multiple names provided, metricstag will take the first one.
--max-num-batched-tokens 5120
	Maximum number of batched tokens per iteration.

decrease gpu memory usage

--gpu-memory-utilization 0.8 --max-model-len 4096 --enable-chunked-prefill=False
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

穿越辩证法

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值