From 94cb2375c1907b53101d00159c8f2369c2093011 Mon Sep 17 00:00:00 2001 From: hobogalaxy Date: Sat, 21 Nov 2020 04:53:31 +0100 Subject: [PATCH] some silly tweaks --- project/config.yaml | 14 +++++++++----- project/train.py | 2 +- project/training_modules/lightning_wrapper.py | 7 +------ 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/project/config.yaml b/project/config.yaml index ef2b1d6..df455f1 100644 --- a/project/config.yaml +++ b/project/config.yaml @@ -1,19 +1,23 @@ num_of_gpus: -1 hparams: + # these hyperparameters should always be in this file max_epochs: 3 batch_size: 64 lr: 0.001 - accumulate_grad_batches: 1 - gradient_clip_val: 0.5 - output_size: 10 weight_decay: 0.000001 - split_ratio: 0.9 + gradient_clip_val: 0.5 + accumulate_grad_batches: 1 + + # these hyperparameters are custom, you can add here anything + train_val_split_ratio: 0.9 + output_size: 10 lin1_size: 256 lin2_size: 256 lin3_size: 128 -resume: + +resume: # this is for resuming training from lightning checkpoint resume_from_ckpt: False wandb_run_id: "8uuomodb" ckpt_path: "checkpoints/epoch=2.ckpt" diff --git a/project/train.py b/project/train.py index 2976d0a..65825a6 100644 --- a/project/train.py +++ b/project/train.py @@ -13,7 +13,7 @@ def train(config): # Init data module datamodule = MNISTDataModule( batch_size=config["hparams"]["batch_size"], - split_ratio=config["hparams"]["split_ratio"] + split_ratio=config["hparams"]["train_val_split_ratio"] ) datamodule.prepare_data() datamodule.setup() diff --git a/project/training_modules/lightning_wrapper.py b/project/training_modules/lightning_wrapper.py index e44aaf3..53a290a 100644 --- a/project/training_modules/lightning_wrapper.py +++ b/project/training_modules/lightning_wrapper.py @@ -33,8 +33,6 @@ class LitModel(pl.LightningModule): acc = accuracy_score(preds, y) self.log('train_loss', loss, on_step=False, on_epoch=True, logger=True, prog_bar=True) self.log('train_acc', acc, on_step=False, on_epoch=True, logger=True, prog_bar=True) - # f1 = f1_score(preds, y, average="micro") - # self.log('train_f1', f1, on_step=False, on_epoch=True, logger=True, prog_bar=True) return loss @@ -50,9 +48,8 @@ class LitModel(pl.LightningModule): acc = accuracy_score(preds, y) self.log('val_loss', loss, on_step=False, on_epoch=True, logger=True, prog_bar=True) self.log('val_acc', acc, on_step=False, on_epoch=True, logger=True, prog_bar=True) - # f1 = f1_score(preds, y, average="micro") - # self.log('val_f1', f1, on_step=False, on_epoch=True, logger=True, prog_bar=True) + # we can return here anything and then read it in some callback return preds, y # logic for a single testing step @@ -67,8 +64,6 @@ class LitModel(pl.LightningModule): acc = accuracy_score(preds, y) self.log('test_loss', loss, on_step=False, on_epoch=True, logger=True, prog_bar=True) self.log('test_acc', acc, on_step=False, on_epoch=True, logger=True, prog_bar=True) - # f1 = f1_score(preds, y, average="micro") - # self.log('test_f1', f1, on_step=False, on_epoch=True, logger=True, prog_bar=True) return loss