zR
commited on
Commit
•
76f3474
1
Parent(s):
e824789
fix
Browse files- README.md +12 -13
- README_en.md +3 -3
- generation_config.json +1 -1
- modeling_chatglm.py +0 -5
README.md
CHANGED
@@ -3,16 +3,17 @@ license: other
|
|
3 |
license_name: glm-4
|
4 |
license_link: https://huggingface.co/THUDM/glm-4-9b-chat/blob/main/LICENSE
|
5 |
language:
|
6 |
-
- zh
|
7 |
-
- en
|
8 |
tags:
|
9 |
-
- glm
|
10 |
-
- chatglm
|
11 |
-
- thudm
|
12 |
inference: false
|
13 |
---
|
14 |
|
15 |
# GLM-4-9B-Chat
|
|
|
16 |
Read this in [English](README_en.md).
|
17 |
|
18 |
GLM-4-9B 是智谱 AI 推出的最新一代预训练模型 GLM-4 系列中的开源版本。
|
@@ -31,7 +32,6 @@ GLM-4-9B 是智谱 AI 推出的最新一代预训练模型 GLM-4 系列中的开
|
|
31 |
| ChatGLM3-6B | 3.97 | 5.50 | 28.1 | 66.4 | 69.0 | 72.3 | 25.7 | 58.5 | 11.3 |
|
32 |
| GLM-4-9B-Chat | 6.61 | 8.35 | 69.0 | 72.4 | 75.6 | 79.6 | 50.6 | 71.8 | 32.2 |
|
33 |
|
34 |
-
|
35 |
### 长文本
|
36 |
|
37 |
在 1M 的上下文长度下进行[大海捞针实验](https://github.com/LargeWorldModel/LWM/blob/main/scripts/eval_needle.py),结果如下:
|
@@ -55,11 +55,10 @@ GLM-4-9B 是智谱 AI 推出的最新一代预训练模型 GLM-4 系列中的开
|
|
55 |
| XStoryCloze | 84.7 | 90.7 | zh, en, ar, es, eu, hi, id, my, ru, sw, te
|
56 |
| XCOPA | 73.3 | 80.1 | zh, et, ht, id, it, qu, sw, ta, th, tr, vi
|
57 |
|
58 |
-
|
59 |
-
|
60 |
### 工具调用能力
|
61 |
|
62 |
-
我们在 [Berkeley Function Calling Leaderboard](https://github.com/ShishirPatil/gorilla/tree/main/berkeley-function-call-leaderboard)
|
|
|
63 |
|
64 |
| Model | Overall Acc. | AST Summary | Exec Summary | Relevance |
|
65 |
|:-----------------------|:------------:|:-----------:|:------------:|:---------:|
|
@@ -72,11 +71,12 @@ GLM-4-9B 是智谱 AI 推出的最新一代预训练模型 GLM-4 系列中的开
|
|
72 |
|
73 |
## 运行模型
|
74 |
|
75 |
-
|
|
|
|
|
76 |
|
77 |
### 使用 transformers 后端进行推理:
|
78 |
|
79 |
-
**请严格按照[依赖](https://github.com/THUDM/GLM-4/blob/main/basic_demo/requirements.txt)安装,否则无法正常运行**
|
80 |
|
81 |
```python
|
82 |
import torch
|
@@ -84,7 +84,7 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
84 |
|
85 |
device = "cuda"
|
86 |
|
87 |
-
tokenizer = AutoTokenizer.from_pretrained("THUDM/glm-4-9b-chat",trust_remote_code=True)
|
88 |
|
89 |
query = "你好"
|
90 |
|
@@ -149,7 +149,6 @@ print(outputs[0].outputs[0].text)
|
|
149 |
|
150 |
GLM-4 模型的权重的使用则需要遵循 [LICENSE](LICENSE)。
|
151 |
|
152 |
-
|
153 |
## 引用
|
154 |
|
155 |
如果你觉得我们的工作有帮助的话,请考虑引用下列论文。
|
|
|
3 |
license_name: glm-4
|
4 |
license_link: https://huggingface.co/THUDM/glm-4-9b-chat/blob/main/LICENSE
|
5 |
language:
|
6 |
+
- zh
|
7 |
+
- en
|
8 |
tags:
|
9 |
+
- glm
|
10 |
+
- chatglm
|
11 |
+
- thudm
|
12 |
inference: false
|
13 |
---
|
14 |
|
15 |
# GLM-4-9B-Chat
|
16 |
+
|
17 |
Read this in [English](README_en.md).
|
18 |
|
19 |
GLM-4-9B 是智谱 AI 推出的最新一代预训练模型 GLM-4 系列中的开源版本。
|
|
|
32 |
| ChatGLM3-6B | 3.97 | 5.50 | 28.1 | 66.4 | 69.0 | 72.3 | 25.7 | 58.5 | 11.3 |
|
33 |
| GLM-4-9B-Chat | 6.61 | 8.35 | 69.0 | 72.4 | 75.6 | 79.6 | 50.6 | 71.8 | 32.2 |
|
34 |
|
|
|
35 |
### 长文本
|
36 |
|
37 |
在 1M 的上下文长度下进行[大海捞针实验](https://github.com/LargeWorldModel/LWM/blob/main/scripts/eval_needle.py),结果如下:
|
|
|
55 |
| XStoryCloze | 84.7 | 90.7 | zh, en, ar, es, eu, hi, id, my, ru, sw, te
|
56 |
| XCOPA | 73.3 | 80.1 | zh, et, ht, id, it, qu, sw, ta, th, tr, vi
|
57 |
|
|
|
|
|
58 |
### 工具调用能力
|
59 |
|
60 |
+
我们在 [Berkeley Function Calling Leaderboard](https://github.com/ShishirPatil/gorilla/tree/main/berkeley-function-call-leaderboard)
|
61 |
+
上进行了测试并得到了以下结果:
|
62 |
|
63 |
| Model | Overall Acc. | AST Summary | Exec Summary | Relevance |
|
64 |
|:-----------------------|:------------:|:-----------:|:------------:|:---------:|
|
|
|
71 |
|
72 |
## 运行模型
|
73 |
|
74 |
+
**更多推理代码和依赖信息,请访问我们的 [github](https://github.com/THUDM/GLM-4)。**
|
75 |
+
|
76 |
+
**请严格按照[依赖](https://github.com/THUDM/GLM-4/blob/main/basic_demo/requirements.txt)安装,否则无法正常运行。**
|
77 |
|
78 |
### 使用 transformers 后端进行推理:
|
79 |
|
|
|
80 |
|
81 |
```python
|
82 |
import torch
|
|
|
84 |
|
85 |
device = "cuda"
|
86 |
|
87 |
+
tokenizer = AutoTokenizer.from_pretrained("THUDM/glm-4-9b-chat", trust_remote_code=True)
|
88 |
|
89 |
query = "你好"
|
90 |
|
|
|
149 |
|
150 |
GLM-4 模型的权重的使用则需要遵循 [LICENSE](LICENSE)。
|
151 |
|
|
|
152 |
## 引用
|
153 |
|
154 |
如果你觉得我们的工作有帮助的话,请考虑引用下列论文。
|
README_en.md
CHANGED
@@ -66,12 +66,12 @@ on [Berkeley Function Calling Leaderboard](https://github.com/ShishirPatil/goril
|
|
66 |
|
67 |
## Quick Start
|
68 |
|
69 |
-
For more inference code and requirements, please visit our [github page](https://github.com/THUDM/GLM-4)
|
70 |
-
|
71 |
-
### Use the following method to quickly call the GLM-4-9B-Chat language model
|
72 |
|
73 |
**Please strictly follow the [dependencies](https://github.com/THUDM/GLM-4/blob/main/basic_demo/requirements.txt) to install, otherwise it will not run properly**
|
74 |
|
|
|
|
|
75 |
Use the transformers backend for inference:
|
76 |
|
77 |
```python
|
|
|
66 |
|
67 |
## Quick Start
|
68 |
|
69 |
+
**For more inference code and requirements, please visit our [github page](https://github.com/THUDM/GLM-4).**
|
|
|
|
|
70 |
|
71 |
**Please strictly follow the [dependencies](https://github.com/THUDM/GLM-4/blob/main/basic_demo/requirements.txt) to install, otherwise it will not run properly**
|
72 |
|
73 |
+
### Use the following method to quickly call the GLM-4-9B-Chat language model
|
74 |
+
|
75 |
Use the transformers backend for inference:
|
76 |
|
77 |
```python
|
generation_config.json
CHANGED
@@ -9,5 +9,5 @@
|
|
9 |
"temperature": 0.8,
|
10 |
"max_length": 128000,
|
11 |
"top_p": 0.8,
|
12 |
-
"transformers_version": "4.
|
13 |
}
|
|
|
9 |
"temperature": 0.8,
|
10 |
"max_length": 128000,
|
11 |
"top_p": 0.8,
|
12 |
+
"transformers_version": "4.42.4"
|
13 |
}
|
modeling_chatglm.py
CHANGED
@@ -793,11 +793,6 @@ class ChatGLMPreTrainedModel(PreTrainedModel):
|
|
793 |
position_ids = torch.arange(seq_length, dtype=torch.long, device=device).unsqueeze(0).repeat(batch_size, 1)
|
794 |
return position_ids
|
795 |
|
796 |
-
def gradient_checkpointing_enable(self, gradient_checkpointing_kwargs=None):
|
797 |
-
if not self.supports_gradient_checkpointing:
|
798 |
-
raise ValueError(f"{self.__class__.__name__} does not support gradient checkpointing.")
|
799 |
-
|
800 |
-
|
801 |
class Embedding(torch.nn.Module):
|
802 |
"""Language model embeddings."""
|
803 |
|
|
|
793 |
position_ids = torch.arange(seq_length, dtype=torch.long, device=device).unsqueeze(0).repeat(batch_size, 1)
|
794 |
return position_ids
|
795 |
|
|
|
|
|
|
|
|
|
|
|
796 |
class Embedding(torch.nn.Module):
|
797 |
"""Language model embeddings."""
|
798 |
|