更新readme,增加启动多个llm服务的说明;增加停止llm服务的说明

This commit is contained in:
hzg0601 2023-08-10 09:52:34 +08:00
parent 6c2b2b7ba2
commit 73393d781a
1 changed files with 58 additions and 34 deletions

View File

@ -110,6 +110,7 @@
🐳 Docker镜像地址`registry.cn-beijing.aliyuncs.com/isafetech/chatmydata:1.0 `🌲 🐳 Docker镜像地址`registry.cn-beijing.aliyuncs.com/isafetech/chatmydata:1.0 `🌲
💻 一行命令运行: 💻 一行命令运行:
```shell ```shell
docker run -d -p 80:7860 --gpus all registry.cn-beijing.aliyuncs.com/isafetech/chatmydata:1.0 docker run -d -p 80:7860 --gpus all registry.cn-beijing.aliyuncs.com/isafetech/chatmydata:1.0
``` ```
@ -122,16 +123,19 @@ docker run -d -p 80:7860 --gpus all registry.cn-beijing.aliyuncs.com/isafetech/c
- 如遇到启动过程卡在 `Waiting..`步骤,建议使用 `docker exec -it <container id> bash`进入 `/logs/`目录查看对应阶段日志 - 如遇到启动过程卡在 `Waiting..`步骤,建议使用 `docker exec -it <container id> bash`进入 `/logs/`目录查看对应阶段日志
![](img/docker_logs.png) ![](img/docker_logs.png)
## Docker 部署 ## Docker 部署
为了能让容器使用主机GPU资源需要在主机上安装 [NVIDIA Container Toolkit](https://github.com/NVIDIA/nvidia-container-toolkit)。具体安装步骤如下: 为了能让容器使用主机GPU资源需要在主机上安装 [NVIDIA Container Toolkit](https://github.com/NVIDIA/nvidia-container-toolkit)。具体安装步骤如下:
```shell ```shell
sudo apt-get update sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit-base sudo apt-get install -y nvidia-container-toolkit-base
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl restart docker sudo systemctl restart docker
``` ```
安装完成后,可以使用以下命令编译镜像和启动容器: 安装完成后,可以使用以下命令编译镜像和启动容器:
``` ```
docker build -f Dockerfile-cuda -t chatglm-cuda:latest . docker build -f Dockerfile-cuda -t chatglm-cuda:latest .
docker run --gpus all -d --name chatglm -p 7860:7860 chatglm-cuda:latest docker run --gpus all -d --name chatglm -p 7860:7860 chatglm-cuda:latest
@ -169,7 +173,9 @@ $ git clone https://huggingface.co/moka-ai/m3e-base
复制文件 [configs/model_config.py.example](configs/model_config.py.example) 存储至项目路径下 `./configs` 路径下,并重命名为 `model_config.py` 复制文件 [configs/model_config.py.example](configs/model_config.py.example) 存储至项目路径下 `./configs` 路径下,并重命名为 `model_config.py`
在开始执行 Web UI 或命令行交互前,请先检查 `configs/model_config.py` 中的各项模型参数设计是否符合需求: 在开始执行 Web UI 或命令行交互前,请先检查 `configs/model_config.py` 中的各项模型参数设计是否符合需求:
- 请确认已下载至本地的 LLM 模型本地存储路径写在 `llm_model_dict` 对应模型的 `local_model_path` 属性中,如: - 请确认已下载至本地的 LLM 模型本地存储路径写在 `llm_model_dict` 对应模型的 `local_model_path` 属性中,如:
```python ```python
llm_model_dict={ llm_model_dict={
"chatglm2-6b": { "chatglm2-6b": {
@ -179,7 +185,9 @@ llm_model_dict={
}, },
} }
``` ```
- 请确认已下载至本地的 Embedding 模型本地存储路径写在 `embedding_model_dict` 对应模型位置,如: - 请确认已下载至本地的 Embedding 模型本地存储路径写在 `embedding_model_dict` 对应模型位置,如:
```python ```python
embedding_model_dict = { embedding_model_dict = {
"m3e-base": "/Users/xxx/Downloads/m3e-base", "m3e-base": "/Users/xxx/Downloads/m3e-base",
@ -189,10 +197,25 @@ embedding_model_dict = {
### 4. 启动 API 服务或 Web UI ### 4. 启动 API 服务或 Web UI
在项目根目录下,执行 [server/llm_api.py](server/llm_api.py) 脚本启动 **LLM 模型**服务: 在项目根目录下,执行 [server/llm_api.py](server/llm_api.py) 脚本启动 **LLM 模型**服务:
```shell ```shell
$ python server/llm_api.py $ python server/llm_api.py
``` ```
如果想启动多个llm模型服务
```shell
$python server/llm_api_luanch.py --model-path-address `model-path1@host1@port1` `model-path2@host2@port2`
```
以如上方式启动LLM服务会以nohup命令在后台运行fastchat服务如需停止服务可以运行如下命令
```shell
$python server/llm_api_shutdown.py --serve all
```
亦可单独停止一个fastchat服务模块可选[all, controller,model_worker,openai_api_server]
执行 [server/api.py](server/api.py) 脚本启动 **API** 服务 执行 [server/api.py](server/api.py) 脚本启动 **API** 服务
```shell ```shell
@ -200,6 +223,7 @@ $ python server/api.py
``` ```
执行 [webui.py](webui.py) 启动 **Web UI** 服务 执行 [webui.py](webui.py) 启动 **Web UI** 服务
```shell ```shell
$ python webui.py $ python webui.py
``` ```
@ -210,37 +234,37 @@ $ python webui.py
## 路线图 ## 路线图
- [x] Langchain 应用 - [X] Langchain 应用
- [x] 本地数据接入 - [X] 本地数据接入
- [x] 接入非结构化文档 - [X] 接入非结构化文档
- [x] .md - [X] .md
- [x] .txt - [X] .txt
- [x] .docx - [X] .docx
- [ ] 结构化数据接入 - [ ] 结构化数据接入
- [x] .csv - [X] .csv
- [ ] .xlsx - [ ] .xlsx
- [ ] 本地网页接入 - [ ] 本地网页接入
- [ ] SQL 接入 - [ ] SQL 接入
- [ ] 知识图谱/图数据库接入 - [ ] 知识图谱/图数据库接入
- [x] 搜索引擎接入 - [X] 搜索引擎接入
- [x] Bing 搜索 - [X] Bing 搜索
- [x] DuckDuckGo 搜索 - [X] DuckDuckGo 搜索
- [ ] Agent 实现 - [ ] Agent 实现
- [x] LLM 模型接入 - [X] LLM 模型接入
- [x] 支持通过调用 [fastchat](https://github.com/lm-sys/FastChat) api 调用 llm - [X] 支持通过调用 [fastchat](https://github.com/lm-sys/FastChat) api 调用 llm
- [x] 增加更多 Embedding 模型支持 - [X] 增加更多 Embedding 模型支持
- [x] [nghuyong/ernie-3.0-nano-zh](https://huggingface.co/nghuyong/ernie-3.0-nano-zh) - [X] [nghuyong/ernie-3.0-nano-zh](https://huggingface.co/nghuyong/ernie-3.0-nano-zh)
- [x] [nghuyong/ernie-3.0-base-zh](https://huggingface.co/nghuyong/ernie-3.0-base-zh) - [X] [nghuyong/ernie-3.0-base-zh](https://huggingface.co/nghuyong/ernie-3.0-base-zh)
- [x] [shibing624/text2vec-base-chinese](https://huggingface.co/shibing624/text2vec-base-chinese) - [X] [shibing624/text2vec-base-chinese](https://huggingface.co/shibing624/text2vec-base-chinese)
- [x] [GanymedeNil/text2vec-large-chinese](https://huggingface.co/GanymedeNil/text2vec-large-chinese) - [X] [GanymedeNil/text2vec-large-chinese](https://huggingface.co/GanymedeNil/text2vec-large-chinese)
- [x] [moka-ai/m3e-small](https://huggingface.co/moka-ai/m3e-small) - [X] [moka-ai/m3e-small](https://huggingface.co/moka-ai/m3e-small)
- [x] [moka-ai/m3e-base](https://huggingface.co/moka-ai/m3e-base) - [X] [moka-ai/m3e-base](https://huggingface.co/moka-ai/m3e-base)
- [x] 基于 FastAPI 的 API 方式调用 - [X] 基于 FastAPI 的 API 方式调用
- [x] Web UI - [X] Web UI
- [x] 基于 Streamlit 的 Web UI - [X] 基于 Streamlit 的 Web UI
## 项目交流群 ## 项目交流群
<img src="img/qr_code_46.jpg" alt="二维码" width="300" height="300" /> <img src="img/qr_code_46.jpg" alt="二维码" width="300" height="300" />
🎉 langchain-ChatGLM 项目微信交流群,如果你也对本项目感兴趣,欢迎加入群聊参与讨论交流。 🎉 langchain-ChatGLM 项目微信交流群,如果你也对本项目感兴趣,欢迎加入群聊参与讨论交流。