-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
2,309 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
## 模型信息 | ||
|
||
ChatGLM3 是智谱AI和清华大学 KEG 实验室联合发布的新一代对话预训练模型。ChatGLM3-6B 是 ChatGLM3 系列中的开源模型,在保留了前两代模型对话流畅、部署门槛低等众多优秀特性的基础上,ChatGLM3-6B 引入了如下特性: | ||
|
||
1. **更强大的基础模型:** ChatGLM3-6B 的基础模型 ChatGLM3-6B-Base 采用了更多样的训练数据、更充分的训练步数和更合理的训练策略。在语义、数学、推理、代码、知识等不同角度的数据集上测评显示,**ChatGLM3-6B-Base 具有在 10B 以下的基础模型中最强的性能**。 | ||
2. **更完整的功能支持:** ChatGLM3-6B 采用了全新设计的 [Prompt 格式](https://github.com/THUDM/ChatGLM3/blob/main/PROMPT.md),除正常的多轮对话外。同时原生支持[工具调用](https://github.com/THUDM/ChatGLM3/blob/main/tool_using/README.md)(Function Call)、代码执行(Code Interpreter)和 Agent 任务等复杂场景。 | ||
3. **更全面的开源序列:** 除了对话模型 [ChatGLM3-6B](https://huggingface.co/THUDM/chatglm3-6b) 外,还开源了基础模型 [ChatGLM3-6B-Base](https://huggingface.co/THUDM/chatglm3-6b-base)、长文本对话模型 [ChatGLM3-6B-32K](https://huggingface.co/THUDM/chatglm3-6b-32k)。以上所有权重对学术研究**完全开放**,在填写[问卷](https://open.bigmodel.cn/mla/form)进行登记后**亦允许免费商业使用**。 | ||
|
||
## 模型配置及tokenizer准备 | ||
|
||
本测试样例为预训练case,需要下载模型config文件,以及tokenizer。 | ||
|
||
本测试样例目录下已提供处理好的chatglm3_6b_hf/目录 | ||
|
||
## 数据准备 | ||
|
||
本测试样例数据准备共分为4个步骤 | ||
|
||
1. 下载openwebtext原始压缩文件,即: | ||
|
||
https://drive.google.com/drive/folders/1IaD_SIIB-K3Sij_-JjWoPy_UrWqQRdjx 中12GB的openwebtext.tar.xz | ||
|
||
2. 全部解压缩 | ||
|
||
解压上述12GB的文件后,会出现若干形如urlsf_subsetxxxxxx.xz的压缩文件,将所有压缩文件解压到同一个目录,最终可获得7000000余个txt文件 | ||
|
||
3. 运行数据预处理文件 | ||
|
||
执行preprocess/data_process.py,配置好其中的4个命令行参数。推荐的默认token数量为100M,即1亿个token。此配置在A800 8卡上预计训练1小时 | ||
|
||
4. 将outputfile(通常为openwebtext_chatglm3_100M.npy)放置在data_dir下 |
65 changes: 65 additions & 0 deletions
65
training/benchmarks/chatglm3_6b/deepspeed/chatglm3_6b_hf/MODEL_LICENSE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
The ChatGLM3-6B License | ||
|
||
1. 定义 | ||
|
||
“许可方”是指分发其软件的 ChatGLM3-6B 模型团队。 | ||
|
||
“软件”是指根据本许可提供的 ChatGLM3-6B 模型参数。 | ||
|
||
2. 许可授予 | ||
|
||
根据本许可的条款和条件,许可方特此授予您非排他性、全球性、不可转让、不可再许可、可撤销、免版税的版权许可。 | ||
|
||
上述版权声明和本许可声明应包含在本软件的所有副本或重要部分中。 | ||
|
||
3.限制 | ||
|
||
您不得出于任何军事或非法目的使用、复制、修改、合并、发布、分发、复制或创建本软件的全部或部分衍生作品。 | ||
|
||
您不得利用本软件从事任何危害国家安全和国家统一、危害社会公共利益、侵犯人身权益的行为。 | ||
|
||
4.免责声明 | ||
|
||
本软件“按原样”提供,不提供任何明示或暗示的保证,包括但不限于对适销性、特定用途的适用性和非侵权性的保证。 在任何情况下,作者或版权持有人均不对任何索赔、损害或其他责任负责,无论是在合同诉讼、侵权行为还是其他方面,由软件或软件的使用或其他交易引起、由软件引起或与之相关 软件。 | ||
|
||
5. 责任限制 | ||
|
||
除适用法律禁止的范围外,在任何情况下且根据任何法律理论,无论是基于侵权行为、疏忽、合同、责任或其他原因,任何许可方均不对您承担任何直接、间接、特殊、偶然、示范性、 或间接损害,或任何其他商业损失,即使许可人已被告知此类损害的可能性。 | ||
|
||
6.争议解决 | ||
|
||
本许可受中华人民共和国法律管辖并按其解释。 因本许可引起的或与本许可有关的任何争议应提交北京市海淀区人民法院。 | ||
|
||
请注意,许可证可能会更新到更全面的版本。 有关许可和版权的任何问题,请通过 [email protected] 与我们联系。 | ||
|
||
1. Definitions | ||
|
||
“Licensor” means the ChatGLM3-6B Model Team that distributes its Software. | ||
|
||
“Software” means the ChatGLM3-6B model parameters made available under this license. | ||
|
||
2. License Grant | ||
|
||
Subject to the terms and conditions of this License, the Licensor hereby grants to you a non-exclusive, worldwide, non-transferable, non-sublicensable, revocable, royalty-free copyright license to use the Software. | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
3. Restriction | ||
|
||
You will not use, copy, modify, merge, publish, distribute, reproduce, or create derivative works of the Software, in whole or in part, for any military, or illegal purposes. | ||
|
||
You will not use the Software for any act that may undermine China's national security and national unity, harm the public interest of society, or infringe upon the rights and interests of human beings. | ||
|
||
4. Disclaimer | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
||
5. Limitation of Liability | ||
|
||
EXCEPT TO THE EXTENT PROHIBITED BY APPLICABLE LAW, IN NO EVENT AND UNDER NO LEGAL THEORY, WHETHER BASED IN TORT, NEGLIGENCE, CONTRACT, LIABILITY, OR OTHERWISE WILL ANY LICENSOR BE LIABLE TO YOU FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES, OR ANY OTHER COMMERCIAL LOSSES, EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. | ||
|
||
6. Dispute Resolution | ||
|
||
This license shall be governed and construed in accordance with the laws of People’s Republic of China. Any dispute arising from or in connection with this License shall be submitted to Haidian District People's Court in Beijing. | ||
|
||
Note that the license is subject to update to a more comprehensive version. For any questions related to the license and copyright, please contact us at [email protected]. |
42 changes: 42 additions & 0 deletions
42
training/benchmarks/chatglm3_6b/deepspeed/chatglm3_6b_hf/config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"_name_or_path": "THUDM/chatglm3-6b", | ||
"model_type": "chatglm", | ||
"architectures": [ | ||
"ChatGLMModel" | ||
], | ||
"auto_map": { | ||
"AutoConfig": "configuration_chatglm.ChatGLMConfig", | ||
"AutoModel": "modeling_chatglm.ChatGLMForConditionalGeneration", | ||
"AutoModelForCausalLM": "modeling_chatglm.ChatGLMForConditionalGeneration", | ||
"AutoModelForSeq2SeqLM": "modeling_chatglm.ChatGLMForConditionalGeneration", | ||
"AutoModelForSequenceClassification": "modeling_chatglm.ChatGLMForSequenceClassification" | ||
}, | ||
"add_bias_linear": false, | ||
"add_qkv_bias": true, | ||
"apply_query_key_layer_scaling": true, | ||
"apply_residual_connection_post_layernorm": false, | ||
"attention_dropout": 0.0, | ||
"attention_softmax_in_fp32": true, | ||
"bias_dropout_fusion": true, | ||
"ffn_hidden_size": 13696, | ||
"fp32_residual_connection": false, | ||
"hidden_dropout": 0.0, | ||
"hidden_size": 4096, | ||
"kv_channels": 128, | ||
"layernorm_epsilon": 1e-05, | ||
"multi_query_attention": true, | ||
"multi_query_group_num": 2, | ||
"num_attention_heads": 32, | ||
"num_layers": 28, | ||
"original_rope": true, | ||
"padded_vocab_size": 65024, | ||
"post_layer_norm": true, | ||
"rmsnorm": true, | ||
"seq_length": 8192, | ||
"use_cache": true, | ||
"torch_dtype": "float16", | ||
"transformers_version": "4.30.2", | ||
"tie_word_embeddings": false, | ||
"eos_token_id": 2, | ||
"pad_token_id": 0 | ||
} |
61 changes: 61 additions & 0 deletions
61
training/benchmarks/chatglm3_6b/deepspeed/chatglm3_6b_hf/configuration_chatglm.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
from transformers import PretrainedConfig | ||
|
||
|
||
class ChatGLMConfig(PretrainedConfig): | ||
model_type = "chatglm" | ||
def __init__( | ||
self, | ||
num_layers=28, | ||
padded_vocab_size=65024, | ||
hidden_size=4096, | ||
ffn_hidden_size=13696, | ||
kv_channels=128, | ||
num_attention_heads=32, | ||
seq_length=2048, | ||
hidden_dropout=0.0, | ||
classifier_dropout=None, | ||
attention_dropout=0.0, | ||
layernorm_epsilon=1e-5, | ||
rmsnorm=True, | ||
apply_residual_connection_post_layernorm=False, | ||
post_layer_norm=True, | ||
add_bias_linear=False, | ||
add_qkv_bias=False, | ||
bias_dropout_fusion=True, | ||
multi_query_attention=False, | ||
multi_query_group_num=1, | ||
apply_query_key_layer_scaling=True, | ||
attention_softmax_in_fp32=True, | ||
fp32_residual_connection=False, | ||
quantization_bit=0, | ||
pre_seq_len=None, | ||
prefix_projection=False, | ||
**kwargs | ||
): | ||
self.num_layers = num_layers | ||
self.vocab_size = padded_vocab_size | ||
self.padded_vocab_size = padded_vocab_size | ||
self.hidden_size = hidden_size | ||
self.ffn_hidden_size = ffn_hidden_size | ||
self.kv_channels = kv_channels | ||
self.num_attention_heads = num_attention_heads | ||
self.seq_length = seq_length | ||
self.hidden_dropout = hidden_dropout | ||
self.classifier_dropout = classifier_dropout | ||
self.attention_dropout = attention_dropout | ||
self.layernorm_epsilon = layernorm_epsilon | ||
self.rmsnorm = rmsnorm | ||
self.apply_residual_connection_post_layernorm = apply_residual_connection_post_layernorm | ||
self.post_layer_norm = post_layer_norm | ||
self.add_bias_linear = add_bias_linear | ||
self.add_qkv_bias = add_qkv_bias | ||
self.bias_dropout_fusion = bias_dropout_fusion | ||
self.multi_query_attention = multi_query_attention | ||
self.multi_query_group_num = multi_query_group_num | ||
self.apply_query_key_layer_scaling = apply_query_key_layer_scaling | ||
self.attention_softmax_in_fp32 = attention_softmax_in_fp32 | ||
self.fp32_residual_connection = fp32_residual_connection | ||
self.quantization_bit = quantization_bit | ||
self.pre_seq_len = pre_seq_len | ||
self.prefix_projection = prefix_projection | ||
super().__init__(**kwargs) |
Oops, something went wrong.