Skip to content

Commit

Permalink
fix gpt N4C32 dp script bug (#3392)
Browse files Browse the repository at this point in the history
  • Loading branch information
sneaxiy authored Sep 29, 2022
1 parent 985a9a4 commit d6f1c61
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions tests/test_tipc/benchmark_train.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#!/bin/bash

# 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.

source test_tipc/common_func.sh

# run benchmark sh
Expand Down Expand Up @@ -67,6 +82,12 @@ function set_gpu_id(){
echo $seq
}

function get_world_size(){
IFS="C"
arr=($1)
echo ${arr[1]}
}

function get_repo_name(){
IFS=";"
cur_dir=$(pwd)
Expand Down Expand Up @@ -202,10 +223,10 @@ for batch_size in ${batch_size_list[*]}; do

# NOTE: Only for GPT for now.
if [[ ${model_name} =~ gpt* ]]; then
num_gpu_devices=$[(${#gpu_id}+1)/2]
num_gpu_devices=`get_world_size $device_num`
sed_norm_train=$norm_train

global_batch_size=$[$batch_size*$num_gpu_devices]
global_batch_size=$(($batch_size*$num_gpu_devices))
extra_params="--global_batch_size=$global_batch_size --dp_degree=$num_gpu_devices"
sed_norm_train="$sed_norm_train $extra_params"

Expand Down

0 comments on commit d6f1c61

Please sign in to comment.