Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Add CE] Add CE for Hybrid Parallism #7817

Merged
merged 17 commits into from
Jan 22, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pp_degree=1
bs_item=32
fp_item=bf16
run_mode=MP2-SP2-SD2-Stage1-mbs8-acc2
device_num=N1C8
device_num=N1C4
max_iter=50000
sharding=stage1
sharding_degree=2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pp_degree=1
bs_item=32
fp_item=bf16
run_mode=MP2-SP2-SD2-Stage1-mbs8-acc2
device_num=N1C8
device_num=N1C4
max_iter=100
sharding=stage1
sharding_degree=2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

model_item=gpt-345m_seqlen1024_pretrain
model_item=CE_gpt-345m_seqlen1024_pretrain
dp_degree=1
mp_degree=2
pp_degree=2
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

model_item=CE_gpt-345m_seqlen1024_pretrain
dp_degree=2
mp_degree=2
pp_degree=4
bs_item=32
fp_item=bf16
run_mode=MP2-PP4-VPP2-DP2-mbs2-acc8
device_num=N2C16
max_iter=50000
sharding=False
sharding_degree=1

virtual_pp_degree=2
use_recompute=True
eval_freq=25
use_pipeline_parallel=True
sequence_parallel=False

model=gpt
micro_bs=2
acc=8
seed=1234

bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/prepare.sh
# run
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/run_benchmark.sh ${model_item} ${fp_item} ${dp_degree} ${mp_degree} ${pp_degree} ${micro_bs} ${bs_item} ${run_mode} ${device_num} \
${max_iter} ${sharding} ${sharding_degree} ${virtual_pp_degree} ${use_recompute} ${eval_freq} ${use_pipeline_parallel} ${sequence_parallel} ${acc} ${seed} 2>&1;
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

model_item=CE_gpt-345m_seqlen1024_pretrain
dp_degree=1
mp_degree=2
pp_degree=4
bs_item=32
fp_item=bf16
run_mode=MP2-PP4-VPP2-SD2-stage1-mbs2-acc8
device_num=N2C16
max_iter=50000
max_iter=50000
sharding=stage1
sharding_degree=2
virtual_pp_degree=2
use_recompute=True
eval_freq=25
use_pipeline_parallel=True
sequence_parallel=False

model=gpt
micro_bs=2
acc=8
seed=1234

bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/prepare.sh
# run
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/run_benchmark.sh ${model_item} ${fp_item} ${dp_degree} ${mp_degree} ${pp_degree} ${micro_bs} ${bs_item} ${run_mode} ${device_num} \
${max_iter} ${sharding} ${sharding_degree} ${virtual_pp_degree} ${use_recompute} ${eval_freq} ${use_pipeline_parallel} ${sequence_parallel} ${acc} ${seed} 2>&1;
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

model_item=CE_gpt-345m_seqlen1024_pretrain
dp_degree=2
mp_degree=2
pp_degree=4
bs_item=32
fp_item=bf16
run_mode=MP2-SP2-PP4-VPP2-DP2-mbs2-acc8
device_num=N2C16
max_iter=50000
sharding=False
sharding_degree=1

virtual_pp_degree=2
use_recompute=True
eval_freq=25
use_pipeline_parallel=True
sequence_parallel=True

model=gpt
micro_bs=2
acc=8
seed=1234

bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/prepare.sh
# run
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/run_benchmark.sh ${model_item} ${fp_item} ${dp_degree} ${mp_degree} ${pp_degree} ${micro_bs} ${bs_item} ${run_mode} ${device_num} \
${max_iter} ${sharding} ${sharding_degree} ${virtual_pp_degree} ${use_recompute} ${eval_freq} ${use_pipeline_parallel} ${sequence_parallel} ${acc} ${seed} 2>&1;
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ sequence_parallel=True
model=gpt
micro_bs=2
acc=8
seed=3589

bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/prepare.sh
# run
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

model_item=gpt-345m_seqlen1024_pretrain
dp_degree=2
mp_degree=2
pp_degree=4
bs_item=32
fp_item=bf16
run_mode=MP2-PP4-VPP2-DP2-mbs2-acc8
device_num=N2C16
max_iter=100
sharding=False
sharding_degree=1

virtual_pp_degree=2
use_recompute=True
eval_freq=25
use_pipeline_parallel=True
sequence_parallel=False

model=gpt
micro_bs=2
acc=8
seed=1234

bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/prepare.sh
# run
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/run_benchmark.sh ${model_item} ${fp_item} ${dp_degree} ${mp_degree} ${pp_degree} ${micro_bs} ${bs_item} ${run_mode} ${device_num} \
${max_iter} ${sharding} ${sharding_degree} ${virtual_pp_degree} ${use_recompute} ${eval_freq} ${use_pipeline_parallel} ${sequence_parallel} ${acc} ${seed} 2>&1;
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

