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
|
||||
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>
|
||||
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:
|
||||
- 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
|
||||
@@ -72,7 +73,7 @@ The directory structure of new project looks like this:
|
||||
├── LICENSE <- Project license
|
||||
├── README.md <- Readme
|
||||
├── 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
|
||||
```
|
||||
<br>
|
||||
@@ -83,7 +84,7 @@ The directory structure of new project looks like this:
|
||||
# specify here default training configuration
|
||||
defaults:
|
||||
- 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
|
||||
- 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
|
||||
@@ -127,7 +128,7 @@ Example experiment configuration:
|
||||
```yaml
|
||||
defaults:
|
||||
- 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 /optimizer: adam.yaml # choose optimizer from 'configs/optimizer/'
|
||||
- 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
|
||||
│ │ ├── 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
|
||||
│ │ │ │ ├── .hydra # Hydra logs
|
||||
│ │ │ │ ├── wandb # Weights&Biases logs
|
||||
|
||||
@@ -3,3 +3,15 @@
|
||||
defaults:
|
||||
- default_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_
|
||||
|
||||
defaults:
|
||||
- default_callbacks.yaml
|
||||
|
||||
|
||||
save_best_metric_scores_to_wandb:
|
||||
class: src.callbacks.wandb_callbacks.SaveBestMetricScoresToWandb
|
||||
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:
|
||||
# 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']
|
||||
|
||||
|
||||
#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
|
||||
- logger: null # set logger here or use command line (e.g. `python train.py logger=wandb`)
|
||||
|
||||
- override hydra/job_logging: colorlog
|
||||
- override hydra/hydra_logging: colorlog
|
||||
# - override hydra/job_logging: colorlog
|
||||
# - override hydra/hydra_logging: colorlog
|
||||
|
||||
# path to working directory (the directory that `train.py` was executed from in command line)
|
||||
work_dir: ${hydra:runtime.cwd}
|
||||
@@ -29,13 +29,10 @@ hydra:
|
||||
# extra things that are logged by all loggers as hyperparameters
|
||||
extra_logs:
|
||||
log_seeds: True
|
||||
|
||||
log_trainer_args: False
|
||||
log_datamodule_args: True
|
||||
|
||||
log_model_class: True
|
||||
log_optimizer_class: True
|
||||
log_datamodule_class: True
|
||||
log_model_architecture_class: True
|
||||
|
||||
log_train_val_test_sizes: False
|
||||
@@ -2,11 +2,8 @@
|
||||
|
||||
class: src.models.simple_mnist_classifier.LitModel
|
||||
args:
|
||||
lr: 0.001
|
||||
weight_decay: 0.00001
|
||||
input_size: 784
|
||||
output_size: 10
|
||||
lin1_size: 256
|
||||
lin2_size: 256
|
||||
lin3_size: 128
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
# trainer args for debugging model
|
||||
args:
|
||||
gpus: -1 # set -1 to train on all GPUs abailable, set 0 to train on CPU only
|
||||
auto_select_gpus: True
|
||||
gpus: 0 # set -1 to train on all GPUs abailable, set 0 to train on CPU only
|
||||
# auto_select_gpus: True
|
||||
|
||||
gradient_clip_val: 0.5
|
||||
|
||||
# fast_dev_run: True # bugged :(
|
||||
limit_train_batches: 1.0
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
# default args passed to Lightning Trainer on every experiment
|
||||
# they can be combined or overwritten with args set in experiment config
|
||||
args:
|
||||
gpus: -1 # set -1 to train on all GPUs available, set 0 to train on CPU only
|
||||
auto_select_gpus: True
|
||||
gpus: 0 # set -1 to train on all GPUs available, set 0 to train on CPU only
|
||||
# auto_select_gpus: True
|
||||
|
||||
max_epochs: 10
|
||||
gradient_clip_val: 0.5
|
||||
num_sanity_val_steps: 3
|
||||
progress_bar_refresh_rate: 10
|
||||
weights_summary: null # null in yaml represents python None value
|
||||
|
||||
Reference in new issue
Block a user