Multiple pipelines - training and evaluation (#250)
- introduce best practice for multiple pipelines - Implement evaluation pipeline - allow for using relative ckpt paths - general refactoring - update README.md
This commit is contained in:
1 parent
02d3b65aaa
commit
fe4e61edc1
25 files changed
+347
-185
No files matched your search
@@ -3,5 +3,5 @@ _target_: src.datamodules.mnist_datamodule.MNISTDataModule
|
||||
data_dir: ${data_dir} # data_dir is specified in config.yaml
|
||||
batch_size: 64
|
||||
train_val_test_split: [55_000, 5_000, 10_000]
|
||||
num_workers: 4
|
||||
num_workers: 0
|
||||
pin_memory: False
|
||||
@@ -1,6 +1,7 @@
|
||||
# @package _global_
|
||||
|
||||
# default debugging setup, runs 1 full epoch
|
||||
# other debugging configs can inherit from this one
|
||||
|
||||
defaults:
|
||||
- override /log_dir: debug.yaml
|
||||
@@ -8,19 +9,19 @@ defaults:
|
||||
trainer:
|
||||
max_epochs: 1
|
||||
gpus: 0 # debuggers don't like gpus
|
||||
detect_anomaly: true
|
||||
track_grad_norm: 2
|
||||
detect_anomaly: true # raise exception if NaN or +/-inf is detected in any tensor
|
||||
track_grad_norm: 2 # track gradient norm with loggers
|
||||
|
||||
datamodule:
|
||||
num_workers: 0 # debuggers don't like multiprocessing
|
||||
pin_memory: False
|
||||
pin_memory: False # disable gpu memory pin
|
||||
|
||||
# sets level of all command line loggers to 'DEBUG'
|
||||
# https://hydra.cc/docs/tutorials/basic/running_your_app/logging/
|
||||
hydra:
|
||||
verbose: True
|
||||
|
||||
# use this to set level of only chosen command line loggers to 'DEBUG'
|
||||
# use this to set level of only chosen command line loggers to 'DEBUG':
|
||||
# verbose: [src.train, src.utils]
|
||||
|
||||
# config is already printed by hydra when `hydra/verbose: True`
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# @package _global_
|
||||
|
||||
# debugs by using only 1% of the data
|
||||
# uses only 1% of the training data and 5% of validation/test data
|
||||
|
||||
defaults:
|
||||
- default.yaml
|
||||
@@ -8,5 +8,5 @@ defaults:
|
||||
trainer:
|
||||
max_epochs: 3
|
||||
limit_train_batches: 0.01
|
||||
limit_val_batches: 0.01
|
||||
limit_test_batches: 0.01
|
||||
limit_val_batches: 0.05
|
||||
limit_test_batches: 0.05
|
||||
@@ -1,6 +1,6 @@
|
||||
# @package _global_
|
||||
|
||||
# debugs with execution time profiling
|
||||
# runs with execution time profiling
|
||||
|
||||
defaults:
|
||||
- default.yaml
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# @package _global_
|
||||
|
||||
# debugs by running 1 train, 1 validation and 1 test step
|
||||
# runs 1 train, 1 validation and 1 test step
|
||||
|
||||
defaults:
|
||||
- default.yaml
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# @package _global_
|
||||
|
||||
# debugs by running only test epoch
|
||||
# runs only test epoch
|
||||
|
||||
defaults:
|
||||
- default.yaml
|
||||
|
||||
train: False
|
||||
test_after_training: True
|
||||
test: True
|
||||
@@ -1,7 +1,7 @@
|
||||
# @package _global_
|
||||
|
||||
# to execute this experiment run:
|
||||
# python run.py experiment=example
|
||||
# python train.py experiment=example
|
||||
|
||||
defaults:
|
||||
- override /datamodule: mnist.yaml
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# @package _global_
|
||||
|
||||
# example hyperparameter optimization of some experiment with Optuna:
|
||||
# python run.py -m hparams_search=mnist_optuna experiment=example_simple hydra.sweeper.n_trials=30
|
||||
# python train.py -m hparams_search=mnist_optuna experiment=example_simple hydra.sweeper.n_trials=30
|
||||
|
||||
defaults:
|
||||
- override /hydra/sweeper: optuna
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
# @package _global_
|
||||
|
||||
hydra:
|
||||
run:
|
||||
dir: logs/evaluations/runs/${name}/${now:%Y-%m-%d}_${now:%H-%M-%S}
|
||||
sweep:
|
||||
dir: logs/evaluations/multiruns/${name}/${now:%Y-%m-%d}_${now:%H-%M-%S}
|
||||
subdir: ${hydra.job.num}
|
||||
@@ -0,0 +1,32 @@
|
||||
# @package _global_
|
||||
|
||||
# specify here default evaluation configuration
|
||||
defaults:
|
||||
- _self_
|
||||
- datamodule: mnist.yaml # choose the datamodule for evaluation
|
||||
- model: mnist.yaml
|
||||
- callbacks: null
|
||||
- logger: null
|
||||
- trainer: default.yaml
|
||||
- log_dir: evaluation.yaml
|
||||
|
||||
- experiment: null
|
||||
|
||||
# enable color logging
|
||||
- override hydra/hydra_logging: colorlog
|
||||
- override hydra/job_logging: colorlog
|
||||
|
||||
original_work_dir: ${hydra:runtime.cwd}
|
||||
|
||||
data_dir: ${original_work_dir}/data/
|
||||
|
||||
print_config: True
|
||||
|
||||
ignore_warnings: True
|
||||
|
||||
seed: null
|
||||
|
||||
name: "default"
|
||||
|
||||
# passing checkpoint path is necessary
|
||||
ckpt_path: ???
|
||||
@@ -6,17 +6,15 @@ defaults:
|
||||
- datamodule: mnist.yaml
|
||||
- model: mnist.yaml
|
||||
- callbacks: default.yaml
|
||||
- logger: null # set logger here or use command line (e.g. `python run.py logger=tensorboard`)
|
||||
- logger: null # set logger here or use command line (e.g. `python train.py logger=tensorboard`)
|
||||
- trainer: default.yaml
|
||||
|
||||
# logging folder path
|
||||
- log_dir: default.yaml
|
||||
|
||||
# experiment configs allow for version control of specific configurations
|
||||
# e.g. best hyperparameters for each combination of model and datamodule
|
||||
- experiment: null
|
||||
|
||||
# debugging config (enable through command line, e.g. `python run.py debug=one_epoch)
|
||||
# debugging config (enable through command line, e.g. `python train.py debug=default)
|
||||
- debug: null
|
||||
|
||||
# config for hyperparameter optimization
|
||||
@@ -32,7 +30,6 @@ defaults:
|
||||
|
||||
# path to original working directory
|
||||
# hydra hijacks working directory by changing it to the new log directory
|
||||
# so it's useful to have this path as a special variable
|
||||
# https://hydra.cc/docs/next/tutorials/basic/running_your_app/working_directory
|
||||
original_work_dir: ${hydra:runtime.cwd}
|
||||
|
||||
@@ -50,7 +47,7 @@ train: True
|
||||
|
||||
# evaluate on test set, using best model weights achieved during training
|
||||
# lightning chooses best weights based on the metric specified in checkpoint callback
|
||||
test_after_training: True
|
||||
test: True
|
||||
|
||||
# seed for random number generators in pytorch, numpy and python.random
|
||||
seed: null
|
||||
@@ -8,4 +8,5 @@ max_epochs: 10
|
||||
# number of validation steps to execute at the beginning of the training
|
||||
# num_sanity_val_steps: 0
|
||||
|
||||
# ckpt path
|
||||
resume_from_checkpoint: null
|
||||
Reference in new issue
Block a user