configuration almost finished

This commit is contained in:
hobogalaxy committed 2021-01-02 21:39:43 +01:00
1 parent 2726557906
commit fe81cbb304
17 files changed
+117 -152

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
# @package _global_
# to execute this experiment run:
# python train.py +experiment=xxx
defaults:
- override /trainer: default_trainer.yaml
- override /model: default_classifier.yaml
- override /datamodule: default_datamodule.yaml
- override /logger: comet.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]
+52
View File
@@ -0,0 +1,52 @@
# @package _global_
# to execute this experiment run:
# python train.py +experiment=xxx2
defaults:
- override /trainer: default_trainer.yaml # choose trainer from 'configs/trainer/' folder
- override /model: default_model.yaml # choose model from 'configs/model/' folder
- override /datamodule: default_datamodule.yaml # choose datamodule from 'configs/datamodule/' folder
- override /callbacks: default_callbacks.yaml # choose callback set from 'configs/callbacks/' folder
- override /logger: comet.yaml # choose logger from 'configs/logger/' folder
pytorch_seed: 12345 # pytorch seed for this experiment (also affects lightning random_split() method)
trainer:
args:
min_epochs: 1 # train for at least this many epochs (denies early stopping)
max_epochs: 10 # train for maximum this many epochs
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_test_batches: 1.0 # test on 100% of test data
val_check_interval: 0.5 # perform validation twice per epoch
model:
class: "pytorch_modules.lightning_models.simple_mnist_classifier.LitModel"
hparams: # you can add here any params you want and then access them in lightning model
lr: 0.001
weight_decay: 0.00001
input_size: 784 # img size is 1*28*28
output_size: 10 # there are 10 digit classes
lin1_size: 256
lin2_size: 256
lin3_size: 128
datamodule:
class: "pytorch_modules.lightning_datamodules.mnist_datamodule.MNISTDataModule"
hparams: # 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
logger:
args: # you can add here additional logger arguments specific for this experiment
tags: ["uwu", "best_model"]
resume_training: # use this if you want to resume training from checkpoint
checkpoint_path: False # path to your checkpoint
wandb_run_id: False # you can add id of wandb run you want to resume but it's optional
comet_run_id: False # you can add id of comet run you want to resume but it's optional
@@ -1,63 +0,0 @@
# to execute this experiment run:
# python train.py --exp_conf configs/experiment/mnist_experiments/advanced_conf.yaml
# (optional section)
# pytorch seed for this experiment
# it also affects random_split() method used in mnist_datamodule.py
# overwrites default pytorch seed set in project_config.yaml
seed: 1234
# (required section)
trainer_args:
min_epochs: 1 # train for at least this many epochs (denies early stopping)
max_epochs: 10 # train for maximum this many epochs
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_test_batches: 1.0 # test on 100% of test data
val_check_interval: 0.5 # perform validation twice per epoch
# (required section)
model:
load_from:
model_path: "pytorch_modules/lightning_models/simple_mnist_classifier.py"
model_class: "LitModel"
hparams: # you can add here any parameters you want and then read them in model
lr: 0.001
weight_decay: 0.00001
input_size: 784 # img size is 1*28*28
output_size: 10 # there are 10 digit classes
lin1_size: 256
lin2_size: 256
lin3_size: 128
# (required section)
datamodule:
load_from:
datamodule_path: "lightning_datamodules/mnist_datamodule/mnist_datamodule.py"
datamodule_class: "MNISTDataModule"
hparams: # you can add here any parameters you want and then read them in datamodule
batch_size: 256
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
# (optional section)
# Weights&Biases logger args
# this will be combained with default wandb args set in project_config.yaml (overwrites repeating args)
wandb_args:
group: ""
job_type: "train"
tags: ["v2", "uwu"]
notes: "This is example run."
# (optional section)
# use this if you want to resume training from checkpoint
resume_training:
checkpoint_path: None # path to your checkpoint
wandb_run_id: None # you can add id of wandb run you want to resume but it's optional
@@ -1,25 +0,0 @@
# to execute this experiment run:
# python train.py --exp_conf configs/experiment/mnist_experiments/simple_conf.yaml
seed: 1234
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: "lightning_datamodules.mnist_datamodule.mnist_datamodule.MNISTDataModule"
hparams:
batch_size: 64
train_val_test_split: [55_000, 5_000, 10_000]
@@ -1,3 +1,4 @@
# @package _group_
# Tensorboard logger config
args: {}
@@ -1,3 +1,4 @@
# @package _group_
# Weights&Biases logger config
args:
+1
View File
@@ -0,0 +1 @@
# @package _group_
+16 -9
View File
@@ -1,14 +1,21 @@
# @package _global_
defaults:
- project_config/trainer: default_trainer
# - model: simple_mnist_classifier
# - datamodule: mnist_datamodule
# - logger: comet
# - callbacks: mnist_callbacks
- trainer: default_trainer.yaml
- model: default_model.yaml
- datamodule: default_datamodule.yaml
- callbacks: default_callbacks.yaml
- logger: comet.yaml
# path to data folder (either absolute or relative to placement of 'train.py' file)
data_dir: "data/"
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)
# path to logs folder (either absolute or relative to placement of 'train.py' file)
logs_dir: "logs/"
hydra:
run:
dir: ${paths.logs_dir}/hydra_logs/runs/${now:%Y-%m-%d}/${now:%H-%M-%S}
sweep:
dir: ${paths.logs_dir}/hydra_logs/sweeps/${now:%Y-%m-%d_%H-%M-%S}
subdir: ${hydra.job.num}
@@ -9,5 +9,5 @@ args:
num_sanity_val_steps: 3
progress_bar_refresh_rate: 10
weights_summary: "top"
max_epochs: 100
profiler: "simple" # use profiler to print execution time profiling after training ends
max_epochs: 100
View File
Whitespace-only changes.
+12
View File
@@ -0,0 +1,12 @@
from omegaconf import DictConfig, OmegaConf
import hydra.conf.hydra.output
@hydra.main(config_path="configs/", config_name="project_config.yaml")
def my_app(cfg: DictConfig) -> None:
# print(cfg)
print(OmegaConf.to_yaml(cfg))
if __name__ == "__main__":
my_app()
-54
View File
@@ -1,54 +0,0 @@
# default args passed to Lightning Trainer on every run/experiment
# they will be combined with trainer args specified in experiment config
default_args:
num_of_gpus: -1 # set -1 to train on all GPUs abailable, set 0 to train on CPU only
auto_select_gpus: True
num_sanity_val_steps: 3
progress_bar_refresh_rate: 10 # refresh terminal every 10 batches
weights_summary: "top" # print model summary before training starts (alternatively "full")
# use profiler to print execution time profiling after training ends
profiler:
use_profiler: True
class: "pytorch_lightning.profiler.SimpleProfiler"
args: {}
loggers:
# Comet logger config
comet:
use_comet: True
default_args:
api_key: "sadfhgadfhsdfhadgkajdgsdg"
project_name: "project_template_test"
extra_options:
log_optimizer_name: True
log_train_val_test_sizes: True
# Weights&Biases logger config
wandb:
use_wandb: False
default_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
extra_options:
log_gradients: False # set True to log gradient histograms (avoid this for very big lightning_models)
log_optimizer_name: True
log_train_val_test_sizes: True
# Tensorboard logger config
tensorboard:
use_tensorboard: False
default_args: {}
# path to data folder (either absolute or relative to placement of 'train.py' file)
data_dir: "data/"
# path to logs folder (either absolute or relative to placement of 'train.py' file)
logs_dir: "logs/"
+1
View File
@@ -2,6 +2,7 @@ torch>=1.7.0
torchvision>=0.8.1
torchaudio>=0.7.0
pytorch-lightning>=1.0.8
hydra-core
wandb>=0.10.12
PyYAML>=5.3.1
scikit-learn>=0.23.2