duzx16
commited on
Commit
·
0f573d1
1
Parent(s):
cd8041e
Update README
Browse files
README.md
CHANGED
|
@@ -46,27 +46,7 @@ response, history = model.chat(tokenizer, query, history=history)
|
|
| 46 |
print(history)
|
| 47 |
```
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
## 模型量化
|
| 52 |
-
|
| 53 |
-
默认情况下,模型以 FP16 精度加载,运行上述代码需要大概 19GB 显存。如果你的 GPU 显存有限,可以尝试运行量化后的模型,即将下述代码
|
| 54 |
-
|
| 55 |
-
```python
|
| 56 |
-
model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half().cuda()
|
| 57 |
-
```
|
| 58 |
-
|
| 59 |
-
替换为(8-bit 量化)
|
| 60 |
-
```python
|
| 61 |
-
model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half().quantize(8).cuda()
|
| 62 |
-
```
|
| 63 |
-
|
| 64 |
-
或者(4-bit 量化)
|
| 65 |
-
```python
|
| 66 |
-
model = AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half().quantize(4).cuda()
|
| 67 |
-
```
|
| 68 |
-
|
| 69 |
-
进行 2 至 3 轮对话后,8-bit 量化下约占用 10GB 的 GPU 显存,4-bit 量化仅需占用 6GB 的 GPU 显存。随着对话轮数的增多,对应消耗显存也随之增长。
|
| 70 |
|
| 71 |
## 引用
|
| 72 |
|
|
|
|
| 46 |
print(history)
|
| 47 |
```
|
| 48 |
|
| 49 |
+
关于更多的使用说明,包括如何运行命令行和网页版本的 DEMO,以及使用模型量化以节省显存,请参考我们的 [Github repo](https://github.com/THUDM/ChatGLM-6B)。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
## 引用
|
| 52 |
|