pretrain.md 1.92 KB
Newer Older
Rayyyyy's avatar
Rayyyyy committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Yuan2.0 Pretraining

## Introduction

This document provides instructions for pretraining model of Yuan2.0-M32.

Three models are provided, the main parameters are as follows:

|        | Layer number | Hidden size | Attention head | expert num |
| :--:   | :----------: | :---------: | :------------: | :--------: |
| 2*32B  |      24      |    2048     |       16       |     32     |

## Usage

The  scripts describe three models in Yuan2.0:

- 2B : [`pretrain_yuan2.0_moe_2x32B.sh`](../examples/pretrain_yuan2.0_moe_2x32B.sh)

### Example

An example script to run Yuan-2.1B-M32 pretraining is:

```shell
bash examples/pretrain_yuan2.0_moe_2x32B.sh
```

### Arguments setting

Before running the script, the relevant arguments should be set correctly.

Firstly,  make any desired modifications including setting the environment variables for `CHECKPOINT_PATH`, `DATA_PATH`,  `TOKENIZER_MODEL_PATH ` and `TENSORBOARD_PATH`.

If the dataset path is:

```bash
/path/dataset.bin
```

The `DATA_PATH` can be set :

```shell
#DATA_PATH='weight dataset_path'
DATA_PATH='1 /path/dataset'
```

The dataset  preprocess can see documentation [here]().

A simple and efficient three-dimensional model-parallel approach can be controlled by `--tensor-model-parallel-size` and `--pipeline-model-parallel-size ` flag.  If the `--pipeline-model-parallel-method` flag is set to `block`, the number of transformer layers shoule be specified by the `--pipeline-model-parallel-blocks` for each pipeline stage.

The Localized Filtering-based Attention(LFA) can be activated by the '`--use-lf-gate` flag. And the `--lf-conv2d-num-pad` flag shoule be set to `1` for training and `0` for inference.

The `--use-distributed-optimizer` and `--recompute-method` can control the use of memory during Training.

Further command line arguments are described in the source file [`arguments.py`](../megatron/arguments) and [Megatron-LM](https://github.com/NVIDIA/Megatron-LM/blob/main/README.md)