Skip to content

Commit

Permalink
update restful_api.md
Browse files Browse the repository at this point in the history
  • Loading branch information
AllentDan committed Nov 8, 2023
1 parent 013000d commit 2cdbca9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
11 changes: 8 additions & 3 deletions docs/en/restful_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

### Launch Service

The user can open the http url print by the following command in a browser.

- **Please check the http url for the detailed api usage!!!**
- **Please check the http url for the detailed api usage!!!**
- **Please check the http url for the detailed api usage!!!**

```shell
lmdeploy serve api_server ./workspace --server_name 0.0.0.0 --server_port ${server_port} --instance_num 32 --tp 1
```

Then, the user can open the swagger UI: `http://{server_ip}:{server_port}` for the detailed api usage.
We provide four restful api in total. Three of them are in OpenAI format.

- /v1/chat/completions
Expand Down Expand Up @@ -145,8 +150,8 @@ lmdeploy serve gradio api_server_url --server_name ${gradio_ui_ip} --server_port

### FAQ

1. When user got `"finish_reason":"length"` which means the session is too long to be continued.
Please add `"renew_session": true` into the next request.
1. When user got `"finish_reason":"length"`, it means the session is too long to be continued. The session length can be
modified by passing `--session_len` to api_server.

2. When OOM appeared at the server side, please reduce the number of `instance_num` when lanching the service.

Expand Down
10 changes: 6 additions & 4 deletions docs/zh_cn/restful_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

### 启动服务

运行脚本
用户将下面命令输出的 http url 复制到浏览器打开,详细查看所有的 API 及其使用方法。
请一定查看`http://{server_ip}:{server_port}`!!!
请一定查看`http://{server_ip}:{server_port}`!!!
请一定查看`http://{server_ip}:{server_port}`!!!
重要的事情说三遍。

```shell
lmdeploy serve api_server ./workspace 0.0.0.0 --server_port ${server_port} --instance_num 32 --tp 1
```

然后用户可以打开 swagger UI: `http://{server_ip}:{server_port}` 详细查看所有的 API 及其使用方法。
我们一共提供四个 restful api,其中三个仿照 OpenAI 的形式。

- /v1/chat/completions
Expand Down Expand Up @@ -142,8 +145,7 @@ lmdeploy serve gradio api_server_url --server_name ${gradio_ui_ip} --server_port

### FAQ

1. 当返回结果结束原因为 `"finish_reason":"length"`,这表示回话长度超过最大值。
请添加 `"renew_session": true` 到下一次请求中。
1. 当返回结果结束原因为 `"finish_reason":"length"`,这表示回话长度超过最大值。如需调整会话支持的最大长度,可以通过启动`api_server`时,设置`--session_len`参数大小。

2. 当服务端显存 OOM 时,可以适当减小启动服务时的 `instance_num` 个数

Expand Down

0 comments on commit 2cdbca9

Please sign in to comment.