another refactor
This commit is contained in:
1 parent
55e5f5e2c4
commit
f2e242534e
7 files changed
+16
-10
No files matched your search
@@ -1,6 +1,12 @@
|
|||||||
## 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>
|
||||||
|
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
|
||||||
|
- extend functionality of popular experiment loggers like Weights&Biases
|
||||||
|
|
||||||
Click on <b>`Use this template`</b> button above to initialize new repository.<br>
|
Click on <b>`Use this template`</b> button above to initialize new repository.<br>
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
@@ -16,14 +22,14 @@ Click on <b>`Use this template`</b> button above to initialize new repository.<b
|
|||||||
- Command line tab completion
|
- Command line tab completion
|
||||||
- Logging history of all executed runs/experiments
|
- Logging history of all executed runs/experiments
|
||||||
- Weights&Biases integration
|
- Weights&Biases integration
|
||||||
- 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))
|
- 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))
|
||||||
- Other examples of useful wandb 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))
|
- 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 python package setup ([setup.py](setup.py))
|
- Built in python package setup ([setup.py](setup.py))
|
||||||
- Example with MNIST digits classification ([mnist_model](project/src/models/simple_mnist_classifier.py), [mnist_datamodule](project/src/datamodules/mnist_datamodule.py))
|
- Example with MNIST digits classification ([mnist_model](project/src/models/mnist_model.py), [mnist_datamodule](project/src/datamodules/mnist_datamodule.py))
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|
||||||
@@ -77,7 +83,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: simple_mnist_classifier.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
|
||||||
@@ -121,7 +127,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: simple_mnist_classifier.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/'
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
- trainer: default_trainer.yaml
|
- trainer: default_trainer.yaml
|
||||||
- model: simple_mnist_classifier.yaml
|
- model: mnist_model.yaml
|
||||||
- datamodule: mnist_datamodule.yaml
|
- datamodule: mnist_datamodule.yaml
|
||||||
- optimizer: adam.yaml
|
- optimizer: adam.yaml
|
||||||
- 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
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
- override /trainer: default_trainer.yaml # choose trainer from 'configs/trainer/' folder
|
- override /trainer: default_trainer.yaml # choose trainer from 'configs/trainer/' folder
|
||||||
- override /model: simple_mnist_classifier.yaml # choose model from 'configs/model/' folder
|
- override /model: mnist_model.yaml # choose model from 'configs/model/' folder
|
||||||
- override /datamodule: mnist_datamodule.yaml # choose datamodule from 'configs/datamodule/' folder
|
- override /datamodule: mnist_datamodule.yaml # choose datamodule from 'configs/datamodule/' folder
|
||||||
- override /optimizer: adam.yaml # choose optimizer from 'configs/optimizer/' folder
|
- override /optimizer: adam.yaml # choose optimizer from 'configs/optimizer/' folder
|
||||||
- override /seeds: default_seeds.yaml # choose seeds from 'configs/seeds/' folder
|
- override /seeds: default_seeds.yaml # choose seeds from 'configs/seeds/' folder
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
- override /trainer: default_trainer.yaml # choose trainer from 'configs/trainer/' folder
|
- override /trainer: default_trainer.yaml # choose trainer from 'configs/trainer/' folder
|
||||||
- override /model: simple_mnist_classifier.yaml # choose model from 'configs/model/' folder
|
- override /model: mnist_model.yaml # choose model from 'configs/model/' folder
|
||||||
- override /datamodule: mnist_datamodule.yaml # choose datamodule from 'configs/datamodule/' folder
|
- override /datamodule: mnist_datamodule.yaml # choose datamodule from 'configs/datamodule/' folder
|
||||||
- override /optimizer: adam.yaml # choose optimizer from 'configs/optimizer/' folder
|
- override /optimizer: adam.yaml # choose optimizer from 'configs/optimizer/' folder
|
||||||
- override /seeds: default_seeds.yaml # choose seeds from 'configs/seeds/' folder
|
- override /seeds: default_seeds.yaml # choose seeds from 'configs/seeds/' folder
|
||||||
|
|||||||
File renamed without changes.
File renamed without changes.
@@ -2,7 +2,7 @@ from src.transforms import mnist_transforms
|
|||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
# the LitModel you import should be the same as the one you used for training!
|
# the LitModel you import should be the same as the one you used for training!
|
||||||
from src.models.simple_mnist_classifier import LitModel
|
from src.models.mnist_model import LitModel
|
||||||
|
|
||||||
# ckpt can be a url!
|
# ckpt can be a url!
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ def predict():
|
|||||||
This method is example of inference with a trained model.
|
This method is example of inference with a trained model.
|
||||||
It Loads trained image classification model from checkpoint.
|
It Loads trained image classification model from checkpoint.
|
||||||
Then it loads example image and predicts its label.
|
Then it loads example image and predicts its label.
|
||||||
Model used in simple_mnist_classifier.py should be the same as during training!!!
|
Model used in mnist_model.py should be the same as during training!!!
|
||||||
"""
|
"""
|
||||||
|
|
||||||
CKPT_PATH = "epoch=0.ckpt"
|
CKPT_PATH = "epoch=0.ckpt"
|
||||||
|
|||||||
Reference in new issue
Block a user