* update template to pytorch 1.10+ and lightning 1.5+ * add experiment mode to all experiment configs and implement special logging paths for experiment mode * add `MaxMetric` to model, for computation of best so far validation accuracy * add RichProgressBar to default callbacks * get rid of trick for preventing auto hparam logging, since lightning now supports it with `self.save_hyperparameters(logger=False)` * add `self.save_hyperparameters()` to datamodule since lightinng now supports it * deprecate Apex support * deprecate bash script for conda setup * change `terminate_on_nan` debug option to `detect_anomaly` for compatibility with lightning v1.5 * specify model and datamodule during `trainer.test()`, for compatibility with lightning v1.5 * remove `configs/trainer/all_params.yaml` * make hyperparameter optimization compatible with lightning v1.5 * general documentation improvements
60 lines
1.7 KiB
YAML
60 lines
1.7 KiB
YAML
# @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
|
|
|
|
defaults:
|
|
- override /hydra/sweeper: optuna
|
|
|
|
# choose metric which will be optimized by Optuna
|
|
optimized_metric: "val/acc_best"
|
|
|
|
hydra:
|
|
# here we define Optuna hyperparameter search
|
|
# it optimizes for value returned from function with @hydra.main decorator
|
|
# learn more here: https://hydra.cc/docs/next/plugins/optuna_sweeper
|
|
sweeper:
|
|
_target_: hydra_plugins.hydra_optuna_sweeper.optuna_sweeper.OptunaSweeper
|
|
storage: null
|
|
study_name: null
|
|
n_jobs: 1
|
|
|
|
# 'minimize' or 'maximize' the objective
|
|
direction: maximize
|
|
|
|
# number of experiments that will be executed
|
|
n_trials: 20
|
|
|
|
# choose Optuna hyperparameter sampler
|
|
# learn more here: https://optuna.readthedocs.io/en/stable/reference/samplers.html
|
|
sampler:
|
|
_target_: optuna.samplers.TPESampler
|
|
seed: 12345
|
|
consider_prior: true
|
|
prior_weight: 1.0
|
|
consider_magic_clip: true
|
|
consider_endpoints: false
|
|
n_startup_trials: 10
|
|
n_ei_candidates: 24
|
|
multivariate: false
|
|
warn_independent_sampling: true
|
|
|
|
# define range of hyperparameters
|
|
search_space:
|
|
datamodule.batch_size:
|
|
type: categorical
|
|
choices: [32, 64, 128]
|
|
model.lr:
|
|
type: float
|
|
low: 0.0001
|
|
high: 0.2
|
|
model.lin1_size:
|
|
type: categorical
|
|
choices: [32, 64, 128, 256, 512]
|
|
model.lin2_size:
|
|
type: categorical
|
|
choices: [32, 64, 128, 256, 512]
|
|
model.lin3_size:
|
|
type: categorical
|
|
choices: [32, 64, 128, 256, 512]
|