Update README.md

This commit is contained in:
hobogalaxy authored and GitHub committed 2020-12-01 20:35:55 +01:00
1 parent e86b83bb55
commit 10fbd62ca7
1 file changed
+15 -15
+15 -15
View File
@@ -1,18 +1,19 @@
## Deep learning project template ## Deep learning project template
A convenient starting template for most deep learning projects. Built with <b>PyTorch Lightning</b> and <b>Weights&Biases</b>.<br> A convenient starting template for most deep learning projects. Built with <b>PyTorch Lightning</b> and <b>Weights&Biases</b>.<br>
Click on <i>"Use this template"</i> button above to initialize new repository.<br> Click on <b>"Use this template"</b> button above to initialize new repository.<br>
## Features ## Features
- All advantages of Pytorch Lightning
- Predefined folder structure - Predefined folder structure
- Storing project configuration in a convenient way ([project_config.yaml](project/project_config.yaml)) - Storing project configuration in a convenient way ([project_config.yaml](project/project_config.yaml))
- Storing many run configurations in a convenient way ([run_configs.yaml](project/run_configs.yaml)) - Storing many run configurations in a convenient way ([run_configs.yaml](project/run_configs.yaml))
- All advanteges of Pytorch Lightning - Automates the whole training process and initialization, you only need to create `model` and `datamodule` classes and specify them in [run_configs.yaml](project/run_configs.yaml)
- Automates initialization of your model and datamodule - Automatically stores all relevant code, configs and model checkpoints in Weights&Biases cloud
- Automatically stores code, configurations and model checkpoints in Weights&Biases runs
- Hyperparameter search with Weights&Biases sweeps ([execute_sweep.py](project/utils/execute_sweep.py)) - Hyperparameter search with Weights&Biases sweeps ([execute_sweep.py](project/utils/execute_sweep.py))
- Built in requirements ([requirements.txt](requirements.txt)) - Built in requirements ([requirements.txt](requirements.txt))
- Built in conda environment initialization ([conda_env.yaml](conda_env.yaml)) - Built in conda environment initialization ([conda_env.yaml](conda_env.yaml))
- Example with MNIST digits classfication - Example with MNIST digits classification
- Useful example callbacks ([callbacks.py](project/utils/callbacks.py))
<br> <br>
@@ -68,7 +69,7 @@ num_of_gpus: -1 <- '-1' to use all gpus available, '0' to train on c
loggers: loggers:
wandb: wandb:
project: "project_name" <- wandb project name project: "project_name" <- wandb project name
team: "kino" <- wandb entity name entity: "some_name" <- wandb entity name
log_model: True <- set True if you want to upload ckpts to wandb automatically log_model: True <- set True if you want to upload ckpts to wandb automatically
offline: False <- set True if you want to store all data locally offline: False <- set True if you want to store all data locally
@@ -118,7 +119,7 @@ MNIST_CLASSIFIER_V1:
pin_memory: False pin_memory: False
wandb: <- this section is optional and can be removed wandb: <- this section is optional and can be removed
group: "" group: ""
tags: ["v2", "uwu"] tags: ["v1", "uwu"]
resume_training: <- this section is optional and can be removed if you don't want to resume training resume_training: <- this section is optional and can be removed if you don't want to resume training
checkpoint_path: "path_to_checkpoint/last.ckpt" <- path to checkpoint checkpoint_path: "path_to_checkpoint/last.ckpt" <- path to checkpoint
wandb_run_id: None <- you can set id of Weights&Biases run that you want to resume but it's optional wandb_run_id: None <- you can set id of Weights&Biases run that you want to resume but it's optional
@@ -127,19 +128,19 @@ MNIST_CLASSIFIER_V1:
## Workflow ## Workflow
1. Add your model to `project/models` folder<br> 1. Add your model to `project/models` folder.<br>
(you need to create folder with `lightning_module.py` file containing `LitModel` class) You need to create folder with `lightning_module.py` file containing `LitModel` class
2. Add your datamodule to `project/data_modules` folder<br> 2. Add your datamodule to `project/data_modules` folder.<br>
(you need to create folder with `datamodule.py` file containig `DataModule` class) You need to create folder with `datamodule.py` file containing `DataModule` class
3. Add your run config to [run_configs.yaml](project/run_configs.yaml) (specify there folders containing your model and datamodule) 3. Add your run config to [run_configs.yaml](project/run_configs.yaml) (specify there folders containing your model and datamodule)
3. Configure [project_config.yaml](project/project_config.yaml) 3. Configure [project_config.yaml](project/project_config.yaml)
4. Run training:<br> 4. Run training:<br>
Either pass run config name as an argument: Either pass run config name as an argument
``` ```
python train.py -r MNIST_CLASSIFIER_V1 python train.py -r MNIST_CLASSIFIER_V1
python train.py --run_conf_name MNIST_CLASSIFIER_V1 python train.py --run_conf_name MNIST_CLASSIFIER_V1
``` ```
Or modify default run config name in [train.py](project/train.py): Or modify default run config name in [train.py](project/train.py)
```python ```python
if __name__ == "__main__": if __name__ == "__main__":
parser = ArgumentParser() parser = ArgumentParser()
@@ -210,6 +211,5 @@ wandb login
cd project cd project
python train.py --use_wandb=True --run_conf_name MNIST_CLASSIFIER_V1 python train.py --use_wandb=True --run_conf_name MNIST_CLASSIFIER_V1
``` ```
All run configurations are located in [run_configs.yaml](project/run_configs.yaml).<br> All run configurations are located in [run_configs.yaml](project/run_configs.yaml).
For PyCharm setup read [SETUP.md](SETUP.md). For PyCharm setup read [SETUP.md](SETUP.md).