update Readme

pull/275/head
regmiao 2023-03-29 17:16:10 +08:00
parent 30e7e8037d
commit 748c1597e9
1 changed files with 7 additions and 7 deletions

View File

@ -34,11 +34,7 @@ ChatGLM-6B 使用了和 ChatGPT 相似的技术,针对中文问答和对话进
### 环境安装
使用 pip 安装依赖:`pip install -r requirements.txt`,其中 `transformers` 库版本推荐为 `4.26.1`,但理论上不低于 `4.23.1` 即可。
### docker镜像部署
```bash
docker build -t chatglm .
docker run -v /the/model/path:/model chatglm
```
### 代码调用
可以通过如下代码调用 ChatGLM-6B 模型来生成对话:
@ -122,6 +118,12 @@ curl -X POST "http://127.0.0.1:8000" \
}
```
### 在docker容器中部署
```bash
docker build -t chatglm .
docker run -v /the/model/path:/model chatglm
```
## 低成本部署
### 模型量化
默认情况下,模型以 FP16 精度加载,运行上述代码需要大概 13GB 显存。如果你的 GPU 显存有限,可以尝试以量化方式加载模型,使用方法如下:
@ -145,8 +147,6 @@ model = AutoModel.from_pretrained("THUDM/chatglm-6b-int4", trust_remote_code=Tru
model = AutoModel.from_pretrained("THUDM/chatglm-6b-int4-qe", trust_remote_code=True).half().cuda()
```
### CPU 部署
如果你没有 GPU 硬件的话,也可以在 CPU 上进行推理,但是推理速度会更慢。使用方法如下(需要大概 32GB 内存)
```python