Release/1.0 (#156)
* update to Hydra 1.1 * add bash folder with scripts for conda setup and run scheduling * add saving seed in `log_hyperparameters()` method * redesign Dockerfile to make it weight less * add `test_after_training` parameter to config * add inheritance to trainer configs * remove forcing ddp-friendly configuration * refactor tests * remove conda_env_gpu.yaml * remove default langage version from pre-commit config * add mnist datamodule unit test * rename test folder from 'smoke' to 'shell' * remove wandb import from utils.py * change 'use_artifact' to 'log_artifact' in wandb callbacks * add rank zero decorator to wandb callbacks * add dumping rich tree config to file * get rid of `=` character in ckpt names * update requirements.txt * update LICENSE * update README.md
This commit is contained in:
1 parent
362a4beebb
commit
d45f604bc8
35 files changed
+398
-424
No files matched your search
+10
-14
@@ -1,13 +1,12 @@
|
||||
import logging
|
||||
import os
|
||||
import warnings
|
||||
from typing import List, Sequence
|
||||
|
||||
import pytorch_lightning as pl
|
||||
import rich.syntax
|
||||
import rich.tree
|
||||
import wandb
|
||||
from omegaconf import DictConfig, OmegaConf
|
||||
from pytorch_lightning.loggers.wandb import WandbLogger
|
||||
from pytorch_lightning.utilities import rank_zero_only
|
||||
|
||||
|
||||
@@ -30,7 +29,6 @@ def extras(config: DictConfig) -> None:
|
||||
- disabling warnings
|
||||
- easier access to debug mode
|
||||
- forcing debug friendly configuration
|
||||
- forcing multi-gpu friendly configuration
|
||||
|
||||
Modifies DictConfig in place.
|
||||
|
||||
@@ -64,15 +62,6 @@ def extras(config: DictConfig) -> None:
|
||||
if config.datamodule.get("num_workers"):
|
||||
config.datamodule.num_workers = 0
|
||||
|
||||
# force multi-gpu friendly configuration if <config.trainer.accelerator=ddp>
|
||||
accelerator = config.trainer.get("accelerator")
|
||||
if accelerator in ["ddp", "ddp_spawn", "dp", "ddp2"]:
|
||||
log.info(f"Forcing ddp friendly configuration! <config.trainer.accelerator={accelerator}>")
|
||||
if config.datamodule.get("num_workers"):
|
||||
config.datamodule.num_workers = 0
|
||||
if config.datamodule.get("pin_memory"):
|
||||
config.datamodule.pin_memory = False
|
||||
|
||||
# disable adding new keys to config
|
||||
OmegaConf.set_struct(config, True)
|
||||
|
||||
@@ -100,7 +89,7 @@ def print_config(
|
||||
"""
|
||||
|
||||
style = "dim"
|
||||
tree = rich.tree.Tree(":gear: CONFIG", style=style, guide_style=style)
|
||||
tree = rich.tree.Tree("CONFIG", style=style, guide_style=style)
|
||||
|
||||
for field in fields:
|
||||
branch = tree.add(field, style=style, guide_style=style)
|
||||
@@ -114,6 +103,9 @@ def print_config(
|
||||
|
||||
rich.print(tree)
|
||||
|
||||
with open("config_tree.txt", "w") as fp:
|
||||
rich.print(tree, file=fp)
|
||||
|
||||
|
||||
def empty(*args, **kwargs):
|
||||
pass
|
||||
@@ -140,6 +132,8 @@ def log_hyperparameters(
|
||||
hparams["trainer"] = config["trainer"]
|
||||
hparams["model"] = config["model"]
|
||||
hparams["datamodule"] = config["datamodule"]
|
||||
if "seed" in config:
|
||||
hparams["seed"] = config["seed"]
|
||||
if "callbacks" in config:
|
||||
hparams["callbacks"] = config["callbacks"]
|
||||
|
||||
@@ -173,5 +167,7 @@ def finish(
|
||||
|
||||
# without this sweeps with wandb logger might crash!
|
||||
for lg in logger:
|
||||
if isinstance(lg, WandbLogger):
|
||||
if isinstance(lg, pl.loggers.wandb.WandbLogger):
|
||||
import wandb
|
||||
|
||||
wandb.finish()
|
||||
Reference in new issue
Block a user