From 4184d7e7382820cc900a1aa9b94a13b12c68ba74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Tue, 6 Jul 2021 14:14:04 +0200 Subject: [PATCH] Refactor GPU examples tests (#8294) --- .azure-pipelines/gpu-tests.yml | 7 ++++--- pl_examples/run_ddp-examples.sh | 13 ------------- pl_examples/run_examples-args.sh | 15 --------------- pl_examples/run_examples.sh | 9 +++++++++ 4 files changed, 13 insertions(+), 31 deletions(-) delete mode 100644 pl_examples/run_ddp-examples.sh delete mode 100644 pl_examples/run_examples-args.sh create mode 100644 pl_examples/run_examples.sh diff --git a/.azure-pipelines/gpu-tests.yml b/.azure-pipelines/gpu-tests.yml index b1fedd578b..6190d27362 100644 --- a/.azure-pipelines/gpu-tests.yml +++ b/.azure-pipelines/gpu-tests.yml @@ -106,8 +106,9 @@ jobs: - script: | set -e python -m pytest pl_examples -v --maxfail=2 --durations=0 - bash pl_examples/run_examples-args.sh --trainer.gpus 1 --trainer.max_epochs 1 --data.batch_size 64 --trainer.limit_train_batches 5 --trainer.limit_val_batches 3 - bash pl_examples/run_ddp-examples.sh --trainer.max_epochs 1 --data.batch_size 32 --trainer.limit_train_batches 2 --trainer.limit_val_batches 2 + bash pl_examples/run_examples.sh --trainer.gpus=1 + bash pl_examples/run_examples.sh --trainer.gpus=2 --trainer.accelerator=ddp + bash pl_examples/run_examples.sh --trainer.gpus=2 --trainer.accelerator=ddp --trainer.precision=16 env: PL_USE_MOCKED_MNIST: "1" - displayName: 'Examples' + displayName: 'Testing: examples' diff --git a/pl_examples/run_ddp-examples.sh b/pl_examples/run_ddp-examples.sh deleted file mode 100644 index 6a1a63b520..0000000000 --- a/pl_examples/run_ddp-examples.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -ARGS_EXTRA_DDP=" --trainer.gpus 2 --trainer.accelerator ddp" -ARGS_EXTRA_AMP=" --trainer.precision 16" - -python pl_examples/basic_examples/simple_image_classifier.py $@ ${ARGS_EXTRA_DDP} -python pl_examples/basic_examples/simple_image_classifier.py $@ ${ARGS_EXTRA_DDP} ${ARGS_EXTRA_AMP} - -python pl_examples/basic_examples/backbone_image_classifier.py $@ ${ARGS_EXTRA_DDP} -python pl_examples/basic_examples/backbone_image_classifier.py $@ ${ARGS_EXTRA_DDP} ${ARGS_EXTRA_AMP} - -python pl_examples/basic_examples/autoencoder.py $@ ${ARGS_EXTRA_DDP} -python pl_examples/basic_examples/autoencoder.py $@ ${ARGS_EXTRA_DDP} ${ARGS_EXTRA_AMP} diff --git a/pl_examples/run_examples-args.sh b/pl_examples/run_examples-args.sh deleted file mode 100644 index 352869538c..0000000000 --- a/pl_examples/run_examples-args.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -echo $@ - -full_path=$(realpath $0) -echo $full_path - -dir_path=$(dirname $full_path) -echo $dir_path - -python ${dir_path}/basic_examples/simple_image_classifier.py $@ - -python ${dir_path}/basic_examples/backbone_image_classifier.py $@ - -python ${dir_path}/basic_examples/autoencoder.py $@ diff --git a/pl_examples/run_examples.sh b/pl_examples/run_examples.sh new file mode 100644 index 0000000000..4f9e83b373 --- /dev/null +++ b/pl_examples/run_examples.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -ex + +dir_path=$(dirname "${BASH_SOURCE[0]}") +args="--trainer.max_epochs=1 --data.batch_size=32 --trainer.limit_train_batches=2 --trainer.limit_val_batches=2" + +python "${dir_path}/basic_examples/simple_image_classifier.py" "$@" ${args} +python "${dir_path}/basic_examples/backbone_image_classifier.py" "$@" ${args} +python "${dir_path}/basic_examples/autoencoder.py" "$@" ${args}