Skip to content

Commit ed33ff1

Browse files
committed
更新readme
1 parent 9b53f96 commit ed33ff1

File tree

3 files changed

+73
-58
lines changed

3 files changed

+73
-58
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ test/
66
logs/
77
outputs/
88
data/
9-
.venv/
9+
.venv/
10+
config.yaml

README.md

Lines changed: 70 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -90,20 +90,19 @@
9090
* [ ] 内置部分 tools (image_gen,code_interpreter,weather等)
9191
* [ ] 并行的function call功能(tools)
9292

93-
## 启用方式
94-
### Python启动
93+
## 快速开始
9594

96-
#### 1. 配置python环境
95+
### 1. 配置python环境
9796

98-
##### 1.1 uv 方式 安装 (推荐,适用于不使用conda的用户,迄今最优秀的 库 管理工具, 性能和易用性远高于 pip、conda、poetry等)
97+
#### 1.1 uv 方式 安装 (推荐,适用于不使用conda的用户,迄今最优秀的 库 管理工具, 性能和易用性远高于 pip、conda、poetry等)
9998

10099
```bash
101100
# 安装 uv
102-
pip install uv # 或查看教程 https://docs.astral.sh/uv/getting-started/installation/#standalone-installer
101+
pip install uv -U # 或查看教程 https://docs.astral.sh/uv/getting-started/installation/#standalone-installer
103102
sh install_uv.sh
104103
```
105104

106-
##### 1.2 conda 方式 安装(后期将弃用,可选)
105+
#### 1.2 conda 方式 安装(后期将弃用,可选)
107106

108107
```bash
109108
# 1. 创建conda 环境
@@ -116,11 +115,28 @@ conda activate gpt_server
116115
sh install.sh
117116
```
118117

118+
### 2. 修改启动配置文件
119119

120-
#### 2. 修改启动配置文件
120+
#### 2.1 复制样例配置文件:
121121

122-
修改模型后端方式(vllm,lmdeploy等)
122+
```bash
123+
# 进入script目录
124+
cd gpt_server/script
125+
# 复制样例配置文件
126+
cp config_example.yaml config.yaml
127+
```
128+
129+
130+
131+
#### 2.2 修改配置文件
132+
```bash
133+
cd gpt_server/script
134+
vim config.yaml
135+
```
123136

