Commit d9a6ee2d authored by hepj987's avatar hepj987
Browse files

修改readme

parent 17814e61
Pipeline #549 canceled with stage
# Generative Pre-Training2(GPT2) # Generative Pre-Training2(GPT2)
### 模型介绍 ## 论文
`Language Models are Unsupervised Multitask Learners`
- https://d4mucfpksywv.cloudfront.net/better-language-models/language-models.pdf
## 模型介绍
``` ```
GPT2模型:第二代生成式预训练模型(Generative Pre-Training2)。 GPT2模型:第二代生成式预训练模型(Generative Pre-Training2)。
``` ```
### 模型结构 ## 模型结构
![gpt2](gpt2.jpg)
``` ```
GPT2使用 TransformerDecoder 结构,并对 Transformer Decoder 进行了一些改动,并通过Megatron和deepspeed可以使用DP、TP、PP的3D并行式的分布式方式训练 GPT2使用TransformerDecoder结构,并对 Transformer Decoder 进行了一些改动。主要在于将归一化层移到Block的输入位置;在最后一个自注意力块之后加了一层归一化;增大词汇量等。
``` ```
### 数据集 ## 算法原理
![image-gpt](image-gpt.png)
## 数据集
`oscar-1GB`
- https://huggingface.co/bigscience/misc-test-data/resolve/main/stas/oscar-1GB.jsonl.xz
``` ```
#下载数据集 #下载数据集
...@@ -36,9 +52,14 @@ xz -d oscar-1GB.jsonl.xz ...@@ -36,9 +52,14 @@ xz -d oscar-1GB.jsonl.xz
sh creat-data.sh sh creat-data.sh
``` ```
## GPT2预训练 ```
#处理后的数据集格式
├── my-gpt2_text_document.bin
├── my-gpt2_text_document.idx
└── oscar-1GB.jsonl
```
### 环境配置 ## 环境配置
推荐使用docker方式运行,提供[光源](https://www.sourcefind.cn/)拉取的docker镜像: 推荐使用docker方式运行,提供[光源](https://www.sourcefind.cn/)拉取的docker镜像:
...@@ -52,6 +73,8 @@ docker pull image.sourcefind.cn:5000/dcu/admin/base/pytorch:1.10.0-centos7.6-dtk ...@@ -52,6 +73,8 @@ docker pull image.sourcefind.cn:5000/dcu/admin/base/pytorch:1.10.0-centos7.6-dtk
pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
``` ```
## GPT2预训练
### GPT2单节点训练 ### GPT2单节点训练
``` ```
...@@ -209,9 +232,17 @@ mpirun -np 1 run-inf.sh ...@@ -209,9 +232,17 @@ mpirun -np 1 run-inf.sh
--num-samples 生成样本个数 --num-samples 生成样本个数
``` ```
## 应用场景
### 算法类别
`文本生成`
## loss收敛情况 ### 热点应用行业
## result
16B模型使用oscar数据集收敛情况如下: 16B模型使用oscar数据集收敛情况如下:
...@@ -228,3 +259,4 @@ https://developer.hpccube.com/codes/modelzoo/gpt2-pytorch/ ...@@ -228,3 +259,4 @@ https://developer.hpccube.com/codes/modelzoo/gpt2-pytorch/
## 参考 ## 参考
https://github.com/bigscience-workshop/Megatron-DeepSpeed https://github.com/bigscience-workshop/Megatron-DeepSpeed
gpt2.jpg

32.7 KB

Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment