diff --git a/README.md b/README.md
index c34a432..0267aba 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@
A clean and scalable template to kickstart your deep learning project 🚀⚡🔥
Click on [Use this template](https://github.com/ashleve/lightning-hydra-template/generate) to initialize new repository.
-*Suggestions are always welcome!*
+_Suggestions are always welcome!_
@@ -52,8 +52,6 @@ It makes your code neatly organized and provides lots of useful features, like a
- **Hyperparameter Search**: made easier with Hydra built-in plugins like [Optuna Sweeper](https://hydra.cc/docs/next/plugins/optuna_sweeper) | [#Hyperparameter Search](#hyperparameter-search)
- **Tests**: unit tests and shell/command based tests for speeding up the development | [#Tests](#tests)
- **Best Practices**: a couple of recommended tools, practices and standards for efficient workflow and reproducibility | [#Best Practices](#best-practices)
-
-
@@ -657,43 +655,52 @@ hydra:
This means your working directory is different for every run, which might not be compatible with some libraries and workflows. By default, logs have the following structure:
```
-│
├── logs
-│ ├── experiments # Folder for logs generated by experiments
-│ │ ├── experiment_name # Name of the experiment
-│ │ │ ├── 2021-02-15_16-50-49 # Date of execution
-│ │ │ │ ├── .hydra # Hydra logs
-│ │ │ │ ├── wandb # Weights&Biases logs
-│ │ │ │ ├── checkpoints # Training checkpoints
-│ │ │ │ └── ... # Any other thing saved during training
-│ │ │ └── ...
-│ │ ├── ...
+│ ├── experiments # Folder for logs generated by experiments
+│ │ ├── experiment_name # Name of the experiment
+│ │ │ ├── runs
+│ │ │ │ ├── YYYY-MM-DD # Date of execution
+│ │ │ │ │ ├── HH-MM-SS # Time of execution
+│ │ │ │ │ │ ├── .hydra # Hydra logs
+│ │ │ │ │ │ ├── wandb # Weights&Biases logs
+│ │ │ │ │ │ ├── checkpoints # Training checkpoints
+│ │ │ │ │ │ └── ... # Any other thing saved during training
+│ │ │ │ │ └── ...
+│ │ │ │ └── ...
+│ │ │ │
+│ │ │ └── multiruns
+│ │ │ ├── YYYY-MM-DD
+│ │ │ │ ├── HH-MM-SS
+│ │ │ │ │ ├── 1 # Multirun job number
+│ │ │ │ │ │ └── ...
+│ │ │ │ │ ├── 2
+│ │ │ │ │ └── ...
+│ │ │ │ └── ...
+│ │ │ └── ...
│ │ └── ...
│ │
│ ├── debugs # Folder for logs generated during debugging
-│ │ ├── 2021-02-15
-│ │ │ ├── 16-50-49
+│ │ ├── runs
+│ │ │ ├── YYYY-MM-DD
+│ │ │ │ ├── HH-MM-SS
+│ │ │ │ └── ...
│ │ │ └── ...
-│ │ ├── ...
-│ │ └── ...
+│ │ └── multiruns
+│ │ ├── YYYY-MM-DD
+│ │ │ ├── HH-MM-SS
+│ │ │ └── ...
+│ │ └─ ...
│ │
│ ├── runs # Folder for logs generated by normal runs
-│ │ ├── 2021-02-15
-│ │ │ ├── 16-50-49
-│ │ │ │ └── ...
-│ │ │ ├── ...
+│ │ ├── YYYY-MM-DD
+│ │ │ ├── HH-MM-SS
│ │ │ └── ...
-│ │ ├── ...
│ │ └── ...
│ │
-│ └── multiruns # Folder for logs generated by multiruns (sweeps)
-│ ├── 2021-02-15_16-50-49
-│ │ ├── 0
-│ │ │ └── ...
-│ │ ├── 1
-│ │ ├── 2
-│ │ └── ...
-│ ├── ...
+│ └── multiruns # Folder for logs generated by normal multiruns (sweeps)
+│ ├── YYYY-MM-DD
+│ | ├── HH-MM-SS
+│ | └── ...
│ └── ...
│
```
@@ -921,6 +928,7 @@ python run.py trainer.gpus=4 +trainer.accelerator="ddp"
### Reproducibility
What provides reproducibility:
+
- Hydra manages your configs
- Hydra manages your logging paths and makes every executed run store its hyperparameters and config overrides in a separate file in logs
- Single seed for random number generators in pytorch, numpy and python.random
@@ -931,19 +939,15 @@ What provides reproducibility:
- Example callbacks for wandb show how you can save and upload a snapshot of codebase every time the run is executed, as well as upload ckpts and track model gradients
You can load the config of previous run using:
+
```bash
python run.py --config-path /logs/runs/.../.hydra/ --config-name config.yaml
```
+
The `config.yaml` from `.hydra` folder contains all overriden parameters and sections. This approach however is not officially supported by Hydra and doesn't override the `hydra/` part of the config, meaning logging paths will revert to default!
-
-
### Limitations
- Currently, template doesn't support k-fold cross validation, but it's possible to achieve it with Lightning Loop interface. See the [official example](https://github.com/PyTorchLightning/pytorch-lightning/blob/master/pl_examples/loop_examples/kfold.py). Implementing it requires rewriting the training pipeline.
diff --git a/configs/experiment/example_full.yaml b/configs/experiment/example_full.yaml
index 6280bfe..aa44939 100644
--- a/configs/experiment/example_full.yaml
+++ b/configs/experiment/example_full.yaml
@@ -71,6 +71,6 @@ callbacks:
logger:
wandb:
- name: ${name}_${now:%Y-%m-%d_%H-%M-%S}
+ name: ${name}/${now:%Y-%m-%d}/${now:%H-%M-%S}
tags: ["best_model", "mnist"]
notes: "Description of this model."
diff --git a/configs/mode/debug.yaml b/configs/mode/debug.yaml
index 8aaf195..7d7a498 100644
--- a/configs/mode/debug.yaml
+++ b/configs/mode/debug.yaml
@@ -18,9 +18,9 @@ hydra:
# sets output paths for all file logs to 'logs/debug/'
run:
- dir: logs/debug/${now:%Y-%m-%d}/${now:%H-%M-%S}
+ dir: logs/debug/runs/${now:%Y-%m-%d}/${now:%H-%M-%S}
sweep:
- dir: logs/debug/multirun_${now:%Y-%m-%d_%H-%M-%S}
+ dir: logs/debug/multiruns/${now:%Y-%m-%d}/${now:%H-%M-%S}
subdir: ${hydra.job.num}
# disable rich config printing, since it will be already printed by hydra when `verbose: True`
diff --git a/configs/mode/default.yaml b/configs/mode/default.yaml
index 3995570..e002131 100644
--- a/configs/mode/default.yaml
+++ b/configs/mode/default.yaml
@@ -9,5 +9,5 @@ hydra:
run:
dir: logs/runs/${now:%Y-%m-%d}/${now:%H-%M-%S}
sweep:
- dir: logs/multiruns/${now:%Y-%m-%d_%H-%M-%S}
+ dir: logs/multiruns/${now:%Y-%m-%d}/${now:%H-%M-%S}
subdir: ${hydra.job.num}
diff --git a/configs/mode/exp.yaml b/configs/mode/exp.yaml
index 7136f1f..bda4e09 100644
--- a/configs/mode/exp.yaml
+++ b/configs/mode/exp.yaml
@@ -11,7 +11,7 @@ name: ???
hydra:
# sets output paths for all file logs to `logs/experiment/name'
run:
- dir: logs/experiments/${name}/${now:%Y-%m-%d_%H-%M-%S}
+ dir: logs/experiments/${name}/runs/${now:%Y-%m-%d}/${now:%H-%M-%S}
sweep:
- dir: logs/experiments/${name}/multirun_${now:%Y-%m-%d_%H-%M-%S}
+ dir: logs/experiments/${name}/multiruns/${now:%Y-%m-%d}/${now:%H-%M-%S}
subdir: ${hydra.job.num}
diff --git a/logs/latest b/logs/latest
new file mode 100755
index 0000000..84102ed
--- /dev/null
+++ b/logs/latest
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+# This script allows to quickly change into the latest log dir of a specific kind.
+# Should be executed from project root folder.
+#
+# Go to latest log dir from 'runs' folder:
+# cd $(logs/latest logs/runs)
+#
+# Go to latest log dir from 'experiments' folder:
+# cd $(logs/latest logs/experiments)
+
+
+set -e
+set -o pipefail
+
+find "$1" -maxdepth 2 -type d | sort -r | head -n 1