diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 37ad035..e63f2f0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: - id: check-added-large-files -# Black - code formatting +# Black (code formatting) - repo: https://github.com/psf/black rev: 20.8b1 hooks: @@ -22,7 +22,7 @@ repos: args: [--force-exclude, train.py] -# Isort - import sorting +# Isort (import sorting) # - repo: https://github.com/PyCQA/isort # rev: 5.7.0 # hooks: @@ -30,9 +30,10 @@ repos: # # profiles: https://pycqa.github.io/isort/docs/configuration/profiles/ # # other flags: https://pycqa.github.io/isort/docs/configuration/options/ # args: [--profile, black] +# files: "src/.*" -# MyPy - static type checking +# MyPy (static type checking) # - repo: https://github.com/pre-commit/mirrors-mypy # rev: v0.790 # hooks: diff --git a/configs/config.yaml b/configs/config.yaml index 5b94eda..da8923f 100644 --- a/configs/config.yaml +++ b/configs/config.yaml @@ -42,8 +42,9 @@ disable_warnings: True disable_lightning_logs: False -# output paths for hydra logs +# # hydra configuration hydra: + # output paths for hydra logs run: dir: logs/runs/${now:%Y-%m-%d}/${now:%H-%M-%S} sweep: @@ -51,7 +52,7 @@ hydra: subdir: ${hydra.job.num} job: - # set here your environment variables + # set your environment variables here env_set: # currently there are some issues with running sweeps alongside wandb # https://github.com/wandb/client/issues/1314 diff --git a/configs/config_ray.yaml b/configs/config_ray.yaml deleted file mode 100644 index 93e7007..0000000 --- a/configs/config_ray.yaml +++ /dev/null @@ -1,36 +0,0 @@ -# @package _global_ - -defaults: - # load everything from main config file - - config.yaml - - # override sweeper to Ray! - - override hydra/launcher: ray - # - override hydra/launcher: ray_aws - - -hydra: - launcher: - ray: - remote: - max_retries: 4 - # InstanceType: p2.8xlarge - # asd - - # sync_up: - # # source dir is relative in this case, assuming you are running from - # # /hydra/plugins/hydra_ray_launcher/example - # # absolute path is also supported. - # source_dir: '.' - # # we leave target_dir to be null - # # as a result the files will be synced to a temp dir on remote cluster. - # # the temp dir will be cleaned up after the jobs are done. - # # recommend to leave target_dir to be null if you are syncing code/artifacts to remote cluster so you don't need - # # configure $PYTHONPATH on remote cluster - # include: ['model', '*.py'] - # # No need to sync up config files. - # exclude: ['*'] - # sync_down: - # include: ['*.pt', '*/'] - # # No need to sync down config files. - # exclude: ['*'] diff --git a/requirements.txt b/requirements.txt index 8ed6598..e393139 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,14 +1,14 @@ # --------- pytorch --------- # -torch>=1.7.1 -torchvision>=0.8.2 -torchaudio>=0.7.2 -pytorch-lightning>=1.2.1 +torch>=1.8.0 +torchvision>=0.9.0 +torchaudio>=0.8.0 +pytorch-lightning>=1.2.2 # --------- hydra --------- # hydra-core==1.1.0.dev3 hydra_colorlog>=1.0.0 hydra-optuna-sweeper>=0.9.0rc2 -hydra-ray-launcher==0.1.2 +# hydra-ray-launcher>=0.1.2 # --------- loggers --------- # wandb>=0.10.20 diff --git a/src/utils/template_utils.py b/src/utils/template_utils.py index 7235f0e..4cde14c 100644 --- a/src/utils/template_utils.py +++ b/src/utils/template_utils.py @@ -39,6 +39,16 @@ def extras(config: DictConfig): # make it possible to add new keys to config OmegaConf.set_struct(config, False) + # [OPTIONAL] Disable python warnings if + if config.get("disable_warnings"): + log.info(f"Disabling python warnings! <{config.disable_warnings=}>") + warnings.filterwarnings("ignore") + + # [OPTIONAL] Disable Lightning logs if + if config.get("disable_lightning_logs"): + log.info(f"Disabling lightning logs! {config.disable_lightning_logs=}>") + logging.getLogger("lightning").setLevel(logging.ERROR) + # [OPTIONAL] Set if if config.get("debug"): log.info(f"Running in debug mode! <{config.debug=}>") @@ -56,16 +66,6 @@ def extras(config: DictConfig): if config.datamodule.get("num_workers"): config.datamodule.num_workers = 0 - # [OPTIONAL] Disable python warnings if - if config.get("disable_warnings"): - log.info(f"Disabling python warnings! <{config.disable_warnings=}>") - warnings.filterwarnings("ignore") - - # [OPTIONAL] Disable Lightning logs if - if config.get("disable_lightning_logs"): - log.info(f"Disabling lightning logs! {config.disable_lightning_logs=}>") - logging.getLogger("lightning").setLevel(logging.ERROR) - # disable adding new keys to config OmegaConf.set_struct(config, True) diff --git a/train.py b/train.py index 1310aa7..6c03094 100644 --- a/train.py +++ b/train.py @@ -42,7 +42,7 @@ def train(config: DictConfig): log.info(f"Instantiating datamodule <{config.datamodule._target_}>") datamodule: LightningDataModule = hydra.utils.instantiate(config.datamodule) - # Init Lightning callbacks + # Init Lightning callbacks ⚡ callbacks: List[Callback] = [] if "callbacks" in config: for _, cb_conf in config["callbacks"].items(): @@ -50,7 +50,7 @@ def train(config: DictConfig): log.info(f"Instantiating callback <{cb_conf._target_}>") callbacks.append(hydra.utils.instantiate(cb_conf)) - # Init Lightning loggers + # Init Lightning loggers ⚡ logger: List[LightningLoggerBase] = [] if "logger" in config: for _, lg_conf in config["logger"].items():