zR
commited on
Commit
•
e190b08
1
Parent(s):
f81daa3
更新引用
Browse files- .gitignore +3 -0
- README.md +9 -16
- README_en.md +9 -16
- config.json +1 -1
- configuration.json +1 -0
- generation_config.json +13 -0
- tokenization_chatglm.py +4 -4
- tokenizer_config.json +1 -1
.gitignore
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
*venv
|
2 |
+
*.DS_Store
|
3 |
+
*.idea/
|
README.md
CHANGED
@@ -43,9 +43,10 @@ GLM-4V-9B 是一个多模态语言模型,具备视觉理解能力,其相关
|
|
43 |
| **GLM-4v-9B** | 81.1 | 79.4 | 76.8 | 58.7 | 47.2 | 2163.8 | 46.6 | 81.1 | 786 |
|
44 |
|
45 |
**本仓库是 GLM-4V-9B 的模型仓库,支持`8K`上下文长度。**
|
|
|
46 |
## 运行模型
|
47 |
|
48 |
-
|
49 |
|
50 |
```python
|
51 |
import torch
|
@@ -86,21 +87,13 @@ GLM-4 模型的权重的使用则需要遵循 [LICENSE](LICENSE)。
|
|
86 |
如果你觉得我们的工作有帮助的话,请考虑引用下列论文。
|
87 |
|
88 |
```
|
89 |
-
@
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
}
|
95 |
-
|
96 |
-
|
97 |
-
```
|
98 |
-
@inproceedings{du2022glm,
|
99 |
-
title={GLM: General Language Model Pretraining with Autoregressive Blank Infilling},
|
100 |
-
author={Du, Zhengxiao and Qian, Yujie and Liu, Xiao and Ding, Ming and Qiu, Jiezhong and Yang, Zhilin and Tang, Jie},
|
101 |
-
booktitle={Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
|
102 |
-
pages={320--335},
|
103 |
-
year={2022}
|
104 |
}
|
105 |
```
|
106 |
|
|
|
43 |
| **GLM-4v-9B** | 81.1 | 79.4 | 76.8 | 58.7 | 47.2 | 2163.8 | 46.6 | 81.1 | 786 |
|
44 |
|
45 |
**本仓库是 GLM-4V-9B 的模型仓库,支持`8K`上下文长度。**
|
46 |
+
|
47 |
## 运行模型
|
48 |
|
49 |
+
更多推理代码和依赖信息,请访问我们的 [github](https://github.com/THUDM/GLM-4) 。
|
50 |
|
51 |
```python
|
52 |
import torch
|
|
|
87 |
如果你觉得我们的工作有帮助的话,请考虑引用下列论文。
|
88 |
|
89 |
```
|
90 |
+
@misc{glm2024chatglm,
|
91 |
+
title={ChatGLM: A Family of Large Language Models from GLM-130B to GLM-4 All Tools},
|
92 |
+
author={Team GLM and Aohan Zeng and Bin Xu and Bowen Wang and Chenhui Zhang and Da Yin and Diego Rojas and Guanyu Feng and Hanlin Zhao and Hanyu Lai and Hao Yu and Hongning Wang and Jiadai Sun and Jiajie Zhang and Jiale Cheng and Jiayi Gui and Jie Tang and Jing Zhang and Juanzi Li and Lei Zhao and Lindong Wu and Lucen Zhong and Mingdao Liu and Minlie Huang and Peng Zhang and Qinkai Zheng and Rui Lu and Shuaiqi Duan and Shudan Zhang and Shulin Cao and Shuxun Yang and Weng Lam Tam and Wenyi Zhao and Xiao Liu and Xiao Xia and Xiaohan Zhang and Xiaotao Gu and Xin Lv and Xinghan Liu and Xinyi Liu and Xinyue Yang and Xixuan Song and Xunkai Zhang and Yifan An and Yifan Xu and Yilin Niu and Yuantao Yang and Yueyan Li and Yushi Bai and Yuxiao Dong and Zehan Qi and Zhaoyu Wang and Zhen Yang and Zhengxiao Du and Zhenyu Hou and Zihan Wang},
|
93 |
+
year={2024},
|
94 |
+
eprint={2406.12793},
|
95 |
+
archivePrefix={arXiv},
|
96 |
+
primaryClass={id='cs.CL' full_name='Computation and Language' is_active=True alt_name='cmp-lg' in_archive='cs' is_general=False description='Covers natural language processing. Roughly includes material in ACM Subject Class I.2.7. Note that work on artificial languages (programming languages, logics, formal systems) that does not explicitly address natural-language issues broadly construed (natural-language processing, computational linguistics, speech, text retrieval, etc.) is not appropriate for this area.'}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
}
|
98 |
```
|
99 |
|
README_en.md
CHANGED
@@ -29,7 +29,8 @@ GLM-4V-9B is a multimodal language model with visual understanding capabilities.
|
|
29 |
|
30 |
## Quick Start
|
31 |
|
32 |
-
|
|
|
33 |
|
34 |
```python
|
35 |
|
@@ -71,21 +72,13 @@ The use of the GLM-4 model weights needs to comply with the [LICENSE](LICENSE).
|
|
71 |
If you find our work helpful, please consider citing the following papers.
|
72 |
|
73 |
```
|
74 |
-
@
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
}
|
80 |
-
|
81 |
-
|
82 |
-
```
|
83 |
-
@inproceedings{du2022glm,
|
84 |
-
title={GLM: General Language Model Pretraining with Autoregressive Blank Infilling},
|
85 |
-
author={Du, Zhengxiao and Qian, Yujie and Liu, Xiao and Ding, Ming and Qiu, Jiezhong and Yang, Zhilin and Tang, Jie},
|
86 |
-
booktitle={Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
|
87 |
-
pages={320--335},
|
88 |
-
year={2022}
|
89 |
}
|
90 |
```
|
91 |
|
|
|
29 |
|
30 |
## Quick Start
|
31 |
|
32 |
+
For more inference code and requirements, please visit our [github page](https://github.com/THUDM/GLM-4).
|
33 |
+
|
34 |
|
35 |
```python
|
36 |
|
|
|
72 |
If you find our work helpful, please consider citing the following papers.
|
73 |
|
74 |
```
|
75 |
+
@misc{glm2024chatglm,
|
76 |
+
title={ChatGLM: A Family of Large Language Models from GLM-130B to GLM-4 All Tools},
|
77 |
+
author={Team GLM and Aohan Zeng and Bin Xu and Bowen Wang and Chenhui Zhang and Da Yin and Diego Rojas and Guanyu Feng and Hanlin Zhao and Hanyu Lai and Hao Yu and Hongning Wang and Jiadai Sun and Jiajie Zhang and Jiale Cheng and Jiayi Gui and Jie Tang and Jing Zhang and Juanzi Li and Lei Zhao and Lindong Wu and Lucen Zhong and Mingdao Liu and Minlie Huang and Peng Zhang and Qinkai Zheng and Rui Lu and Shuaiqi Duan and Shudan Zhang and Shulin Cao and Shuxun Yang and Weng Lam Tam and Wenyi Zhao and Xiao Liu and Xiao Xia and Xiaohan Zhang and Xiaotao Gu and Xin Lv and Xinghan Liu and Xinyi Liu and Xinyue Yang and Xixuan Song and Xunkai Zhang and Yifan An and Yifan Xu and Yilin Niu and Yuantao Yang and Yueyan Li and Yushi Bai and Yuxiao Dong and Zehan Qi and Zhaoyu Wang and Zhen Yang and Zhengxiao Du and Zhenyu Hou and Zihan Wang},
|
78 |
+
year={2024},
|
79 |
+
eprint={2406.12793},
|
80 |
+
archivePrefix={arXiv},
|
81 |
+
primaryClass={id='cs.CL' full_name='Computation and Language' is_active=True alt_name='cmp-lg' in_archive='cs' is_general=False description='Covers natural language processing. Roughly includes material in ACM Subject Class I.2.7. Note that work on artificial languages (programming languages, logics, formal systems) that does not explicitly address natural-language issues broadly construed (natural-language processing, computational linguistics, speech, text retrieval, etc.) is not appropriate for this area.'}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
}
|
83 |
```
|
84 |
|
config.json
CHANGED
@@ -49,7 +49,7 @@
|
|
49 |
"seq_length": 8192,
|
50 |
"use_cache": true,
|
51 |
"torch_dtype": "bfloat16",
|
52 |
-
"transformers_version": "4.
|
53 |
"tie_word_embeddings": false,
|
54 |
"eos_token_id": [151329, 151336, 151338],
|
55 |
"pad_token_id": 151329,
|
|
|
49 |
"seq_length": 8192,
|
50 |
"use_cache": true,
|
51 |
"torch_dtype": "bfloat16",
|
52 |
+
"transformers_version": "4.40.2",
|
53 |
"tie_word_embeddings": false,
|
54 |
"eos_token_id": [151329, 151336, 151338],
|
55 |
"pad_token_id": 151329,
|
configuration.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"framework":"Pytorch","task":"nli"}
|
generation_config.json
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"eos_token_id": [
|
3 |
+
151329,
|
4 |
+
151336,
|
5 |
+
151338
|
6 |
+
],
|
7 |
+
"pad_token_id": 151329,
|
8 |
+
"do_sample": true,
|
9 |
+
"temperature": 0.8,
|
10 |
+
"max_length": 8192,
|
11 |
+
"top_p": 0.8,
|
12 |
+
"transformers_version": "4.40.2"
|
13 |
+
}
|
tokenization_chatglm.py
CHANGED
@@ -67,22 +67,22 @@ class ChatGLM4Tokenizer(PreTrainedTokenizer):
|
|
67 |
vocab.update(self.added_tokens_encoder)
|
68 |
return vocab
|
69 |
|
70 |
-
def convert_tokens_to_string(self, tokens: List[Union[bytes, str]]) -> str:
|
71 |
"""
|
72 |
Converts a sequence of tokens in a single string.
|
73 |
"""
|
74 |
text = ""
|
75 |
temp = b""
|
76 |
for t in tokens:
|
|
|
|
|
77 |
if isinstance(t, str):
|
78 |
if temp:
|
79 |
text += temp.decode("utf-8", errors="replace")
|
80 |
-
temp = b""
|
81 |
-
text += t
|
82 |
elif isinstance(t, bytes):
|
83 |
temp += t
|
84 |
else:
|
85 |
-
raise TypeError("token should only be of type
|
86 |
if temp:
|
87 |
text += temp.decode("utf-8", errors="replace")
|
88 |
return text
|
|
|
67 |
vocab.update(self.added_tokens_encoder)
|
68 |
return vocab
|
69 |
|
70 |
+
def convert_tokens_to_string(self, tokens: List[Union[bytes, str, int]]) -> str:
|
71 |
"""
|
72 |
Converts a sequence of tokens in a single string.
|
73 |
"""
|
74 |
text = ""
|
75 |
temp = b""
|
76 |
for t in tokens:
|
77 |
+
if isinstance(t, int):
|
78 |
+
t = chr(t)
|
79 |
if isinstance(t, str):
|
80 |
if temp:
|
81 |
text += temp.decode("utf-8", errors="replace")
|
|
|
|
|
82 |
elif isinstance(t, bytes):
|
83 |
temp += t
|
84 |
else:
|
85 |
+
raise TypeError("token should only be of type int, bytes or str")
|
86 |
if temp:
|
87 |
text += temp.decode("utf-8", errors="replace")
|
88 |
return text
|
tokenizer_config.json
CHANGED
@@ -126,7 +126,7 @@
|
|
126 |
"do_lower_case": false,
|
127 |
"eos_token": "<|endoftext|>",
|
128 |
"pad_token": "<|endoftext|>",
|
129 |
-
"model_max_length":
|
130 |
"padding_side": "left",
|
131 |
"remove_space": false,
|
132 |
"tokenizer_class": "ChatGLM4Tokenizer",
|
|
|
126 |
"do_lower_case": false,
|
127 |
"eos_token": "<|endoftext|>",
|
128 |
"pad_token": "<|endoftext|>",
|
129 |
+
"model_max_length": 8192,
|
130 |
"padding_side": "left",
|
131 |
"remove_space": false,
|
132 |
"tokenizer_class": "ChatGLM4Tokenizer",
|