* rework lightning model for mnist * sort imports * add comment to pre-commit-config * remove returns from test_step because it's bugged * update experiment configs * Update README.md
76 lines
2.2 KiB
Bash
76 lines
2.2 KiB
Bash
# !/bin/bash
|
|
# These are just a couple of quick experiments to test if your model doesn't crash under different conditions
|
|
|
|
# To execute:
|
|
# bash tests/quick_tests.sh
|
|
|
|
# Method for printing test name
|
|
echo() {
|
|
termwidth="$(tput cols)"
|
|
padding="$(printf '%0.1s' ={1..500})"
|
|
printf '\e[33m%*.*s %s %*.*s\n\e[0m' 0 "$(((termwidth-2-${#1})/2))" "$padding" "$1" 0 "$(((termwidth-1-${#1})/2))" "$padding"
|
|
}
|
|
|
|
# Make python hide warnings
|
|
export PYTHONWARNINGS="ignore"
|
|
|
|
|
|
echo "TEST 1"
|
|
echo "Debug mode (run 1 train, val and test loop using 1 batch)"
|
|
python train.py debug=True \
|
|
print_config=false
|
|
|
|
echo "TEST 2"
|
|
echo "Overfit to 10 batches (10 epochs)"
|
|
python train.py trainer.overfit_batches=10 \
|
|
trainer.min_epochs=10 trainer.max_epochs=10 \
|
|
print_config=false
|
|
|
|
echo "TEST 3"
|
|
echo "Train on CPU (1 epoch)"
|
|
python train.py trainer.gpus=0 trainer.max_epochs=1 \
|
|
print_config=false
|
|
|
|
echo "TEST 4"
|
|
echo "Train on 25% of data (1 epoch)"
|
|
python train.py trainer.max_epochs=1 \
|
|
trainer.limit_train_batches=0.25 trainer.limit_val_batches=0.25 trainer.limit_test_batches=0.25 \
|
|
print_config=false
|
|
|
|
echo "TEST 5"
|
|
echo "Train on 15 train batches, 10 val batches, 5 test batches (1 epoch)"
|
|
python train.py trainer.max_epochs=1 \
|
|
trainer.limit_train_batches=15 trainer.limit_val_batches=10 trainer.limit_test_batches=5 \
|
|
print_config=false
|
|
|
|
echo "TEST 6"
|
|
echo "Run all experiment configs (2 epochs)"
|
|
python train.py -m '+experiment=glob(*)' trainer.max_epochs=2 \
|
|
print_config=false
|
|
|
|
echo "TEST 7"
|
|
echo "Run default hydra sweep (executes 4 different combinations in debug mode)"
|
|
python train.py -m datamodule.batch_size=32,64 optimizer.lr=0.001,0.003 \
|
|
debug=True \
|
|
print_config=false
|
|
|
|
echo "TEST 8"
|
|
echo "Run with gradient accumulation (1 epoch)"
|
|
python train.py trainer.max_epochs=1 trainer.accumulate_grad_batches=10 \
|
|
print_config=false
|
|
|
|
echo "TEST 9"
|
|
echo "Run validation loop twice per epoch (2 epochs)"
|
|
python train.py trainer.max_epochs=2 trainer.val_check_interval=0.5 \
|
|
print_config=false
|
|
|
|
echo "TEST 10"
|
|
echo "Run with CSVLogger (2 epochs)"
|
|
python train.py logger=csv trainer.min_epochs=5 trainer.max_epochs=2 \
|
|
print_config=false
|
|
|
|
echo "TEST 11"
|
|
echo "Run with TensorBoardLogger (2 epochs)"
|
|
python train.py logger=tensorboard trainer.min_epochs=5 trainer.max_epochs=2 \
|
|
print_config=false
|