add new project structure to readme
This commit is contained in:
1 parent
7d09ab8ece
commit
5fa6d8bb48
2 files changed
+76
-38
No files matched your search
@@ -1,10 +1,12 @@
|
|||||||
# Hackathon template
|
# Hackathon template
|
||||||
A convenient starting template for most deep learning projects. Built with PyTorch Lightning and Weights&Biases.
|
A convenient starting template for most deep learning projects. Built with PyTorch Lightning and Weights&Biases.
|
||||||
<br>
|
<br>
|
||||||
|
<br>
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
Read [SETUP.md](SETUP.md)
|
Read [SETUP.md](SETUP.md)
|
||||||
<br>
|
<br>
|
||||||
|
<br>
|
||||||
|
|
||||||
## Project structure
|
## Project structure
|
||||||
The directory structure of new project looks like this:
|
The directory structure of new project looks like this:
|
||||||
@@ -12,79 +14,116 @@ The directory structure of new project looks like this:
|
|||||||
├── project
|
├── project
|
||||||
│ ├── data <- Data from third party sources
|
│ ├── data <- Data from third party sources
|
||||||
│ │
|
│ │
|
||||||
|
│ ├── logs <- Logs generated by Weights&Biases and PyTorch Lightning during training
|
||||||
|
│ │
|
||||||
│ ├── docs <- Useful pdf files
|
│ ├── docs <- Useful pdf files
|
||||||
│ │
|
│ │
|
||||||
│ ├── hack_utils <- Any extra scripts not belonging to training pipeline
|
│ ├── hack_utils <- Any extra scripts not belonging to training pipeline
|
||||||
│ │
|
│ │
|
||||||
│ ├── notebooks <- Jupyter notebooks
|
│ ├── notebooks <- Jupyter notebooks
|
||||||
│ │
|
│ │
|
||||||
│ ├── training_modules <- All modules useful for training deep learning models
|
│ ├── lightning_modules <- PyTorch Lightning related modules
|
||||||
│ │ ├── callbacks.py <- Useful training callbacks
|
│ │ ├── data_modules <- Data related modules
|
||||||
│ │ ├── datasets.py <- PyTorch "Dataset" modules
|
│ │ │ ├── datamodules.py <- "LightningDataModule" modules (wrappers for PyTorch "Dataset")
|
||||||
│ │ ├── datamodules.py <- "LightningDataModule" modules (wrappers for PyTorch "Dataset")
|
│ │ │ ├── datasets.py <- PyTorch "Dataset" modules
|
||||||
│ │ ├── lightning_wrapper.py <- Contains train/val/test step methods executed during training
|
│ │ │ └── transforms.py <- Data transformations (data preprocessing)
|
||||||
│ │ ├── loggers.py <- Initializers for different loggers (wandb, tensorboard, etc.)
|
│ │ │
|
||||||
│ │ ├── models.py <- Neural networks declarations
|
│ │ ├── callbacks.py <- Training callbacks
|
||||||
│ │ └── transforms.py <- Data transformations (data preprocessing)
|
│ │ └── init_utils.py <- Some useful initializers
|
||||||
|
│ │
|
||||||
|
│ ├── models <- All your models should be located here
|
||||||
|
│ │ ├── simple_mnist_classifier <- Example model folder name
|
||||||
|
│ │ │ ├── lightning_module.py <- Contains train/val/test step methods executed during training
|
||||||
|
│ │ │ ├── models.py <- Neural networks declarations
|
||||||
|
│ │ │ ├── predict.py <- Predicting from trained model
|
||||||
|
│ │ │ └── __init__.py
|
||||||
|
│ │ │
|
||||||
|
│ │ ├── ...
|
||||||
|
│ │ └── ...
|
||||||
│ │
|
│ │
|
||||||
│ ├── config.yaml <- Training configuration
|
│ ├── config.yaml <- Training configuration
|
||||||
│ ├── execute_sweep.py <- Special file for executing wandb sweeps (hyperparameter search)
|
│ ├── execute_sweep.py <- Special file for executing wandb sweeps (hyperparameter search)
|
||||||
│ ├── predict.py <- Make predictions with trained model
|
|
||||||
│ └── train.py <- Train model
|
│ └── train.py <- Train model
|
||||||
│
|
│
|
||||||
├── .gitignore
|
├── .gitignore
|
||||||
├── LICENSE
|
├── LICENSE
|
||||||
├── README.md
|
├── README.md
|
||||||
|
├── SETUP.md
|
||||||
|
├── TIPS.md
|
||||||
└── requirements.txt
|
└── requirements.txt
|
||||||
```
|
```
|
||||||
<br>
|
<br>
|
||||||
|
<br>
|
||||||
|
|
||||||
## Config parameters explanation
|
## Config parameters
|
||||||
#### [config.yaml](project/config.yaml):
|
#### [config.yaml](project/config.yaml):
|
||||||
```yaml
|
```yaml
|
||||||
num_of_gpus: -1 <- -1 means use all gpus available on your machine, 0 means train on cpu
|
num_of_gpus: -1
|
||||||
|
|
||||||
hparams: <- you can add any parameters here and then acces them in your network model or datamodule, those parameters are always saved to wandb config
|
model_configs:
|
||||||
max_epochs: 3
|
simple_mnist_classifier_v1:
|
||||||
batch_size: 64
|
model_folder_name: "simple_mnist_classifier"
|
||||||
lr: 0.001
|
max_epochs: 3
|
||||||
weight_decay: 0.000001 <- L2 normalization set in optimizer
|
lr: 0.001
|
||||||
gradient_clip_val: 0.5 <- gradient clipping value (0 means don’t clip), helps with exploding gradient issues
|
batch_size: 64
|
||||||
accumulate_grad_batches: 1 <- perform optimisation after accumulating gradient from n batches
|
weight_decay: 0.000001
|
||||||
|
gradient_clip_val: 0.5
|
||||||
|
accumulate_grad_batches: 1
|
||||||
|
input_size: 784
|
||||||
|
output_size: 10
|
||||||
|
lin1_size: 256
|
||||||
|
lin2_size: 256
|
||||||
|
lin3_size: 128
|
||||||
|
dataset:
|
||||||
|
class_name: "MNISTDataModule"
|
||||||
|
train_transforms: "minst_train_preprocess"
|
||||||
|
test_transforms: "minst_test_preprocess"
|
||||||
|
train_val_split_ratio: 0.8
|
||||||
|
num_workers: 1
|
||||||
|
pin_memory: False
|
||||||
|
|
||||||
resume:
|
transfer_learning_cifar10_classifier_v1:
|
||||||
resume_from_ckpt: False <- set to True if you want to resume
|
...
|
||||||
wandb_run_id: "8uuomodb" <- id of wandb run you want to resume
|
|
||||||
ckpt_path: "epoch=2.ckpt" <- lightning checkpoint path
|
transfer_learning_cifar10_classifier_v2:
|
||||||
|
...
|
||||||
|
|
||||||
|
resume_training:
|
||||||
|
lightning_ckpt:
|
||||||
|
resume_from_ckpt: False
|
||||||
|
ckpt_path: "logs/checkpoints/epoch=2.ckpt"
|
||||||
|
wandb:
|
||||||
|
resume_wandb_run: False
|
||||||
|
wandb_run_id: "8uuomodb"
|
||||||
|
|
||||||
loggers:
|
loggers:
|
||||||
wandb:
|
wandb:
|
||||||
project: "hackathon_template_test" <- wandb project name
|
project: "hackathon_template_test"
|
||||||
team: "kino" <- entity name (your username or team name you belong to)
|
team: "kino"
|
||||||
group: None
|
group: None
|
||||||
job_type: "train"
|
job_type: "train"
|
||||||
tags: []
|
tags: []
|
||||||
log_model: True <- True if you want to automatically upload your model to wandb at the end of training
|
log_model: True
|
||||||
offline: False <- True if you don't want to send any data to wandb server
|
offline: False
|
||||||
|
|
||||||
callbacks:
|
callbacks:
|
||||||
checkpoint:
|
checkpoint:
|
||||||
monitor: "val_acc" <- name of the logged metric that determines when ckpt is saved
|
monitor: "val_acc"
|
||||||
save_top_k: 1 <- save k best models (determined by above metric)
|
save_top_k: 1
|
||||||
save_last: True <- additionaly always save model from last epoch
|
save_last: True
|
||||||
mode: "max" <- determine whether improving means minimizing or maximizing metrics score (alternatively "min")
|
mode: "max"
|
||||||
early_stop:
|
early_stop:
|
||||||
monitor: "val_acc" <- name of the logged metric that determines when training is stopped
|
monitor: "val_acc"
|
||||||
patience: 100 <- for how long metric needs to not improve in order to stop training
|
patience: 100
|
||||||
mode: "max" <- determine whether improving means minimizing or maximizing metrics score (alternatively "min")
|
mode: "max"
|
||||||
|
|
||||||
printing:
|
printing:
|
||||||
progress_bar_refresh_rate: 5 <- refresh rate of training bar in terminal
|
progress_bar_refresh_rate: 5
|
||||||
weights_summary: "top" <- print summary of model an the beginning of the run (alternatively "full")
|
weights_summary: "top"
|
||||||
profiler: False <- True will print mean execution time of all methods at the end of the training
|
profiler: False
|
||||||
|
|
||||||
```
|
```
|
||||||
<br>
|
<br>
|
||||||
|
<br>
|
||||||
|
|
||||||
## Tips
|
## Tips
|
||||||
Read [TIPS.md](TIPS.md)
|
Read [TIPS.md](TIPS.md)
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
num_of_gpus: -1
|
num_of_gpus: -1
|
||||||
|
|
||||||
model_configs:
|
model_configs:
|
||||||
|
|
||||||
simple_mnist_classifier_v1: # everything inside will be saved to to wandb and in model checkpoint
|
simple_mnist_classifier_v1: # everything inside will be saved to to wandb and in model checkpoint
|
||||||
model_folder_name: "simple_mnist_classifier"
|
model_folder_name: "simple_mnist_classifier"
|
||||||
max_epochs: 3
|
max_epochs: 3
|
||||||
|
|||||||
Reference in new issue
Block a user