model_item=gpt-345m_seqlen1024_pretrain
dp_degree=1
mp_degree=2
pp_degree=4
bs_item=32
fp_item=bf16
run_mode=MP2-PP4-VPP2-SD2-stage1-mbs2-acc8
device_num=N2C16
max_iter=100
sharding=stage1
sharding_degree=2
virtual_pp_degree=2
use_recompute=True
eval_freq=25
use_pipeline_parallel=True
sequence_parallel=False

model=gpt
micro_bs=2
acc=8
seed=1234

bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/prepare.sh
# run
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/run_benchmark.sh ${model_item} ${fp_item} ${dp_degree} ${mp_degree} ${pp_degree} ${micro_bs} ${bs_item} ${run_mode} ${device_num} \
${max_iter} ${sharding} ${sharding_degree} ${virtual_pp_degree} ${use_recompute} ${eval_freq} ${use_pipeline_parallel} ${sequence_parallel} ${acc} ${seed} 2>&1;
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

model_item=gpt-345m_seqlen1024_pretrain
dp_degree=2
mp_degree=2
pp_degree=4
bs_item=32
fp_item=bf16
run_mode=MP2-SP2-PP4-VPP2-DP2-mbs2-acc8
device_num=N2C16
max_iter=100
sharding=False
sharding_degree=1

virtual_pp_degree=2
use_recompute=True
eval_freq=25
use_pipeline_parallel=True
sequence_parallel=True

model=gpt
micro_bs=2
acc=8
seed=1234

bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/prepare.sh
# run
bash ./test_tipc/dygraph/hybrid_parallelism/ce_gpt/benchmark_common/run_benchmark.sh ${model_item} ${fp_item} ${dp_degree} ${mp_degree} ${pp_degree} ${micro_bs} ${bs_item} ${run_mode} ${device_num} \
${max_iter} ${sharding} ${sharding_degree} ${virtual_pp_degree} ${use_recompute} ${eval_freq} ${use_pipeline_parallel} ${sequence_parallel} ${acc} ${seed} 2>&1;
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function _set_params(){
micro_batch_size=${6:-"2"} # (必选) micro_batch_size
global_batch_size=${7:-"16"} # (必选)global_batch_size
run_mode=${8:-"DP"} # (必选) MP模型并行|DP数据并行|PP流水线并行|混合并行DP1-MP1-PP1|DP2-MP8-PP2|DP1-MP8-PP4|DP4-MP8-PP1
device_num=${9:-"N1C1"} # (必选) 使用的卡数量,N1C1|N1C8|N4C32 (4机32卡)
device_num=${9:-"N1C1"} # (必选) 使用的卡数量,N1C1|N1C8|N1C4|N4C32 (4机32卡)
profiling=${PROFILING:-"false"} # (必选) Profiling 开关,默认关闭,通过全局变量传递
model_repo="PaddleNLP" # (必选) 模型套件的名字
speed_unit="tokens/s" # (必选)速度指标单位
Expand Down Expand Up @@ -153,7 +153,8 @@ function _train(){
run_pretrain.py ${train_cmd}"
workerlog_id=0
;;
DP8-mbs2-acc2|SD8-stage1-mbs2-acc2|SD8-stage2-mbs2-acc2|SD8-stage3-mbs2-acc2|PP8-mbs16-acc2|MP2-SD4-stage1-mbs4-acc2|MP2-SP2-PP2-DP2-mbs8-acc2|MP8-mbs16-acc2|MP2-PP2-DP2-mbs8-acc2|MP2-PP2-SD2-Stage1-mbs8-acc2|MP2-SP2-PP2-SD2-Stage1-mbs8-acc2|MP2-SP2-PP4-VPP2-SD2-stage1-mbs2-acc8) echo "run run_mode: ${run_mode}"
DP8-mbs2-acc2|SD8-stage1-mbs2-acc2|SD8-stage2-mbs2-acc2|SD8-stage3-mbs2-acc2|PP8-mbs16-acc2|MP8-mbs16-acc2|MP2-PP2-DP2-mbs8-acc2|MP2-PP2-SD2-Stage1-mbs8-acc2|MP2-SD4-stage1-mbs4-acc2|MP2-SP2-PP2-DP2-mbs8-acc2|MP2-SP2-PP2-SD2-Stage1-mbs8-acc2|MP2-PP4-VPP2-DP2-mbs2-acc8|MP2-PP4-VPP2-SD2-stage1-mbs2-acc8|MP2-SP2-PP4-VPP2-DP2-mbs2-acc8|MP2-SP2-PP4-VPP2-SD2-stage1-mbs2-acc8)
echo "run run_mode: ${run_mode}"
train_cmd="python -m paddle.distributed.launch --log_dir=./mylog --devices=0,1,2,3,4,5,6,7 ${PADDLE_RANK_OPTION}\
run_pretrain.py ${train_cmd}"
workerlog_id=0
Expand Down