training with hydra works

This commit is contained in:
hobogalaxy committed 2021-01-06 02:49:30 +01:00
1 parent 9cffc61c20
commit 610117f161
27 files changed
+247 -430

No files matched your search

@@ -8,22 +8,22 @@ class MNISTDataModule(LightningDataModule):
"""
This is example of datamodule for MNIST dataset.
The path to datamodule should be specified in your run config. (run_configs.yaml)
The 'hparams' dict contains your hparams specified in run config. (run_configs.yaml)
The path to datamodule should be specified in your run config.
The 'args' dict contains datamodule args specified in config.
To learn how to create datamodules visit:
https://pytorch-lightning.readthedocs.io/en/latest/datamodules.html
"""
def __init__(self, data_dir: str, hparams: dict):
def __init__(self, data_dir, **args):
super().__init__()
self.data_dir = data_dir + "/MNIST" # data_dir is specified in project_config.yaml
self.data_dir = data_dir + "/MNIST" # data_dir is specified in config.yaml
self.batch_size = hparams.get("batch_size") or 64
self.train_val_test_split = hparams.get("train_val_test_split") or [55_000, 5_000, 10_000]
self.num_workers = hparams.get("num_workers") or 1
self.pin_memory = hparams.get("pin_memory") or False
self.batch_size = args.get("batch_size") or 64
self.train_val_test_split = args.get("train_val_test_split") or [55_000, 5_000, 10_000]
self.num_workers = args.get("num_workers") or 1
self.pin_memory = args.get("pin_memory") or False
self.transforms = transforms.ToTensor()