-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_SLM_pretrain.sh
More file actions
290 lines (277 loc) · 7.87 KB
/
run_SLM_pretrain.sh
File metadata and controls
290 lines (277 loc) · 7.87 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
#If you have to use any variable with None value, then skip that variable in the script below.
#The Default value will be used in that case. Else None will go as 'None' and error will rise in the code.
#Pre-Training params for custom SLM model with Multi Head Attention:
# num_epochs=1
# top_k=20
# temp=1
# max_new_tokens=50
# context_length=256
# vocab_size=50257
# embedding_dimension=384
# num_heads=8
# num_layers=8
# qkv_bias=False
# eval_batchSize=64
# eval_freq=64
# weight_decay=0.1
# beta1=0.9
# beta2=0.95
# val_split=0.05
# train_split=0.85
# batch_size=32
# target_batch_size=256 #1024
# seed=123
# dropout_rate=0.2 #Pre-training = 0.0, FT = 0.1+ (Karpathy)
# eos_id=50256
# use_warmup=True
# use_gradient_clip=True
# warmup_steps=0.05
# initial_lr=0.00001 #3e-05
# #min_lr=0.000001 #--> being calculated as 0.1 * of max LR
# learning_rate=0.0008 #3e-4 --> Good LR (Karpathy)
# rms_eps=1e-6
# rms_bias=True
# theta_base=10000.0
# num_experts=4
# num_active_experts=2
# num_kv_groups=1
# ff_hidden_dim=400
# arch_type='original'
# kv_cache=True
# moe_noise=True
# train_type='resume'
# python gpt_pretrainingPipeline.py \
# --experiment_name 'Pre-Train_Exp_CustomConfig_ORGarch_S_V4_resume_16' \
# --data_path 'tinystories' \
# --model_type 'custom' \
# --arch_type $arch_type \
# --model_name 'gpt2_ORG_preTrain_S_V4' \
# --pre_save_model 'gpt2_ORG_preTrain_S_V4.pth' \
# --tokenizer 'tiktoken' \
# --seed $seed \
# --batch_size $batch_size \
# --eval_batchSize $eval_batchSize \
# --eval_freq $eval_freq \
# --target_batch_size $target_batch_size \
# --train_split $train_split \
# --val_split $val_split \
# --optimizer 'AdamW' \
# --context_length $context_length \
# --vocab_size $vocab_size \
# --embedding_dimension $embedding_dimension \
# --max_training_length 'model_context_length' \
# --num_heads $num_heads \
# --num_layers $num_layers \
# --weight_decay $weight_decay \
# --beta1 $beta1 \
# --beta2 $beta2 \
# --rms_eps $rms_eps \
# --rms_bias $rms_bias \
# --theta_base $theta_base \
# --num_experts $num_experts \
# --num_active_experts $num_active_experts \
# --num_kv_groups $num_kv_groups \
# --ff_hidden_dim $ff_hidden_dim \
# --max_new_tokens $max_new_tokens \
# --temp $temp \
# --top_k $top_k \
# --dropout_rate $dropout_rate \
# --num_epochs $num_epochs \
# --eos_id $eos_id \
# --initial_lr $initial_lr \
# --warmup_steps $warmup_steps \
# --learning_rate $learning_rate \
# --use_gradient_clip $use_gradient_clip \
# --use_warmup $use_warmup \
# --moe_noise $moe_noise \
# --train_type $train_type \
# --kv_cache $kv_cache \
# --qkv_bias $qkv_bias \
#Pre-training params for Group Query Attention based SLM model:
# num_epochs=1
# top_k=30
# temp=1
# max_new_tokens=50
# context_length=256
# vocab_size=50257
# embedding_dimension=512
# num_heads=8
# num_layers=8 #12
# qkv_bias=False
# eval_batchSize=64
# eval_freq=64
# weight_decay=0.1
# beta1=0.9
# beta2=0.95
# val_split=0.05
# train_split=0.85
# batch_size=16
# target_batch_size=256 #1024
# seed=123
# dropout_rate=0.2 #Pre-training = 0.0, FT = 0.1+ (Karpathy)
# token_dropout_rate=0.03
# attention_dropout_rate=0.2
# ffn_dropout_rate=0.2 #Used only in MoE Achitecture
# eos_id=50256
# use_warmup=True
# use_gradient_clip=True
# warmup_steps=0.05
# initial_lr=0.00003 #3e-05
# #min_lr=0.000001 #--> being calculated as 0.1 * of max LR
# learning_rate=0.0003 #0.0008 #3e-4 --> Good LR (Karpathy) #6e-4
# rms_eps=1e-6
# rms_bias=True
# theta_base=10000.0
# num_experts=4
# num_active_experts=2
# num_kv_groups=4
# ff_hidden_dim=1024
# arch_type='GQA'
# kv_cache=True
# moe_noise=True
# train_type='resume'
# python gpt_pretrainingPipeline.py \
# --experiment_name 'Pre-Train_Exp_CustomConfig_GQAarch_S_V1_resume_8' \
# --data_path 'tinystories' \
# --model_type 'custom' \
# --arch_type $arch_type \
# --model_name 'gpt2_GQA_preTrain_S_V1' \
# --pre_save_model 'gpt2_GQA_preTrain_S_V1.pth' \
# --tokenizer 'tiktoken' \
# --seed $seed \
# --batch_size $batch_size \
# --eval_batchSize $eval_batchSize \
# --eval_freq $eval_freq \
# --target_batch_size $target_batch_size \
# --train_split $train_split \
# --val_split $val_split \
# --optimizer 'AdamW' \
# --context_length $context_length \
# --vocab_size $vocab_size \
# --embedding_dimension $embedding_dimension \
# --max_training_length 'model_context_length' \
# --num_heads $num_heads \
# --num_layers $num_layers \
# --weight_decay $weight_decay \
# --beta1 $beta1 \
# --beta2 $beta2 \
# --rms_eps $rms_eps \
# --rms_bias $rms_bias \
# --theta_base $theta_base \
# --num_experts $num_experts \
# --num_active_experts $num_active_experts \
# --num_kv_groups $num_kv_groups \
# --ff_hidden_dim $ff_hidden_dim \
# --max_new_tokens $max_new_tokens \
# --temp $temp \
# --top_k $top_k \
# --dropout_rate $dropout_rate \
# --token_dropout_rate $token_dropout_rate \
# --attention_dropout_rate $attention_dropout_rate \
# --ffn_dropout_rate $ffn_dropout_rate \
# --num_epochs $num_epochs \
# --eos_id $eos_id \
# --initial_lr $initial_lr \
# --warmup_steps $warmup_steps \
# --learning_rate $learning_rate \
# --use_gradient_clip $use_gradient_clip \
# --use_warmup $use_warmup \
# --moe_noise $moe_noise \
# --train_type $train_type \
# --kv_cache $kv_cache \
# --qkv_bias $qkv_bias \
#Pre-training params for Mixture-Of-Experts based SLM model:
num_epochs=1
top_k=30
temp=1
max_new_tokens=50
context_length=256
vocab_size=50257
embedding_dimension=768
num_heads=12
num_layers=8 #12
qkv_bias=False
eval_batchSize=64
eval_freq=64
weight_decay=0.1
beta1=0.9
beta2=0.95
val_split=0.05
train_split=0.85
batch_size=16
target_batch_size=256 #1024
seed=123
dropout_rate=0.2 #Pre-training = 0.0, FT = 0.1+ (Karpathy)
token_dropout_rate=0.03
attention_dropout_rate=0.2
ffn_dropout_rate=0.2 #Used only in MoE Achitecture
eos_id=50256
use_warmup=True
use_gradient_clip=True
warmup_steps=0.066 #0.05 --> Started with
initial_lr=0.00003 #3e-05
#min_lr=0.000001 #--> being calculated as 0.1 * of max LR
learning_rate=0.0003 #0.0008 #3e-4 --> Good LR (Karpathy) #6e-4
rms_eps=1e-6
rms_bias=True
theta_base=10000.0
num_experts=4
num_active_experts=2
num_kv_groups=4
ff_hidden_dim=1024
arch_type='MOE'
kv_cache=True
moe_noise=True
train_type='scratch'
max_steps=5000
python gpt_pretrainingPipeline.py \
--experiment_name 'Pre-Train_Exp_CustomConfig_MOEarch_S_V3_scratch' \
--data_path 'tinystories' \
--model_type 'custom' \
--arch_type $arch_type \
--model_name 'gpt2_MOE_preTrain_S_V3' \
--pre_save_model 'gpt2_MOE_preTrain_S_V3.pth' \
--tokenizer 'tiktoken' \
--seed $seed \
--batch_size $batch_size \
--eval_batchSize $eval_batchSize \
--eval_freq $eval_freq \
--target_batch_size $target_batch_size \
--train_split $train_split \
--val_split $val_split \
--optimizer 'AdamW' \
--context_length $context_length \
--vocab_size $vocab_size \
--embedding_dimension $embedding_dimension \
--max_training_length 'model_context_length' \
--num_heads $num_heads \
--num_layers $num_layers \
--weight_decay $weight_decay \
--beta1 $beta1 \
--beta2 $beta2 \
--rms_eps $rms_eps \
--rms_bias $rms_bias \
--theta_base $theta_base \
--num_experts $num_experts \
--num_active_experts $num_active_experts \
--num_kv_groups $num_kv_groups \
--ff_hidden_dim $ff_hidden_dim \
--max_new_tokens $max_new_tokens \
--temp $temp \
--top_k $top_k \
--dropout_rate $dropout_rate \
--token_dropout_rate $token_dropout_rate \
--attention_dropout_rate $attention_dropout_rate \
--ffn_dropout_rate $ffn_dropout_rate \
--num_epochs $num_epochs \
--eos_id $eos_id \
--initial_lr $initial_lr \
--warmup_steps $warmup_steps \
--learning_rate $learning_rate \
--use_gradient_clip $use_gradient_clip \
--use_warmup $use_warmup \
--moe_noise $moe_noise \
--train_type $train_type \
--max_steps $max_steps \
--kv_cache $kv_cache \
# --qkv_bias $qkv_bias \