forked from PaddlePaddle/PaddleHelix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgpu_train.sh
223 lines (202 loc) · 7 KB
/
gpu_train.sh
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
#!/bin/bash
source ~/.bashrc
cd $(dirname $0)
root_path="$(pwd)"
conda activate helixfold
# python_bin="/opt/compiler/gcc-8.2/lib/ld-linux-x86-64.so.2 --library-path /opt/compiler/gcc-8.2/lib:/usr/lib64:/home/ide/v2/conda/envs/cuda10.1_cudnn7.6.5/lib /home/liulihang/tools/paddle-dev/bin/python"
python_bin="/opt/conda/envs/helixfold/bin/python"
# python_bin="python3"
# export NCCL_DEBUG=INFO
export PYTHONPATH=$root_path:$PYTHONPATH
# export PADDLE_NODE_NUM=$PADDLE_TRAINERS_NUM
# export PADDLE_NODE_NUM=1
TM_SCORE_BIN="$root_path/tools/tm_score"
LDDT_SCORE_BIN="$root_path/tools/lddt"
chmod +x $TM_SCORE_BIN
chmod +x $LDDT_SCORE_BIN
# disable C++ enisum, using python enisum
export FLAGS_new_einsum=0
export FLAGS_enable_eager_mode=0
train_af2_single() {
start_step=0
train_step=105
CUDA_VISIBLE_DEVICES=0 $python_bin train.py \
${only_test} \
--tm_score_bin="$TM_SCORE_BIN" \
--lddt_score_bin="$LDDT_SCORE_BIN" \
--data_config=${data_config} \
--train_config=${train_config} \
--model_name=${model_name} \
--init_model=${init_model} \
--start_step=${start_step} \
--train_step=${train_step} \
--precision=${precision} \
--num_workers 6 \
--seed 2022 \
--batch_size=$batch_size \
--dap_degree=$dap_degree \
--bp_degree=$bp_degree \
${log_step} \
${eval_step} \
${save_step} \
--model_dir="./debug_models" \
--log_dir="./debug_log" \
# &> ./debug_log/$exp_name.log
}
train_af2_distributed() {
start_step=0
train_step=105
$python_bin -m paddle.distributed.launch train.py \
--distributed \
${only_test} \
--tm_score_bin="$TM_SCORE_BIN" \
--lddt_score_bin="$LDDT_SCORE_BIN" \
--data_config=${data_config} \
--train_config=${train_config} \
--model_name=${model_name} \
--init_model=${init_model} \
--start_step=${start_step} \
--train_step=${train_step} \
--precision=${precision} \
--num_workers 6 \
--seed 2022 \
--batch_size=$batch_size \
--dap_degree=$dap_degree \
--bp_degree=$bp_degree \
${log_step} \
${eval_step} \
${save_step} \
--model_dir="./debug_models" \
--log_dir="./debug_log" \
# &> ./debug_log/$exp_name.log
}
exp_name="$1"
# exp_name="demo-initial" # model 1
# exp_name="demo-finetune" # model 1.1.1
mkdir -p debug_log debug_models
### Initial Training_N1C1
{
if [[ "$exp_name" == "demo_initial_N1C1" ]]; then
batch_size=1
dap_degree=1
bp_degree=1
train_config="./train_configs/demo.json"
data_config="./data_configs/demo.json"
model_name="initial"
precision="bf16"
# precision="fp32"
log_step="--log_step=20"
eval_step="--eval_step=1000"
save_step="--save_step=1000"
# init_model="$root_path/data/af2_pd_params/model_5.pdparams"
train_af2_single
fi
}
### Finetune_N1C1
{
if [[ "$exp_name" == "demo_finetune_N1C1" ]]; then
export FLAGS_allocator_strategy=naive_best_fit
export FLAGS_fraction_of_gpu_memory_to_use=0.92
batch_size=1
dap_degree=1
bp_degree=1
train_config="./train_configs/demo.json"
data_config="./data_configs/demo.json"
model_name="finetune"
precision="bf16"
# precision="fp32"
log_step="--log_step=20"
eval_step="--eval_step=1000"
save_step="--save_step=1000"
# init_model="$root_path/data/af2_pd_params/model_5.pdparams"
train_af2_single
fi
}
### Initial Training_N1C8
{
if [[ "$exp_name" == "demo_initial_N1C8" ]]; then
export PADDLE_NNODES=1
export PADDLE_MASTER="127.0.0.1:12538" # set PADDLE_MASTER="xxx.xxx.xxx.xxx:port" according to your network environment
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
batch_size=1
dap_degree=1
bp_degree=1
train_config="./train_configs/demo.json"
data_config="./data_configs/demo.json"
model_name="initial"
precision="bf16"
# precision="fp32"
log_step="--log_step=20"
eval_step="--eval_step=1000"
save_step="--save_step=1000"
# init_model="$root_path/data/af2_pd_params/model_5.pdparams"
train_af2_distributed
fi
}
### Finetune_N1C8
{
if [[ "$exp_name" == "demo_finetune_N1C8" ]]; then
export FLAGS_allocator_strategy=naive_best_fit
export FLAGS_fraction_of_gpu_memory_to_use=0.92
export PADDLE_NNODES=1
export PADDLE_MASTER="127.0.0.1:12538" # set PADDLE_MASTER="xxx.xxx.xxx.xxx:port" according to your network environment
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
batch_size=1
dap_degree=1
bp_degree=1
train_config="./train_configs/demo.json"
data_config="./data_configs/demo.json"
model_name="finetune"
precision="bf16"
# precision="fp32"
log_step="--log_step=20"
eval_step="--eval_step=1000"
save_step="--save_step=1000"
# init_model="$root_path/data/af2_pd_params/model_5.pdparams"
train_af2_distributed
fi
}
### Initial Training_N8C64
{
if [[ "$exp_name" == "demo_initial_N8C64" ]]; then
export PADDLE_NNODES=8 # set number of devices
export PADDLE_MASTER="xxx.xxx.xxx.xxx:port" # set PADDLE_MASTER="xxx.xxx.xxx.xxx:port" according to your network environment
# export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
batch_size=1
dap_degree=1
bp_degree=1
train_config="./train_configs/demo.json"
data_config="./data_configs/demo.json"
model_name="initial"
precision="bf16"
# precision="fp32"
log_step="--log_step=20"
eval_step="--eval_step=1000"
save_step="--save_step=1000"
# init_model="$root_path/data/af2_pd_params/model_5.pdparams"
train_af2_distributed
fi
}
### Finetune_N8C64
{
if [[ "$exp_name" == "demo_finetune_N8C64" ]]; then
export FLAGS_allocator_strategy=naive_best_fit
export FLAGS_fraction_of_gpu_memory_to_use=0.92
export PADDLE_NNODES=8 # set number of devices
export PADDLE_MASTER="xxx.xxx.xxx.xxx:port" # set PADDLE_MASTER="xxx.xxx.xxx.xxx:port" according to your network environment
# export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
batch_size=1
dap_degree=1
bp_degree=1
train_config="./train_configs/demo.json"
data_config="./data_configs/demo.json"
model_name="finetune"
precision="bf16"
# precision="fp32"
log_step="--log_step=20"
eval_step="--eval_step=1000"
save_step="--save_step=1000"
# init_model="$root_path/data/af2_pd_params/model_5.pdparams"
train_af2_distributed
fi
}