improvements...
This commit is contained in:
1 parent
fa8b9ecc16
commit
99ac2a9062
6 files changed
+101
-69
No files matched your search
@@ -0,0 +1,16 @@
|
|||||||
|
EarlyStopping: # name of PyTorch Lightning class for early stopping callback
|
||||||
|
monitor: "val_acc"
|
||||||
|
patience: 5
|
||||||
|
mode: "max"
|
||||||
|
|
||||||
|
ModelCheckpoint: # name of PyTorch Lightning class for checkpointing callback
|
||||||
|
monitor: "val_acc"
|
||||||
|
save_top_k: 1
|
||||||
|
save_last: True
|
||||||
|
mode: "max"
|
||||||
|
|
||||||
|
ConfusionMatrixWandbLoggerCallback: # some custom callback class from template_utils/wandb_callbacks.py
|
||||||
|
class_names: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
|
||||||
|
|
||||||
|
MetricsHeatmapWandbLoggerCallback: # some custom callback class from template_utils/wandb_callbacks.py
|
||||||
|
class_names: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
|
||||||
-59
@@ -1,59 +0,0 @@
|
|||||||
# to execute this run:
|
|
||||||
# python train.py --run_config_name SIMPLE_CONFIG_EXAMPLE_MNIST_v2
|
|
||||||
|
|
||||||
seed: 1234
|
|
||||||
trainer:
|
|
||||||
args:
|
|
||||||
min_epochs: 1 # train for at least this many epochs (denies early stopping)
|
|
||||||
max_epochs: 10
|
|
||||||
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:
|
|
||||||
load_from:
|
|
||||||
model_path: "lightning_models/simple_mnist_classifier/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
|
|
||||||
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
|
|
||||||
# the following sections of config are optional and can be removed:
|
|
||||||
wandb: # Weights&Biases run options
|
|
||||||
group: ""
|
|
||||||
job_type: "train"
|
|
||||||
tags: ["v2", "uwu"]
|
|
||||||
notes: "This is example run."
|
|
||||||
callbacks: # you can add here any callback class available in PyTorch Lightning or template_utils/custom_callbacks.py
|
|
||||||
EarlyStopping: # name of PyTorch Lightning class for early stopping callback
|
|
||||||
monitor: "val_acc"
|
|
||||||
patience: 5
|
|
||||||
mode: "max"
|
|
||||||
ModelCheckpoint: # name of PyTorch Lightning class for checkpointing callback
|
|
||||||
monitor: "val_acc"
|
|
||||||
save_top_k: 1
|
|
||||||
save_last: True
|
|
||||||
mode: "max"
|
|
||||||
ConfusionMatrixWandbLoggerCallback: # some custom callback class from template_utils/wandb_callbacks.py
|
|
||||||
class_names: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
|
|
||||||
MetricsHeatmapWandbLoggerCallback: # some custom callback class from template_utils/wandb_callbacks.py
|
|
||||||
class_names: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
|
|
||||||
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
|
|
||||||
+67
@@ -0,0 +1,67 @@
|
|||||||
|
# to execute this experiment run:
|
||||||
|
# python train.py --exp_conf configs/experiment_configs/mnist_experiments/mnist_classifier_advanced_conf.yaml
|
||||||
|
|
||||||
|
# (required section)
|
||||||
|
trainer_args:
|
||||||
|
min_epochs: 1 # train for at least this many epochs (denies early stopping)
|
||||||
|
max_epochs: 10
|
||||||
|
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)
|
||||||
|
# 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
|
||||||
|
pytorch_seed:
|
||||||
|
use_seed: True
|
||||||
|
pytorch_seed: 1234
|
||||||
|
|
||||||
|
# (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)
|
||||||
|
# path to .yaml file containing configurations of all callbacks which will be used for this experiment
|
||||||
|
# this will be combained with default callbacks set in project_config.yaml (overwrites repeating callbacks)
|
||||||
|
callbacks_configs_path: "configs/callbacks_configs/mnist_callabcks.yaml"
|
||||||
|
|
||||||
|
# (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
|
||||||
+3
-5
@@ -1,14 +1,12 @@
|
|||||||
# to execute this run:
|
# to execute this experiment run:
|
||||||
# python train.py --run_config_name SIMPLE_CONFIG_EXAMPLE_MNIST
|
# python train.py --exp_conf configs/experiment_configs/mnist_experiments/mnist_classifier_simple_conf.yaml
|
||||||
|
|
||||||
seed: 1234
|
|
||||||
|
|
||||||
trainer_args:
|
trainer_args:
|
||||||
max_epochs: 10
|
max_epochs: 10
|
||||||
|
|
||||||
model:
|
model:
|
||||||
load_from:
|
load_from:
|
||||||
model_path: "lightning_models/simple_mnist_classifier/simple_mnist_classifier.py"
|
model_path: "pytorch_modules/lightning_models/simple_mnist_classifier.py"
|
||||||
model_class: "LitModel"
|
model_class: "LitModel"
|
||||||
hparams:
|
hparams:
|
||||||
lr: 0.001
|
lr: 0.001
|
||||||
@@ -1,11 +1,18 @@
|
|||||||
# default args passed to Lightning Trainer on every run/experiment
|
# default args passed to Lightning Trainer on every run/experiment
|
||||||
# if you specify the same args in experiment config then they will overwrite the ones set here
|
# if you specify the same args in experiment config then they will overwrite the ones set here
|
||||||
default_trainer_args:
|
default_trainer_args:
|
||||||
num_of_gpus: -1 # set -1 to train on all GPUs abailable, set 0 to train on CPU only
|
num_of_gpus: 0 # set -1 to train on all GPUs abailable, set 0 to train on CPU only
|
||||||
progress_bar_refresh_rate: 10 # refresh terminal every 10 batches
|
progress_bar_refresh_rate: 10 # refresh terminal every 10 batches
|
||||||
weights_summary: "top" # print model summary (alternatively "full")
|
weights_summary: "top" # print model summary (alternatively "full")
|
||||||
|
|
||||||
|
|
||||||
|
# default pytorch seed used on every run/experiment
|
||||||
|
# this can be overwritten by
|
||||||
|
default_pytorch_seed:
|
||||||
|
use_seed: True
|
||||||
|
pytorch_seed: 1234
|
||||||
|
|
||||||
|
|
||||||
# default loggers initialised on every run/experiment
|
# default loggers initialised on every run/experiment
|
||||||
# if you specify this section in experiment config then it will be totally overwritten
|
# if you specify this section in experiment config then it will be totally overwritten
|
||||||
default_loggers:
|
default_loggers:
|
||||||
@@ -29,12 +36,16 @@ default_loggers:
|
|||||||
# if you specify the same callback class also in experiment config then it will overwrite the one set here
|
# if you specify the same callback class also in experiment config then it will overwrite the one set here
|
||||||
# all of the callback parameters will be passed to it on initialization
|
# all of the callback parameters will be passed to it on initialization
|
||||||
default_callbacks:
|
default_callbacks:
|
||||||
ModelCheckpoint: # name of PyTorch Lightning class for checkpointing callback
|
chekpointing:
|
||||||
|
class: "pytorch_lightning.callbacks.ModelCheckpoint"
|
||||||
|
args:
|
||||||
monitor: "val_acc" # name of the logged metric which determines when model is improving
|
monitor: "val_acc" # name of the logged metric which determines when model is improving
|
||||||
save_top_k: 1 # save k best lightning_models (determined by above metric)
|
save_top_k: 1 # save k best lightning_models (determined by above metric)
|
||||||
save_last: True # additionaly always save model from last epoch
|
save_last: True # additionaly always save model from last epoch
|
||||||
mode: "max" # can be "max" or "min"
|
mode: "max" # can be "max" or "min"
|
||||||
EarlyStopping: # name of PyTorch Lightning class for early stopping callback
|
early_stopping:
|
||||||
|
class: "pytorch_lightning.callbacks.EarlyStopping"
|
||||||
|
args:
|
||||||
monitor: "val_acc" # name of the logged metric which determines when model is improving
|
monitor: "val_acc" # name of the logged metric which determines when model is improving
|
||||||
patience: 5 # how many epochs of not improving until training stops
|
patience: 5 # how many epochs of not improving until training stops
|
||||||
mode: "max" # can be "max" or "min"
|
mode: "max" # can be "max" or "min"
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# THIS FILE WILL EXECUTE ALL RUNS SPECIFIED IN run_configs.yaml ONE AFTER THE OTHER
|
# THIS FILE WILL EXECUTE ALL EXPERIMENT CONFIGS LOCATED IN SPECIFIED FOLDER ONE AFTER THE OTHER
|
||||||
# YOU CAN ALSO SPECIFY PATH TO DIFFERENT FILE WITH RUN CONFIGS
|
|
||||||
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
import train
|
import train
|
||||||
|
|||||||
Reference in new issue
Block a user