* rework lightning model for mnist

* sort imports

* add comment to pre-commit-config

* remove returns from test_step because it's bugged

* update experiment configs

* Update README.md
This commit is contained in:
Łukasz Zalewski authored and GitHub committed 2021-03-10 15:33:14 +01:00
1 parent 67d531ab67
commit b1e0bf9717
23 files changed
+480 -320

No files matched your search

+4 -2
View File
@@ -4,6 +4,7 @@
defaults:
- trainer: default_trainer.yaml
- model: mnist_model.yaml
- optimizer: adam.yaml
- datamodule: mnist_datamodule.yaml
- callbacks: default_callbacks.yaml # set this to null if you don't want to use callbacks
- logger: null # set logger here or use command line (e.g. `python train.py logger=wandb`)
@@ -26,7 +27,8 @@ data_dir: ${work_dir}/data/
# use `python train.py debug=true` for easy debugging!
# this will run 1 train, val and test loop with only 1 batch
# (equivalent to running `python train.py trainer.fast_dev_run=True`)
# equivalent to running `python train.py trainer.fast_dev_run=true`
# (this is placed here just for easier access from command line)
debug: False
@@ -52,7 +54,7 @@ hydra:
subdir: ${hydra.job.num}
job:
# set your environment variables here
# you can set environment variables here
env_set:
# currently there are some issues with running sweeps alongside wandb
# https://github.com/wandb/client/issues/1314
+1 -1
View File
@@ -30,7 +30,7 @@ hydra:
direction: maximize
# number of experiments that will be executed
n_trials: 30
n_trials: 20
# choose optuna hyperparameter sampler ('tpe', 'random', 'cmaes' or 'nsgaii', 'motpe')
# learn more here: https://optuna.readthedocs.io/en/stable/reference/samplers.html
+1
View File
@@ -1,4 +1,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]
+6
View File
@@ -6,6 +6,7 @@
defaults:
- override /trainer: null # override trainer to null so it's not loaded from main config defaults...
- override /model: null
- override /optimizer: null
- override /datamodule: null
- override /callbacks: null
- override /logger: null
@@ -41,6 +42,11 @@ model:
dropout3: 0.20
output_size: 10
optimizer:
_target_: torch.optim.Adam
lr: 0.001
weight_decay: 0
datamodule:
_target_: src.datamodules.mnist_datamodule.MNISTDataModule
data_dir: ${data_dir}
+4 -1
View File
@@ -6,6 +6,7 @@
defaults:
- override /trainer: default_trainer.yaml # choose trainer from 'configs/trainer/' folder or set to null
- override /model: mnist_model.yaml # choose model from 'configs/model/' folder or set to null
- override /optimizer: adam.yaml # choose model from 'configs/model/' folder or set to null
- override /datamodule: mnist_datamodule.yaml # choose datamodule from 'configs/datamodule/' folder or set to null
- override /callbacks: default_callbacks.yaml # choose callback set from 'configs/callbacks/' folder or set to null
- override /logger: null # choose logger from 'configs/logger/' folder or set to null
@@ -21,11 +22,13 @@ trainer:
gradient_clip_val: 0.5
model:
lr: 0.001
lin1_size: 128
lin2_size: 256
lin3_size: 64
optimizer:
lr: 0.001
datamodule:
batch_size: 64
train_val_test_split: [55_000, 5_000, 10_000]
+1 -4
View File
@@ -1,8 +1,5 @@
_target_: src.models.mnist_model.LitModelMNIST
optimizer: adam
lr: 0.001
weight_decay: 0.00005
architecture: SimpleDenseNet
input_size: 784
lin1_size: 256
dropout1: 0.30
+8
View File
@@ -0,0 +1,8 @@
_target_: torch.optim.Adam
# these are default parameters for Adam
lr: 0.001
eps: 1e-08
weight_decay: 0
# betas: [ 0.9, 0.999 ] # BUGGED :(
+39 -7
View File
@@ -1,11 +1,43 @@
_target_: pytorch_lightning.Trainer
gpus: 0 # set -1 to train on all GPUs available, set 0 to train on CPU only
# set -1 to train on all GPUs available
# set 0 to train on CPU only
gpus: 0
min_epochs: 1
max_epochs: 10
gradient_clip_val: 0.5
num_sanity_val_steps: 2
progress_bar_refresh_rate: 10
weights_summary: null
default_root_dir: "lightning_logs/"
fast_dev_run: False
# all of the parameters below are set to Lightning defaults
resume_from_checkpoint: null
# tricks
gradient_clip_val: 0
accumulate_grad_batches: 1
val_check_interval: 1.0
check_val_every_n_epoch: 1
stochastic_weight_avg: False
# debug
num_sanity_val_steps: 2
fast_dev_run: False
overfit_batches: 0
limit_train_batches: 1.0
limit_val_batches: 1.0
limit_test_batches: 1.0
track_grad_norm: -1
# prints
progress_bar_refresh_rate: null
weights_summary: null
profiler: null
# others
amp_backend: "native"
amp_level: "02"
precision: 32
accelerator: null
num_nodes: 1
tpu_cores: null
deterministic: False