training with hydra works
This commit is contained in:
1 parent
9cffc61c20
commit
610117f161
27 files changed
+247
-430
No files matched your search
@@ -4,14 +4,16 @@ defaults:
|
||||
- trainer: default_trainer.yaml
|
||||
- model: simple_mnist_classifier.yaml
|
||||
- datamodule: mnist_datamodule.yaml
|
||||
- optimizer: adam.yaml
|
||||
- callbacks: default_callbacks.yaml
|
||||
- loggers: null
|
||||
|
||||
seeds:
|
||||
pytorch_seed: 12345
|
||||
|
||||
paths:
|
||||
data_dir: "data/" # path to data folder (either absolute or relative to placement of 'train.py' file)
|
||||
logs_dir: "logs/" # path to logs folder (either absolute or relative to placement of 'train.py' file)
|
||||
|
||||
data_dir: "data" # path to data folder (either absolute or relative to placement of 'train.py' file)
|
||||
logs_dir: "logs" # path to logs folder (either absolute or relative to placement of 'train.py' file)
|
||||
|
||||
hydra:
|
||||
run:
|
||||
@@ -1,7 +1,6 @@
|
||||
# @package _group_
|
||||
|
||||
class: "pytorch_modules.lightning_datamodules.mnist_datamodule.MNISTDataModule"
|
||||
|
||||
hparams:
|
||||
args:
|
||||
batch_size: 64
|
||||
train_val_test_split: (55_000, 5_000, 10_000)
|
||||
train_val_test_split: [55_000, 5_000, 10_000]
|
||||
+17
-15
@@ -1,15 +1,17 @@
|
||||
# @package _global_
|
||||
|
||||
# to execute this experiment run:
|
||||
# python train.py +experiment=xxx2
|
||||
# python train.py +experiment=exp_example_advanced
|
||||
|
||||
defaults:
|
||||
- override /trainer: default_trainer.yaml # choose trainer from 'configs/trainer/' folder
|
||||
- override /model: null # choose model from 'configs/model/' folder
|
||||
- override /datamodule: null # choose datamodule from 'configs/datamodule/' folder
|
||||
- override /model: simple_mnist_classifier.yaml # choose model from 'configs/model/' folder
|
||||
- override /datamodule: mnist_datamodule.yaml # choose datamodule from 'configs/datamodule/' folder
|
||||
- override /optimizer: adam.yaml # choose datamodule from 'configs/datamodule/' folder
|
||||
- override /callbacks: default_callbacks.yaml # choose callback set from 'configs/callbacks/' folder
|
||||
|
||||
pytorch_seed: 12345 # pytorch seed for this experiment (also affects lightning random_split() method)
|
||||
seeds:
|
||||
pytorch_seed: 12345 # pytorch seed for this experiment (affects torch.utils.data.random_split() method used in mnist_datamodule)
|
||||
|
||||
trainer:
|
||||
args:
|
||||
@@ -18,16 +20,14 @@ trainer:
|
||||
gradient_clip_val: 0.5 # gradient clipping (helps with exploding gradient issues)
|
||||
accumulate_grad_batches: 2 # perform optimization step after accumulating gradient from 2 batches
|
||||
fast_dev_run: False # execute 1 training, 1 validation and 1 test epoch only
|
||||
limit_train_batches: 0.8 # train only on 80% of training data
|
||||
limit_val_batches: 1.0 # validate on 100% of validation data
|
||||
limit_train_batches: 0.6 # train on 60% of training data
|
||||
limit_val_batches: 0.9 # validate on 90% of validation data
|
||||
limit_test_batches: 1.0 # test on 100% of test data
|
||||
val_check_interval: 0.5 # perform validation twice per epoch
|
||||
# resume_from_checkpoint: "last.ckpt" # use this to resume training from checkpoint
|
||||
|
||||
model:
|
||||
class: pytorch_modules.lightning_models.simple_mnist_classifier.LitModel
|
||||
args: # you can add here any params you want and then access them in lightning model
|
||||
lr: 0.001
|
||||
weight_decay: 0.00001
|
||||
args: # you can add here any params you want and then access them in lightning model
|
||||
input_size: 784 # img size is 1*28*28
|
||||
output_size: 10 # there are 10 digit classes
|
||||
lin1_size: 256
|
||||
@@ -35,21 +35,23 @@ model:
|
||||
lin3_size: 128
|
||||
|
||||
datamodule:
|
||||
class: pytorch_modules.lightning_datamodules.mnist_datamodule.MNISTDataModule
|
||||
args: # you can add here any params you want and then access them in lightning datamodule
|
||||
batch_size: 64
|
||||
train_val_test_split: (55_000, 5_000, 10_000)
|
||||
num_workers: 1 # num of processes used for loading data in parallel
|
||||
pin_memory: False # dataloaders will copy tensors into CUDA pinned memory before returning them
|
||||
|
||||
optimizer:
|
||||
args:
|
||||
lr: 0.001
|
||||
weight_decay: 0.00001
|
||||
|
||||
loggers:
|
||||
wandb:
|
||||
args: # you can add here additional loggers arguments specific for this experiment
|
||||
tags: ["uwu", "best_model"]
|
||||
notes: ""
|
||||
group: ""
|
||||
comet:
|
||||
args:
|
||||
tags: ["uwu", "best_model"]
|
||||
|
||||
resume_training: # use this if you want to resume training from checkpoint
|
||||
checkpoint_path: False # path to your checkpoint
|
||||
logger_run_id: False # loggers experiment id that you want to resume (optional)
|
||||
@@ -0,0 +1,36 @@
|
||||
# @package _global_
|
||||
|
||||
# to execute this experiment run:
|
||||
# python train.py +experiment=exp_example_simple
|
||||
|
||||
defaults:
|
||||
- override /trainer: default_trainer.yaml # choose trainer from 'configs/trainer/' folder
|
||||
- override /model: simple_mnist_classifier.yaml # choose model from 'configs/model/' folder
|
||||
- override /datamodule: mnist_datamodule.yaml # choose datamodule from 'configs/datamodule/' folder
|
||||
- override /optimizer: adam.yaml # choose datamodule from 'configs/datamodule/' folder
|
||||
- override /callbacks: default_callbacks.yaml # choose callback set from 'configs/callbacks/' folder
|
||||
|
||||
seeds:
|
||||
pytorch_seed: 12345
|
||||
|
||||
trainer:
|
||||
args:
|
||||
max_epochs: 10
|
||||
|
||||
model:
|
||||
args:
|
||||
input_size: 784
|
||||
output_size: 10
|
||||
lin1_size: 256
|
||||
lin2_size: 256
|
||||
lin3_size: 128
|
||||
|
||||
datamodule:
|
||||
args:
|
||||
batch_size: 32
|
||||
train_val_test_split: (55_000, 5_000, 10_000)
|
||||
|
||||
optimizer:
|
||||
args:
|
||||
lr: 0.001
|
||||
weight_decay: 0.00001
|
||||
@@ -1,33 +0,0 @@
|
||||
# @package _global_
|
||||
|
||||
# to execute this experiment run:
|
||||
# python train.py +experiment=xxx
|
||||
|
||||
defaults:
|
||||
- override /trainer: default_trainer.yaml
|
||||
- override /model: null
|
||||
- override /datamodule: null
|
||||
- override /callbacks: default_callbacks.yaml
|
||||
|
||||
pytorch_seed: 12345
|
||||
|
||||
trainer:
|
||||
args:
|
||||
max_epochs: 10
|
||||
|
||||
model:
|
||||
class: pytorch_modules.lightning_models.simple_mnist_classifier.LitModel
|
||||
args:
|
||||
lr: 0.001
|
||||
weight_decay: 0.00001
|
||||
input_size: 784
|
||||
output_size: 10
|
||||
lin1_size: 256
|
||||
lin2_size: 256
|
||||
lin3_size: 128
|
||||
|
||||
datamodule:
|
||||
class: pytorch_modules.lightning_datamodules.mnist_datamodule.MNISTDataModule
|
||||
args:
|
||||
batch_size: 32
|
||||
train_val_test_split: (55_000, 5_000, 10_000)
|
||||
@@ -1,31 +0,0 @@
|
||||
# @package _global_
|
||||
|
||||
# to execute this experiment run:
|
||||
# python train.py +experiment=xxx
|
||||
|
||||
defaults:
|
||||
- override /trainer: default_trainer.yaml
|
||||
- override /logger: wandb.yaml
|
||||
|
||||
pytorch_seed: 12345
|
||||
|
||||
trainer:
|
||||
args:
|
||||
max_epochs: 10
|
||||
|
||||
model:
|
||||
class: pytorch_modules.lightning_models.simple_mnist_classifier.LitModel
|
||||
hparams:
|
||||
lr: 0.001
|
||||
weight_decay: 0.00001
|
||||
input_size: 784
|
||||
output_size: 10
|
||||
lin1_size: 256
|
||||
lin2_size: 256
|
||||
lin3_size: 128
|
||||
|
||||
datamodule:
|
||||
class: pytorch_modules.lightning_datamodules.mnist_datamodule.MNISTDataModule
|
||||
hparams:
|
||||
batch_size: 32
|
||||
train_val_test_split: (55_000, 5_000, 10_000)
|
||||
@@ -1,31 +0,0 @@
|
||||
# @package _global_
|
||||
|
||||
# to execute this experiment run:
|
||||
# python train.py +experiment=xxx
|
||||
|
||||
defaults:
|
||||
- override /trainer: default_trainer.yaml
|
||||
- override /logger: wandb.yaml
|
||||
|
||||
pytorch_seed: 12345
|
||||
|
||||
trainer:
|
||||
args:
|
||||
max_epochs: 10
|
||||
|
||||
model:
|
||||
class: pytorch_modules.lightning_models.simple_mnist_classifier.LitModel
|
||||
hparams:
|
||||
lr: 0.001
|
||||
weight_decay: 0.00001
|
||||
input_size: 784
|
||||
output_size: 10
|
||||
lin1_size: 256
|
||||
lin2_size: 256
|
||||
lin3_size: 128
|
||||
|
||||
datamodule:
|
||||
class: pytorch_modules.lightning_datamodules.mnist_datamodule.MNISTDataModule
|
||||
hparams:
|
||||
batch_size: 32
|
||||
train_val_test_split: (55_000, 5_000, 10_000)
|
||||
@@ -1,9 +1,8 @@
|
||||
# @package _group_
|
||||
|
||||
# train with all loggers at once
|
||||
# Train with all loggers at once
|
||||
defaults:
|
||||
- comet
|
||||
- csv_logger
|
||||
- neptune
|
||||
- tensorboard
|
||||
- wandb
|
||||
@@ -1,13 +1,8 @@
|
||||
# @package _group_
|
||||
|
||||
# Comet loggers config
|
||||
# Comet logger config
|
||||
comet:
|
||||
class: pytorch_lightning.loggers.CometLogger
|
||||
|
||||
args:
|
||||
api_key: ???
|
||||
project_name: "project_template_test"
|
||||
|
||||
extra_options:
|
||||
log_optimizer_name: True
|
||||
log_train_val_test_sizes: True
|
||||
@@ -1,9 +1,6 @@
|
||||
# @package _group_
|
||||
|
||||
# default loggers is just lightning CSVLogger which doesn't require any additional dependencies
|
||||
# Csv logger config
|
||||
csv_logger:
|
||||
class: pytorch_lightning.loggers.CSVLogger
|
||||
|
||||
args: {}
|
||||
|
||||
extra_options: {}
|
||||
@@ -1,11 +0,0 @@
|
||||
# @package _group_
|
||||
|
||||
# Neptune loggers config
|
||||
neptune:
|
||||
class: pytorch_lightning.loggers.NeptuneLogger
|
||||
|
||||
args: {}
|
||||
|
||||
extra_options:
|
||||
log_optimizer_name: True
|
||||
log_train_val_test_sizes: True
|
||||
@@ -1,9 +1,6 @@
|
||||
# @package _group_
|
||||
|
||||
# Tensorboard loggers config
|
||||
# Tensorboard logger config
|
||||
tensorboard:
|
||||
class: pytorch_lightning.loggers.TensorboardLogger
|
||||
|
||||
args: {}
|
||||
|
||||
extra_options: {}
|
||||
@@ -1,16 +1,27 @@
|
||||
# @package _group_
|
||||
|
||||
# Weights&Biases loggers config
|
||||
# Weights&Biases logger config
|
||||
wandb:
|
||||
class: pytorch_lightning.loggers.WandbLogger
|
||||
|
||||
args:
|
||||
project: "project_template_test"
|
||||
entity: "" # change to your username or name of your team on wandb
|
||||
log_model: True # set True to automatically upload model checkpoint to wandb cloud after training
|
||||
offline: False # set True to store all logs only locally
|
||||
entity: "" # change to your username or name of your team on wandb
|
||||
offline: False # set True to store all logs only locally
|
||||
job_type: "train"
|
||||
save_dir: ${paths.logs_dir}
|
||||
|
||||
extra_options:
|
||||
log_gradients: False # set True to log gradient histograms (avoid this for very big models)
|
||||
log_optimizer_name: True
|
||||
log_train_val_test_sizes: True
|
||||
# some extra things which will be logged by the environment
|
||||
extra_logs:
|
||||
watch_model: True # make wandb watch model
|
||||
log_gradients: False # log gradient histograms (avoid this for very big models)
|
||||
|
||||
log_train_val_test_sizes: True # log sizes of train dataset, val dataset and test dataset
|
||||
|
||||
log_model_args: True # log
|
||||
log_datamodule_args: True # log
|
||||
log_optimizer_args: True # log
|
||||
log_trainer_args: False # log
|
||||
|
||||
log_model_class_name: True
|
||||
log_datamodule_class_name: True
|
||||
log_optimizer_class_name: True
|
||||
@@ -1,6 +0,0 @@
|
||||
# @package _group_
|
||||
|
||||
class: "pytorch_modules.lightning_models.simple_mnist_classifier.LitModel"
|
||||
|
||||
hparams:
|
||||
YYYYYYY: XXXXXXXXXXXXXXXXXXX
|
||||
@@ -1,8 +1,7 @@
|
||||
# @package _group_
|
||||
|
||||
class: "pytorch_modules.lightning_models.simple_mnist_classifier.LitModel"
|
||||
|
||||
hparams:
|
||||
args:
|
||||
lr: 0.001
|
||||
weight_decay: 0.00001
|
||||
input_size: 784
|
||||
|
||||
Whitespace-only changes.
@@ -1 +1,6 @@
|
||||
# @package _group_
|
||||
|
||||
class: torch.optim.Adam
|
||||
args:
|
||||
lr: 0.001
|
||||
weight_decay: 0.000001
|
||||
@@ -0,0 +1,17 @@
|
||||
# @package _group_
|
||||
|
||||
# trainer args for debugging model
|
||||
args:
|
||||
gpus: -1 # set -1 to train on all GPUs abailable, set 0 to train on CPU only
|
||||
auto_select_gpus: True
|
||||
|
||||
fast_dev_run: True
|
||||
limit_train_batches: 1.0
|
||||
limit_val_batches: 1.0
|
||||
limit_test_batches: 1.0
|
||||
val_check_interval: 1.0
|
||||
profiler: "simple" # use profiler to print execution time profiling after training ends
|
||||
|
||||
progress_bar_refresh_rate: 10
|
||||
weights_summary: "top"
|
||||
default_root_dir: ${paths.logs_dir}/lightning_logs
|
||||
@@ -4,10 +4,9 @@
|
||||
# they will be combined with trainer args specified in experiment config
|
||||
# (if the argument repeats in experiment config, then it will override the one set here)
|
||||
args:
|
||||
num_of_gpus: -1 # set -1 to train on all GPUs abailable, set 0 to train on CPU only
|
||||
gpus: -1 # set -1 to train on all GPUs available, set 0 to train on CPU only
|
||||
auto_select_gpus: True
|
||||
num_sanity_val_steps: 3
|
||||
progress_bar_refresh_rate: 10
|
||||
weights_summary: "top"
|
||||
profiler: "simple" # use profiler to print execution time profiling after training ends
|
||||
max_epochs: 100
|
||||
progress_bar_refresh_rate: 10
|
||||
default_root_dir: ${paths.logs_dir}/lightning_logs
|
||||
Reference in new issue
Block a user