small improvements
This commit is contained in:
1 parent
490c3d6cc7
commit
5ff284ec42
7 files changed
+47
-33
No files matched your search
@@ -1,7 +1,8 @@
|
|||||||
## Deep learning project template
|
## Deep learning project template
|
||||||
This is my starting template and pipeline for most deep learning projects 🔥<br>
|
This is my starting template and pipeline for most deep learning projects.<br>
|
||||||
Built with <b>PyTorch Lightning</b>, <b>Hydra</b> and <b>Weights&Biases</b>.<br>
|
Built with <b>PyTorch Lightning</b>, <b>Hydra</b> and <b>Weights&Biases</b>.<br>
|
||||||
It's supposed to be enchancement/expansion on original [deep-learninig-project-template](https://github.com/PyTorchLightning/deep-learning-project-template) repository.<br>
|
It's supposed to be enchancement/expansion on original [deep-learninig-project-template](https://github.com/PyTorchLightning/deep-learning-project-template) repository.<br>
|
||||||
|
|
||||||
The goal is to:
|
The goal is to:
|
||||||
- structure ML code the same so that work can easily be extended and replicated
|
- structure ML code the same so that work can easily be extended and replicated
|
||||||
- allow for quick and efficient experimentation process thanks to automating pipeline with config files
|
- allow for quick and efficient experimentation process thanks to automating pipeline with config files
|
||||||
@@ -72,7 +73,7 @@ The directory structure of new project looks like this:
|
|||||||
├── LICENSE <- Project license
|
├── LICENSE <- Project license
|
||||||
├── README.md <- Readme
|
├── README.md <- Readme
|
||||||
├── conda_env.yaml <- File for installing conda environment
|
├── conda_env.yaml <- File for installing conda environment
|
||||||
├── requirements.txt <- List of python dependencies
|
├── requirements.txt <- File for installing python dependencies
|
||||||
└── setup.py <- File for installing project as a package
|
└── setup.py <- File for installing project as a package
|
||||||
```
|
```
|
||||||
<br>
|
<br>
|
||||||
@@ -83,7 +84,7 @@ The directory structure of new project looks like this:
|
|||||||
# specify here default training configuration
|
# specify here default training configuration
|
||||||
defaults:
|
defaults:
|
||||||
- trainer: default_trainer.yaml # choose trainer from 'configs/trainer/' folder
|
- trainer: default_trainer.yaml # choose trainer from 'configs/trainer/' folder
|
||||||
- model: mnist_model.yaml # choose model from 'configs/model/' folder
|
- model: mnist_model.yaml # choose model from 'configs/model/' folder
|
||||||
- datamodule: mnist_datamodule.yaml # choose datamodule from 'configs/datamodule/' folder
|
- datamodule: mnist_datamodule.yaml # choose datamodule from 'configs/datamodule/' folder
|
||||||
- optimizer: adam.yaml # choose optimizer from 'configs/optimizer/' folder
|
- optimizer: adam.yaml # choose optimizer from 'configs/optimizer/' folder
|
||||||
- seeds: default_seeds.yaml # set this to null if you don't want to use seeds
|
- seeds: default_seeds.yaml # set this to null if you don't want to use seeds
|
||||||
@@ -127,7 +128,7 @@ Example experiment configuration:
|
|||||||
```yaml
|
```yaml
|
||||||
defaults:
|
defaults:
|
||||||
- override /trainer: default_trainer.yaml # choose trainer from 'configs/trainer/'
|
- override /trainer: default_trainer.yaml # choose trainer from 'configs/trainer/'
|
||||||
- override /model: mnist_model.yaml # choose model from 'configs/model/'
|
- override /model: mnist_model.yaml # choose model from 'configs/model/'
|
||||||
- override /datamodule: mnist_datamodule.yaml # choose datamodule from 'configs/datamodule/'
|
- override /datamodule: mnist_datamodule.yaml # choose datamodule from 'configs/datamodule/'
|
||||||
- override /optimizer: adam.yaml # choose optimizer from 'configs/optimizer/'
|
- override /optimizer: adam.yaml # choose optimizer from 'configs/optimizer/'
|
||||||
- override /seeds: default_seeds.yaml # choose seeds from 'configs/seeds/'
|
- override /seeds: default_seeds.yaml # choose seeds from 'configs/seeds/'
|
||||||
@@ -186,7 +187,7 @@ Logs are created automatically with the following structure:
|
|||||||
│ │ └── ...
|
│ │ └── ...
|
||||||
│ │
|
│ │
|
||||||
│ ├── multiruns # Folder for logs generated from sweeps
|
│ ├── multiruns # Folder for logs generated from sweeps
|
||||||
│ │ ├── 2021-02-15_16-50-49 # Date and hour of executing run
|
│ │ ├── 2021-02-15_16-50-49 # Date and hour of executing sweep
|
||||||
│ │ │ ├── 0 # Job number
|
│ │ │ ├── 0 # Job number
|
||||||
│ │ │ │ ├── .hydra # Hydra logs
|
│ │ │ │ ├── .hydra # Hydra logs
|
||||||
│ │ │ │ ├── wandb # Weights&Biases logs
|
│ │ │ │ ├── wandb # Weights&Biases logs
|
||||||
|
|||||||
@@ -3,3 +3,15 @@
|
|||||||
defaults:
|
defaults:
|
||||||
- default_callbacks.yaml
|
- default_callbacks.yaml
|
||||||
- wandb_callbacks.yaml
|
- wandb_callbacks.yaml
|
||||||
|
|
||||||
|
|
||||||
|
save_confusion_matrix_to_wandb:
|
||||||
|
class: src.callbacks.wandb_callbacks.SaveConfusionMatrixToWandb
|
||||||
|
args:
|
||||||
|
class_names: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
|
||||||
|
|
||||||
|
|
||||||
|
save_f1_precision_recall_heatmap_to_wandb:
|
||||||
|
class: src.callbacks.wandb_callbacks.SaveMetricsHeatmapToWandb
|
||||||
|
args:
|
||||||
|
class_names: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
|
||||||
@@ -1,31 +1,34 @@
|
|||||||
# @package _group_
|
# @package _group_
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
- default_callbacks.yaml
|
||||||
|
|
||||||
|
|
||||||
save_best_metric_scores_to_wandb:
|
save_best_metric_scores_to_wandb:
|
||||||
class: src.callbacks.wandb_callbacks.SaveBestMetricScoresToWandb
|
class: src.callbacks.wandb_callbacks.SaveBestMetricScoresToWandb
|
||||||
args: {}
|
args: {}
|
||||||
|
|
||||||
|
|
||||||
|
upload_code_to_wandb_as_artifact:
|
||||||
|
class: src.callbacks.wandb_callbacks.SaveCodeToWandb
|
||||||
|
args:
|
||||||
|
code_dir: ${work_dir}/
|
||||||
|
|
||||||
|
|
||||||
|
upload_ckpts_to_wandb_as_artifact:
|
||||||
|
class: src.callbacks.wandb_callbacks.UploadAllCheckpointsToWandb
|
||||||
|
args:
|
||||||
|
ckpt_dir: "checkpoints/"
|
||||||
|
upload_best_only: False
|
||||||
|
|
||||||
|
|
||||||
#save_confusion_matrix_to_wandb:
|
#save_confusion_matrix_to_wandb:
|
||||||
# class: src.callbacks.wandb_callbacks.SaveConfusionMatrixToWandb
|
# class: src.callbacks.wandb_callbacks.SaveConfusionMatrixToWandb
|
||||||
# args:
|
# args:
|
||||||
# class_names: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
|
# class_names: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
|
||||||
#
|
|
||||||
#
|
|
||||||
#save_f1_precision_recall_heatmap_to_wandb:
|
#save_f1_precision_recall_heatmap_to_wandb:
|
||||||
# class: src.callbacks.wandb_callbacks.SaveMetricsHeatmapToWandb
|
# class: src.callbacks.wandb_callbacks.SaveMetricsHeatmapToWandb
|
||||||
# args:
|
# args:
|
||||||
# class_names: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
|
# class_names: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
|
||||||
|
|
||||||
|
|
||||||
#upload_code_to_wandb_as_artifact:
|
|
||||||
# class: src.callbacks.wandb_callbacks.SaveCodeToWandb
|
|
||||||
# args:
|
|
||||||
# code_dir: ${work_dir}/
|
|
||||||
|
|
||||||
|
|
||||||
#upload_ckpts_to_wandb_as_artifact:
|
|
||||||
# class: src.callbacks.wandb_callbacks.UploadAllCheckpointsToWandb
|
|
||||||
# args:
|
|
||||||
# ckpt_dir: "checkpoints/"
|
|
||||||
# upload_best_only: True
|
|
||||||
|
|
||||||
@@ -9,8 +9,8 @@ defaults:
|
|||||||
- callbacks: default_callbacks.yaml # set this to null if you don't want to use callbacks
|
- callbacks: default_callbacks.yaml # set this to null if you don't want to use callbacks
|
||||||
- logger: null # set logger here or use command line (e.g. `python train.py logger=wandb`)
|
- logger: null # set logger here or use command line (e.g. `python train.py logger=wandb`)
|
||||||
|
|
||||||
- override hydra/job_logging: colorlog
|
# - override hydra/job_logging: colorlog
|
||||||
- override hydra/hydra_logging: colorlog
|
# - override hydra/hydra_logging: colorlog
|
||||||
|
|
||||||
# path to working directory (the directory that `train.py` was executed from in command line)
|
# path to working directory (the directory that `train.py` was executed from in command line)
|
||||||
work_dir: ${hydra:runtime.cwd}
|
work_dir: ${hydra:runtime.cwd}
|
||||||
@@ -29,13 +29,10 @@ hydra:
|
|||||||
# extra things that are logged by all loggers as hyperparameters
|
# extra things that are logged by all loggers as hyperparameters
|
||||||
extra_logs:
|
extra_logs:
|
||||||
log_seeds: True
|
log_seeds: True
|
||||||
|
|
||||||
log_trainer_args: False
|
log_trainer_args: False
|
||||||
log_datamodule_args: True
|
log_datamodule_args: True
|
||||||
|
|
||||||
log_model_class: True
|
log_model_class: True
|
||||||
log_optimizer_class: True
|
log_optimizer_class: True
|
||||||
log_datamodule_class: True
|
log_datamodule_class: True
|
||||||
log_model_architecture_class: True
|
log_model_architecture_class: True
|
||||||
|
|
||||||
log_train_val_test_sizes: False
|
log_train_val_test_sizes: False
|
||||||
@@ -2,11 +2,8 @@
|
|||||||
|
|
||||||
class: src.models.simple_mnist_classifier.LitModel
|
class: src.models.simple_mnist_classifier.LitModel
|
||||||
args:
|
args:
|
||||||
lr: 0.001
|
|
||||||
weight_decay: 0.00001
|
|
||||||
input_size: 784
|
input_size: 784
|
||||||
output_size: 10
|
output_size: 10
|
||||||
lin1_size: 256
|
lin1_size: 256
|
||||||
lin2_size: 256
|
lin2_size: 256
|
||||||
lin3_size: 128
|
lin3_size: 128
|
||||||
|
|
||||||
@@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
# trainer args for debugging model
|
# trainer args for debugging model
|
||||||
args:
|
args:
|
||||||
gpus: -1 # set -1 to train on all GPUs abailable, set 0 to train on CPU only
|
gpus: 0 # set -1 to train on all GPUs abailable, set 0 to train on CPU only
|
||||||
auto_select_gpus: True
|
# auto_select_gpus: True
|
||||||
|
|
||||||
|
gradient_clip_val: 0.5
|
||||||
|
|
||||||
# fast_dev_run: True # bugged :(
|
# fast_dev_run: True # bugged :(
|
||||||
limit_train_batches: 1.0
|
limit_train_batches: 1.0
|
||||||
|
|||||||
@@ -3,9 +3,11 @@
|
|||||||
# default args passed to Lightning Trainer on every experiment
|
# default args passed to Lightning Trainer on every experiment
|
||||||
# they can be combined or overwritten with args set in experiment config
|
# they can be combined or overwritten with args set in experiment config
|
||||||
args:
|
args:
|
||||||
gpus: -1 # set -1 to train on all GPUs available, set 0 to train on CPU only
|
gpus: 0 # set -1 to train on all GPUs available, set 0 to train on CPU only
|
||||||
auto_select_gpus: True
|
# auto_select_gpus: True
|
||||||
|
|
||||||
max_epochs: 10
|
max_epochs: 10
|
||||||
|
gradient_clip_val: 0.5
|
||||||
num_sanity_val_steps: 3
|
num_sanity_val_steps: 3
|
||||||
progress_bar_refresh_rate: 10
|
progress_bar_refresh_rate: 10
|
||||||
weights_summary: null # null in yaml represents python None value
|
weights_summary: null # null in yaml represents python None value
|
||||||
|
|||||||
Reference in new issue
Block a user