a few silly tweaks
This commit is contained in:
1 parent
8fd92337bc
commit
e5a7859345
3 files changed
+21
-14
No files matched your search
@@ -37,3 +37,8 @@ callbacks:
|
||||
monitor: "val_loss"
|
||||
patience: 10
|
||||
mode: "min"
|
||||
|
||||
printing:
|
||||
progress_bar_refresh_rate: 50
|
||||
weights_summary: "full"
|
||||
profiler: True
|
||||
@@ -17,21 +17,15 @@ from utils.lightning_wrapper import LitModel
|
||||
from utils.callbacks import ExampleCallback
|
||||
|
||||
|
||||
# Load config
|
||||
with open("config.yaml", "r") as ymlfile:
|
||||
config = yaml.load(ymlfile, Loader=yaml.FullLoader)
|
||||
|
||||
|
||||
def main(config):
|
||||
# Init our model
|
||||
model = LitModel(config=config)
|
||||
|
||||
|
||||
# Init data loader
|
||||
dataloader = MNISTDataModule(batch_size=128)
|
||||
dataloader.prepare_data()
|
||||
dataloader.setup()
|
||||
|
||||
|
||||
# Init wandb logger
|
||||
wandb_logger = WandbLogger(
|
||||
project=config["loggers"]["wandb"]["project"],
|
||||
@@ -48,7 +42,6 @@ wandb_logger.log_hyperparams({
|
||||
"optimizer": model.configure_optimizers().__class__.__name__,
|
||||
})
|
||||
|
||||
|
||||
# Init callbacks
|
||||
callbacks = [
|
||||
# ExampleCallback(),
|
||||
@@ -67,19 +60,18 @@ callbacks = [
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
# Init trainer
|
||||
trainer = pl.Trainer(
|
||||
gpus=config["hparams"]["num_of_gpus"],
|
||||
max_epochs=config["hparams"]["max_epochs"],
|
||||
logger=wandb_logger,
|
||||
callbacks=callbacks,
|
||||
gpus=config["hparams"]["num_of_gpus"],
|
||||
max_epochs=config["hparams"]["max_epochs"],
|
||||
resume_from_checkpoint=config["resume"]["ckpt_path"] if config["resume"]["resume_from_ckpt"] else None,
|
||||
accumulate_grad_batches=config["hparams"]["accumulate_grad_batches"],
|
||||
gradient_clip_val=config["hparams"]["gradient_clip_val"],
|
||||
progress_bar_refresh_rate=50,
|
||||
profiler=SimpleProfiler(),
|
||||
weights_summary='full',
|
||||
progress_bar_refresh_rate=config["printing"]["progress_bar_refresh_rate"],
|
||||
profiler=SimpleProfiler() if config["printing"]["profiler"] else None,
|
||||
weights_summary=config["printing"]["weights_summary"],
|
||||
# fast_dev_run=True,
|
||||
# limit_train_batches=0.01
|
||||
# limit_val_batches=0.01
|
||||
@@ -98,3 +90,13 @@ trainer.test()
|
||||
|
||||
# Close wandb run
|
||||
wandb.finish()
|
||||
|
||||
|
||||
def load_config():
|
||||
with open("config.yaml", "r") as ymlfile:
|
||||
config = yaml.load(ymlfile, Loader=yaml.FullLoader)
|
||||
return config
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(config=load_config())
|
||||
Whitespace-only changes.
Reference in new issue
Block a user