权重文件
ERNIE 4.5 - a baidu Collection
0、前提条件
1 | GPU Driver >= 535 |
1、拉取镜像
1 | docker pull ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/fastdeploy-cuda-12.6:2.0.0 |
2、启动服务
1 | python -m fastdeploy.entrypoints.openai.api_server \ |
| 参数名称 | 类型 | 描述 |
|---|---|---|
port | int | 仅服务部署时需要,HTTP服务端口号,默认:8000 |
metrics_port | int | 仅服务部署时需要,metrics监控端口号,默认:8001 |
engine_worker_queue_port | int | FastDeploy内部引擎通信端口,默认:8002 |
max_model_len | int | 推理支持的默认最大上下文长度,默认值:2048 |
tensor_parallel_size | int | 模型默认张量并行度,默认值:1 |
data_parallel_size | int | 模型默认数据并行度,默认值:1 |
max_num_seqs | int | Decode阶段最大并发数,默认:8 |
enable_prefix_caching | bool | 是否启用前缀缓存,默认:False |
limit_mm_per_prompt | dict[str] | 限制每个提示的多模式数据量,例如:{“image”:10,”video”:3},默认值:全部为 1 |
gpu_memory_utilization | float | GPU内存利用率,默认值:0.9 |
enable_chunked_prefill | bool | 启用分块预填充,默认值:False |
guided_decoding_backend | str | 指定要使用的引导解码后端, 默认:off |
3、服务调用
curl调用
1
2
3
4
5
6
7curl -X POST "http://0.0.0.0:8180/v1/chat/completions" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{"role": "user", "content": "Write me a poem about large language model."}
]
}'openai方式调用
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17import openai
host = "0.0.0.0"
port = "8180"
client = openai.Client(base_url=f"http://{host}:{port}/v1", api_key="null")
response = client.chat.completions.create(
model="null",
messages=[
{"role": "system", "content": "I'm a helpful AI assistant."},
{"role": "user", "content": "Write me a poem about large language model."},
],
stream=True,
)
for chunk in response:
if chunk.choices[0].delta:
print(chunk.choices[0].delta.content, end='')
print('\n')