137+
**配置文件的详细说明信息位于:[config_example.yaml](https://github.com/shell-nlp/gpt_server/blob/main/gpt_server/script/config_example.yaml "配置文件")**
138+
139+
#### 2.3 如何切换模型后端(vllm,lmdeploy等)
124140
config.yaml中:
125141

126142
```bash
@@ -135,36 +151,71 @@ config.yaml中:
135151
model_type: embedding_infinity # embedding 或 embedding_infinity embedding_infinity后端速度远远大于 embedding
136152
```
137153

138-
[config.yaml](https://github.com/shell-nlp/gpt_server/blob/main/gpt_server/script/config.yaml "配置文件")
154+
### 3. 启动服务
155+
#### 3.1 命令启动
156+
157+
[start.sh](https://github.com/shell-nlp/gpt_server/blob/main/gpt_server/script/start.sh "服务主文件")
139158

140159
```bash
141-
cd gpt_server/script
142-
vim config.yaml
160+
sh start.sh
161+
```
162+
或者
163+
```bash
164+
python gpt_server/serving/main.py
143165
```
144166

145-
**配置文件的详细说明位于: https://github.com/shell-nlp/gpt_server/blob/main/gpt_server/script/config_example.yaml**
167+
#### 3.2 Docker启动
168+
169+
##### 3.2.0 使用Docker Hub镜像
170+
```bash
171+
docker pull 506610466/gpt_server:latest # 如果拉取失败可尝试下面的方式
172+
# 如果国内无法拉取docker镜像,可以尝试下面的国内镜像拉取的方式(不保证国内镜像源一直可用)
173+
docker pull hub.geekery.cn/506610466/gpt_server:latest
174+
```
146175

147-
#### 3. 运行命令
176+
##### 3.2.1 手动构建镜像(可选)
177+
- 构建镜像
148178

149-
[start.sh](https://github.com/shell-nlp/gpt_server/blob/main/gpt_server/script/start.sh "服务主文件")
179+
```bash
180+
docker build --rm -f "Dockerfile" -t gpt_server:latest "."
181+
```
182+
##### 3.2.2 Docker Compose 启动 (建议在项目里使用docker-compose启动)
150183

151184
```bash
152-
cd gpt_server/script
153-
sh start.sh
185+
docker-compose -f "docker-compose.yml" up -d --build gpt_server
154186
```
155187

156-
#### 4. 可视化UI方式启动服务(可选)
188+
189+
#### 3.3 可视化UI方式启动服务(可选,有Bug,不建议使用,欢迎大佬优化代码)
157190

158191
```bash
159-
cd gpt_server/gpt_server/serving
192+
cd gpt_server/serving
160193
streamlit run server_ui.py
161194
```
162195

163-
##### 4.1 Server UI界面:
196+
##### 3.3.1 Server UI界面:
164197

165198
![server_ui_demo.png](assets/server_ui_demo.png)
166199

167200

201+
### 4. 使用 openai 库 进行调用
202+
203+
**见 gpt_server/tests 目录 样例测试代码:
204+
https://github.com/shell-nlp/gpt_server/tree/main/tests**
205+
206+
### 5. 使用Chat UI
207+
208+
```bash
209+
cd gpt_server/gpt_server/serving
210+
streamlit run chat_ui.py
211+
```
212+
213+
Chat UI界面:
214+
215+
![chat_ui_demo.png](assets/chat_ui_demo.png)
216+
217+
218+
168219
## 支持的模型以及推理后端
169220

170221
**推理速度:** LMDeploy TurboMind > vllm > LMDeploy PyTorch > HF
@@ -223,45 +274,7 @@ streamlit run server_ui.py
223274

224275
目前 TencentBAC的 **Conan-embedding-v1** C-MTEB榜单排行第一(MTEB: https://huggingface.co/spaces/mteb/leaderboard)
225276

226-
#### 5. 使用 openai 库 进行调用
227-
228-
**见 gpt_server/tests 目录 样例测试代码:
229-
https://github.com/shell-nlp/gpt_server/tree/main/tests**
230-
231-
#### 6. 使用Chat UI
232-
233-
```bash
234-
cd gpt_server/gpt_server/serving
235-
streamlit run chat_ui.py
236-
```
237-
238-
Chat UI界面:
239-
240-
![chat_ui_demo.png](assets/chat_ui_demo.png)
241-
242-
## Docker安装
243-
244-
### 0. 使用Docker Hub镜像
245-
```bash
246-
docker pull 506610466/gpt_server:latest # 如果拉取失败可尝试下面的方式
247-
248-
249-
# 如果国内无法拉取docker镜像,可以尝试下面的国内镜像拉取的方式(不保证国内镜像源一直可用)
250-
docker pull hub.geekery.cn/506610466/gpt_server:latest
251-
252-
```
253-
254-
### 1. 手动构建镜像(可选)
255-
#### 1.1 构建镜像
256-
257-
```bash
258-
docker build --rm -f "Dockerfile" -t gpt_server:latest "."
259-
```
260-
#### 1.2 Docker Compose启动 (建议在项目里使用docker-compose启动)
261277

262-
```bash
263-
docker-compose -f "docker-compose.yml" up -d --build gpt_server
264-
```
265278
## 架构
266279

267280
![gpt_server_archs.png](assets/gpt_server_archs.png)

gpt_server/script/config_example.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ models:
3232
enable_prefix_caching: true # 是否启用前缀缓存
3333
dtype: auto # 类型
3434
max_model_len: 65536 # 模型最大token 长度
35+
gpu_memory_utilization: 0.8
3536
# lora: # lora 模型的路径
3637
# test_lora: /home/dev/project/LLaMA-Factory/saves/Qwen1.5-14B-Chat/lora/train_2024-03-22-09-01-32/checkpoint-100
3738

0 commit comments

Comments
 (0)