Merge pull request #1058 from Jackwaterveg/benchmark

[benchmark]fix the benchmark
pull/1064/head
Hui Zhang 4 years ago committed by GitHub
commit 4823892169
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -245,8 +245,9 @@ class Trainer():
self.maybe_batch_sampler_step()
def after_train_batch(self):
if self.args.benchmark_max_step and self.iteration > self.args.benchmark_max_step:
if self.args.benchmark_max_step:
profiler.add_profiler_step(self.args.profiler_options)
if self.args.benchmark_max_step and self.iteration > self.args.benchmark_max_step:
logger.info(
f"Reach benchmark-max-step: {self.args.benchmark_max_step}")
sys.exit(

@ -2,7 +2,7 @@ cd ../../../
pip install -e . # 安装pdspeech
cd -
#Enter the example dir
pushd ../../../examples/aishell/s1
pushd ../../../examples/aishell/asr1
#Prepare the data
bash run.sh --stage 0 --stop_stage 0

@ -8,7 +8,7 @@ cd ${CUR_DIR}
sed -i '/set\ -xe/d' run_benchmark.sh
#cd **
pushd ../../../examples/aishell/s1
pushd ../../../examples/aishell/asr1
# 1 安装该模型需要的依赖 (如需开启优化策略请注明)
# 2 拷贝该模型需要数据、预训练模型

@ -1,5 +1,4 @@
#!/usr/bin/env bash
set -xe
# 运行示例CUDA_VISIBLE_DEVICES=0 bash run_benchmark.sh ${run_mode} ${bs_item} ${fp_item} 500 ${model_mode}
# 参数说明
function _set_params(){
@ -35,13 +34,15 @@ function _set_params(){
function _train(){
echo "Train on ${num_gpu_devices} GPUs"
echo "current CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES, gpus=$num_gpu_devices, batch_size=$batch_size"
train_cmd="--config=${config_path}
--output=${output}
--seed=${seed}
--ngpu=${ngpu}
--profiler-options "${profiler_options}"
--benchmark-batch-size ${batch_size}
train_cmd="--config=${config_path} \
--output=${output} \
--seed=${seed} \
--ngpu=${ngpu} \
--benchmark-batch-size ${batch_size} \
--benchmark-max-step ${benchmark_max_step} "
if [ ${profiler_options} != "None" ]; then
train_cmd=${train_cmd}" --profiler-options=${profiler_options}"
fi
case ${run_mode} in
sp) train_cmd="python -u ${BIN_DIR}/train.py "${train_cmd} ;;

Loading…
Cancel
Save