Improve readme

This commit is contained in:
hobogalaxy committed 2021-01-13 01:15:34 +01:00
1 parent 6b41a44c33
commit 55e5f5e2c4
3 files changed
+19 -17

No files matched your search

+17 -14
View File
@@ -1,26 +1,29 @@
## Deep learning project template ## Deep learning project template
A convenient starting template and pipeline for deep learning projects. Built with <b>PyTorch Lightning</b>, <b>Hydra</b> and <b>Weights&Biases</b>.<br> This is my starting template and pipeline for most deep learning projects.<br>
Click on <b>"Use this template"</b> button above to initialize new repository.<br> Built with <b>PyTorch Lightning</b>, <b>Hydra</b> and <b>Weights&Biases</b>.<br>
Click on <b>`Use this template`</b> button above to initialize new repository.<br>
## Features ## Features
- Predefined folder structure - Predefined folder structure
- Automates training with PyTorch Lightning - you only need to create model and datamodule and specify them in configuration files - Automates training with PyTorch Lightning
- All advantages of Hydra: - You only need to create model and datamodule and specify them in configuration files
- All advantages of Hydra
- Main config file contains default training configuration ([config.yaml](project/configs/config.yaml)) - Main config file contains default training configuration ([config.yaml](project/configs/config.yaml))
- Storing many experiment configurations in a convenient way - experiments override chosen parameters from default training configuration ([configs/experiment](project/configs/experiment)) - Storing many experiment configurations in a convenient way ([configs/experiment](project/configs/experiment))
- Composing configuration files out of other configuration files - Composing configuration files out of other configuration files
- Scheduling execution of many experiments - Scheduling execution of many experiments
- Overriding any config parameter from command line - Overriding any config parameter from command line
- Command line tab completion - Command line tab completion
- Logging history of all executed runs - Logging history of all executed runs/experiments
- Weights&Biases integration: - Weights&Biases integration
- Automatically stores all code files, configs and model checkpoints in Weights&Biases cloud - Available callbacks that store all code files, and model checkpoints as artifacts in Weights&Biases cloud ([wandb_callbacks.py](project/src/callbacks/wandb_callbacks.py))
- Useful callbacks ([wandb_callbacks.py](project/src/callbacks/wandb_callbacks.py)) - Other examples of useful wandb callbacks ([wandb_callbacks.py](project/src/callbacks/wandb_callbacks.py))
- Configuring which hyperparameters are saved by loggers through main config file ([config.yaml](project/configs/config.yaml))
- ~~Hyperparameter search with Weights&Biases sweeps ([execute_sweep.py](project/template_utils/execute_sweep.py))~~ (TODO) - ~~Hyperparameter search with Weights&Biases sweeps ([execute_sweep.py](project/template_utils/execute_sweep.py))~~ (TODO)
- 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))
- Built in package setup ([setup.py](setup.py)) - Built in python package setup ([setup.py](setup.py))
- Example with MNIST digits classification - Example with MNIST digits classification ([mnist_model](project/src/models/simple_mnist_classifier.py), [mnist_datamodule](project/src/datamodules/mnist_datamodule.py))
<br> <br>
@@ -57,7 +60,7 @@ The directory structure of new project looks like this:
│ │ ├── inference_example.py <- Example of inference with trained model │ │ ├── inference_example.py <- Example of inference with trained model
│ │ └── initializers.py <- Initializers for different modules │ │ └── initializers.py <- Initializers for different modules
│ │ │ │
│ └── train.py <- Train model with chosen run configuration │ └── train.py <- Train model with chosen experiment configuration
│ │
├── .gitignore <- Ignored files ├── .gitignore <- Ignored files
├── LICENSE <- Project license ├── LICENSE <- Project license
@@ -195,8 +198,8 @@ Logs are created automatically with the following structure:
## Workflow ## Workflow
1. Create PyTorch Lightning model 1. Create PyTorch Lightning model
2. Create PyTorch Lightning datamodule 2. Create PyTorch Lightning datamodule
3. Create new experiment config in [configs/experiment](project/configs/experiment) 3. Create new experiment config in [configs/experiment](project/configs/experiment) folder
4. Run training with chosen run config<br> 4. Run training with chosen experiment config<br>
```bash ```bash
python train.py +experiment=experiment_name.yaml python train.py +experiment=experiment_name.yaml
``` ```
+2 -2
View File
@@ -1,8 +1,8 @@
# @package _group_ # @package _group_
# Train with all logger at once # Train with many loggers at once
defaults: defaults:
- csv_logger.yaml - csv_logger.yaml
- wandb.yaml - wandb.yaml
# - comet.yaml # - comet.yaml
# - tensorboard.yaml # - tensorboard.yaml
-1
View File
@@ -16,7 +16,6 @@ import src.utils.initializers as utils
def train(config): def train(config):
# Set global PyTorch seed # Set global PyTorch seed
if "seeds" in config and "pytorch_seed" in config["seeds"]: if "seeds" in config and "pytorch_seed" in config["seeds"]:
torch.manual_seed(seed=config["seeds"]["pytorch_seed"]) torch.manual_seed(seed=config["seeds"]["pytorch_seed"])