Muennighoff commited on
Commit
cecefcd
1 Parent(s): ca904ee
Files changed (2) hide show
  1. sbatch_2b855b1b25c4.sh +163 -0
  2. sbatch_2b855b4bc4.sh +163 -0
sbatch_2b855b1b25c4.sh ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ #SBATCH --exclude=nid007571,nid007112,nid006774,nid007502,nid007506,nid007507,nid005145,nid006692,nid007218,nid007123,nid006124,nid006123,nid007496,nid007237,nid006852,nid007206,nid006947,nid007212,nid006977,nid007222,nid005444,nid007219,nid007493,nid007221,nid005300,nid005619,nid006118,nid005203,nid006113,nid006481,nid007077,nid005208,nid005207,nid005879,nid005901
3
+ #SBATCH --nodes=32
4
+ #SBATCH --ntasks-per-node=1
5
+ #SBATCH --cpus-per-task=32
6
+ #SBATCH --mem=256G
7
+ #SBATCH -p standard-g
8
+ #SBATCH -t 48:00:00
9
+ #SBATCH --gpus-per-node=mi250:8
10
+ #SBATCH --exclusive=user
11
+ #SBATCH --hint=nomultithread
12
+ #SBATCH --account=project_462000119
13
+ #SBATCH -o logs/%j.out
14
+ #SBATCH -e logs/%j.err
15
+
16
+ VARIANT=2b855b1b25c4
17
+
18
+ # if run without sbatch, invoke here
19
+ if [ -z $SLURM_JOB_ID ]; then
20
+ mkdir -p logs
21
+ sbatch "$0"
22
+ exit
23
+ fi
24
+
25
+ set -euo pipefail
26
+
27
+ # symlink logs/latest.out and logs/latest.err
28
+ ln -f -s $SLURM_JOB_ID.out logs/latest.out
29
+ ln -f -s $SLURM_JOB_ID.err logs/latest.err
30
+
31
+ KILL_SWITCH_PATH=kill-switch-$VARIANT
32
+ CHECKPOINT_PATH=checkpoints_$VARIANT
33
+ TENSORBOARD_PATH=tensorboard_$VARIANT
34
+
35
+ # Data
36
+ VOCAB_FILE="gpt2/vocab.json"
37
+ MERGE_FILE="gpt2/merges.txt"
38
+
39
+ TRAIN_DATA_PATH=train1b25.txt
40
+ # "train: 1.0 0:1 /scratch/project_462000119/data/c4_subsampled/gpt2tok_c4_en_1B25_text_document"
41
+ VALID_DATA_PATH=val.txt
42
+ # "validation: 1.0 0:1 /scratch/project_462000119/data/c4_validation/gpt2tok_c4validation_rerun_text_document"
43
+
44
+ PP_SIZE=1
45
+ TP_SIZE=1
46
+
47
+ MICRO_BATCH_SIZE=2
48
+ GRADIENT_ACCUMULATION_STEPS=1
49
+ WORLD_SIZE=$((SLURM_GPUS_ON_NODE*SLURM_JOB_NUM_NODES))
50
+ GLOBAL_BATCH_SIZE=$((MICRO_BATCH_SIZE*WORLD_SIZE*GRADIENT_ACCUMULATION_STEPS))
51
+
52
+ # Model parameters
53
+ source model_params.sh
54
+ MODEL_PARAM=("${PARAM_2980M[@]}")
55
+ NHIDDEN=${MODEL_PARAM[0]}
56
+ FFN_HIDDEN_SIZE=${MODEL_PARAM[1]}
57
+ KV_SIZE=${MODEL_PARAM[2]}
58
+ NHEADS=${MODEL_PARAM[3]}
59
+ NLAYERS=${MODEL_PARAM[4]}
60
+ SEQ_LEN=2048
61
+
62
+ echo "Model parameters: d_model $NHIDDEN ffw_size $FFN_HIDDEN_SIZE kv_size $KV_SIZE n_heads $NHEADS n_layers $NLAYERS"
63
+
64
+ SAVE_INTERVAL=10000
65
+
66
+ # Tokens: 55000000000
67
+ # -> Samples: 26855469
68
+ TRAIN_SAMPLES=26_855_469
69
+
70
+ OPTIMIZER_ARGS=" \
71
+ --optimizer adam \
72
+ --adam-beta1 0.9 \
73
+ --adam-beta2 0.95 \
74
+ --adam-eps 1e-8 \
75
+ --lr 2e-4 \
76
+ --min-lr 2e-5 \
77
+ --lr-decay-style cosine \
78
+ --lr-decay-samples $TRAIN_SAMPLES \
79
+ --lr-warmup-samples 268_555 \
80
+ --clip-grad 1.0 \
81
+ --weight-decay 1e-1 \
82
+ "
83
+
84
+ GPT_ARGS=" \
85
+ --num-layers $NLAYERS \
86
+ --hidden-size $NHIDDEN \
87
+ --num-attention-heads $NHEADS \
88
+ --kv-channels $KV_SIZE \
89
+ --ffn-hidden-size $FFN_HIDDEN_SIZE \
90
+ --seq-length $SEQ_LEN \
91
+ --max-position-embeddings $SEQ_LEN \
92
+ --micro-batch-size $MICRO_BATCH_SIZE \
93
+ --global-batch-size $GLOBAL_BATCH_SIZE \
94
+ --train-samples $TRAIN_SAMPLES \
95
+ --vocab-file $VOCAB_FILE \
96
+ --merge-file $MERGE_FILE \
97
+ --clip-grad 1.0 \
98
+ --kill-switch-path $KILL_SWITCH_PATH \
99
+ --bf16 \
100
+ $OPTIMIZER_ARGS \
101
+ "
102
+
103
+ OUTPUT_ARGS=" \
104
+ --log-interval 10 \
105
+ --save-interval $SAVE_INTERVAL \
106
+ --eval-interval 100 \
107
+ --eval-iters 100 \
108
+ --tensorboard-dir $TENSORBOARD_PATH \
109
+ --tensorboard-queue-size 5 \
110
+ --log-timers-to-tensorboard \
111
+ --log-batch-size-to-tensorboard \
112
+ --log-validation-ppl-to-tensorboard \
113
+ "
114
+
115
+ ZERO_STAGE=0
116
+
117
+ mkdir -p ds_configs
118
+ DS_CONFIG_PATH="ds_configs/$SLURM_JOB_ID.json"
119
+
120
+ cat <<EOF > $DS_CONFIG_PATH
121
+ {
122
+ "train_micro_batch_size_per_gpu": $MICRO_BATCH_SIZE,
123
+ "train_batch_size": $GLOBAL_BATCH_SIZE,
124
+ "gradient_clipping": 1.0,
125
+ "zero_optimization": {
126
+ "stage": $ZERO_STAGE
127
+ },
128
+ "bf16": {
129
+ "enabled": true
130
+ },
131
+ "steps_per_print": 2000,
132
+ "wall_clock_breakdown": false
133
+ }
134
+ EOF
135
+
136
+ DEEPSPEED_ARGS=" \
137
+ --deepspeed \
138
+ --deepspeed_config $DS_CONFIG_PATH \
139
+ --zero-stage $ZERO_STAGE \
140
+ "
141
+
142
+ CMD=" \
143
+ Megatron-DeepSpeed/pretrain_gpt.py \
144
+ --tensor-model-parallel-size $TP_SIZE \
145
+ --pipeline-model-parallel-size $PP_SIZE \
146
+ $GPT_ARGS \
147
+ $OUTPUT_ARGS \
148
+ --save $CHECKPOINT_PATH \
149
+ --load $CHECKPOINT_PATH \
150
+ --train-weighted-split-paths-path $TRAIN_DATA_PATH \
151
+ --valid-weighted-split-paths-path $VALID_DATA_PATH \
152
+ --data-impl mmap \
153
+ $DEEPSPEED_ARGS \
154
+ "
155
+
156
+ echo $CMD
157
+
158
+ echo "START $SLURM_JOBID: $(date)"
159
+
160
+ # bash launch_srun.sh $CMD
161
+ srun --label launch.sh $CMD
162
+
163
+ echo "END $SLURM_JOBID: $(date)"
sbatch_2b855b4bc4.sh ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ #SBATCH --exclude=nid007571,nid007112,nid006774,nid007502,nid007506,nid007507,nid005145,nid006692,nid007218,nid007123,nid006124,nid006123,nid007496,nid007237,nid006852,nid007206,nid006947,nid007212,nid006977,nid007222,nid005444,nid007219,nid007493,nid007221,nid005300,nid005619,nid006118,nid005203,nid006113,nid006481,nid007077,nid005208,nid005207,nid005879,nid005901
3
+ #SBATCH --nodes=32
4
+ #SBATCH --ntasks-per-node=1
5
+ #SBATCH --cpus-per-task=32
6
+ #SBATCH --mem=256G
7
+ #SBATCH -p standard-g
8
+ #SBATCH -t 48:00:00
9
+ #SBATCH --gpus-per-node=mi250:8
10
+ #SBATCH --exclusive=user
11
+ #SBATCH --hint=nomultithread
12
+ #SBATCH --account=project_462000119
13
+ #SBATCH -o logs/%j.out
14
+ #SBATCH -e logs/%j.err
15
+
16
+ VARIANT=2b855b4bc4
17
+
18
+ # if run without sbatch, invoke here
19
+ if [ -z $SLURM_JOB_ID ]; then
20
+ mkdir -p logs
21
+ sbatch "$0"
22
+ exit
23
+ fi
24
+
25
+ set -euo pipefail
26
+
27
+ # symlink logs/latest.out and logs/latest.err
28
+ ln -f -s $SLURM_JOB_ID.out logs/latest.out
29
+ ln -f -s $SLURM_JOB_ID.err logs/latest.err
30
+
31
+ KILL_SWITCH_PATH=kill-switch-$VARIANT
32
+ CHECKPOINT_PATH=checkpoints_$VARIANT
33
+ TENSORBOARD_PATH=tensorboard_$VARIANT
34
+
35
+ # Data
36
+ VOCAB_FILE="gpt2/vocab.json"
37
+ MERGE_FILE="gpt2/merges.txt"
38
+
39
+ TRAIN_DATA_PATH=train4b.txt
40
+ # "train: 1.0 0:1 /scratch/project_462000119/data/c4_subsampled/gpt2tok_c4_en_4B_text_document"
41
+ VALID_DATA_PATH=val.txt
42
+ # "validation: 1.0 0:1 /scratch/project_462000119/data/c4_validation/gpt2tok_c4validation_rerun_text_document"
43
+
44
+ PP_SIZE=1
45
+ TP_SIZE=1
46
+
47
+ MICRO_BATCH_SIZE=2
48
+ GRADIENT_ACCUMULATION_STEPS=1
49
+ WORLD_SIZE=$((SLURM_GPUS_ON_NODE*SLURM_JOB_NUM_NODES))
50
+ GLOBAL_BATCH_SIZE=$((MICRO_BATCH_SIZE*WORLD_SIZE*GRADIENT_ACCUMULATION_STEPS))
51
+
52
+ # Model parameters
53
+ source model_params.sh
54
+ MODEL_PARAM=("${PARAM_2980M[@]}")
55
+ NHIDDEN=${MODEL_PARAM[0]}
56
+ FFN_HIDDEN_SIZE=${MODEL_PARAM[1]}
57
+ KV_SIZE=${MODEL_PARAM[2]}
58
+ NHEADS=${MODEL_PARAM[3]}
59
+ NLAYERS=${MODEL_PARAM[4]}
60
+ SEQ_LEN=2048
61
+
62
+ echo "Model parameters: d_model $NHIDDEN ffw_size $FFN_HIDDEN_SIZE kv_size $KV_SIZE n_heads $NHEADS n_layers $NLAYERS"
63
+
64
+ SAVE_INTERVAL=10000
65
+
66
+ # Tokens: 55000000000
67
+ # -> Samples: 26855469
68
+ TRAIN_SAMPLES=26_855_469
69
+
70
+ OPTIMIZER_ARGS=" \
71
+ --optimizer adam \
72
+ --adam-beta1 0.9 \
73
+ --adam-beta2 0.95 \
74
+ --adam-eps 1e-8 \
75
+ --lr 2e-4 \
76
+ --min-lr 2e-5 \
77
+ --lr-decay-style cosine \
78
+ --lr-decay-samples $TRAIN_SAMPLES \
79
+ --lr-warmup-samples 268_555 \
80
+ --clip-grad 1.0 \
81
+ --weight-decay 1e-1 \
82
+ "
83
+
84
+ GPT_ARGS=" \
85
+ --num-layers $NLAYERS \
86
+ --hidden-size $NHIDDEN \
87
+ --num-attention-heads $NHEADS \
88
+ --kv-channels $KV_SIZE \
89
+ --ffn-hidden-size $FFN_HIDDEN_SIZE \
90
+ --seq-length $SEQ_LEN \
91
+ --max-position-embeddings $SEQ_LEN \
92
+ --micro-batch-size $MICRO_BATCH_SIZE \
93
+ --global-batch-size $GLOBAL_BATCH_SIZE \
94
+ --train-samples $TRAIN_SAMPLES \
95
+ --vocab-file $VOCAB_FILE \
96
+ --merge-file $MERGE_FILE \
97
+ --clip-grad 1.0 \
98
+ --kill-switch-path $KILL_SWITCH_PATH \
99
+ --bf16 \
100
+ $OPTIMIZER_ARGS \
101
+ "
102
+
103
+ OUTPUT_ARGS=" \
104
+ --log-interval 10 \
105
+ --save-interval $SAVE_INTERVAL \
106
+ --eval-interval 100 \
107
+ --eval-iters 100 \
108
+ --tensorboard-dir $TENSORBOARD_PATH \
109
+ --tensorboard-queue-size 5 \
110
+ --log-timers-to-tensorboard \
111
+ --log-batch-size-to-tensorboard \
112
+ --log-validation-ppl-to-tensorboard \
113
+ "
114
+
115
+ ZERO_STAGE=0
116
+
117
+ mkdir -p ds_configs
118
+ DS_CONFIG_PATH="ds_configs/$SLURM_JOB_ID.json"
119
+
120
+ cat <<EOF > $DS_CONFIG_PATH
121
+ {
122
+ "train_micro_batch_size_per_gpu": $MICRO_BATCH_SIZE,
123
+ "train_batch_size": $GLOBAL_BATCH_SIZE,
124
+ "gradient_clipping": 1.0,
125
+ "zero_optimization": {
126
+ "stage": $ZERO_STAGE
127
+ },
128
+ "bf16": {
129
+ "enabled": true
130
+ },
131
+ "steps_per_print": 2000,
132
+ "wall_clock_breakdown": false
133
+ }
134
+ EOF
135
+
136
+ DEEPSPEED_ARGS=" \
137
+ --deepspeed \
138
+ --deepspeed_config $DS_CONFIG_PATH \
139
+ --zero-stage $ZERO_STAGE \
140
+ "
141
+
142
+ CMD=" \
143
+ Megatron-DeepSpeed/pretrain_gpt.py \
144
+ --tensor-model-parallel-size $TP_SIZE \
145
+ --pipeline-model-parallel-size $PP_SIZE \
146
+ $GPT_ARGS \
147
+ $OUTPUT_ARGS \
148
+ --save $CHECKPOINT_PATH \
149
+ --load $CHECKPOINT_PATH \
150
+ --train-weighted-split-paths-path $TRAIN_DATA_PATH \
151
+ --valid-weighted-split-paths-path $VALID_DATA_PATH \
152
+ --data-impl mmap \
153
+ $DEEPSPEED_ARGS \
154
+ "
155
+
156
+ echo $CMD
157
+
158
+ echo "START $SLURM_JOBID: $(date)"
159
+
160
+ # bash launch_srun.sh $CMD
161
+ srun --label launch.sh $CMD
162
+
163
+ echo "END $SLURM_JOBID: $(date)"