Refactor GPU examples tests (#8294)

This commit is contained in:
Carlos Mocholí 2021-07-06 14:14:04 +02:00 committed by GitHub
parent f6a5bb2eee
commit 4184d7e738
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 31 deletions

View File

@ -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'

View File

@ -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}

View File

@ -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 $@

View File

@ -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}