split readme into several files
This commit is contained in:
1 parent
50872fd3c6
commit
ea525da14a
5 files changed
+101
-97
No files matched your search
@@ -2,6 +2,10 @@
|
||||
A convenient starting template for most deep learning projects. Built with PyTorch Lightning and Weights&Biases (wandb).
|
||||
|
||||
|
||||
## Setup
|
||||
Read [SETUP.md](SETUP.md)
|
||||
|
||||
|
||||
## Project structure
|
||||
The directory structure of new project looks like this:
|
||||
```
|
||||
@@ -34,72 +38,9 @@ The directory structure of new project looks like this:
|
||||
└── requirements.txt
|
||||
```
|
||||
|
||||
## Setup
|
||||
|
||||
#### 1. Install anaconda
|
||||
https://docs.conda.io/projects/conda/en/latest/user-guide/install/download.html
|
||||
|
||||
#### 2. Create anaconda env
|
||||
```
|
||||
conda create --name hack_env
|
||||
conda activate hack_env
|
||||
```
|
||||
|
||||
#### 3. Make sure proper python PATH is loaded
|
||||
Unix
|
||||
```
|
||||
which python
|
||||
```
|
||||
Windows
|
||||
```
|
||||
for %i in (python.exe) do @echo. %~$PATH:i
|
||||
```
|
||||
Expected result: `PATH_TO_CONDA/envs/ENV_NAME/bin/python`
|
||||
|
||||
#### 4. Install pytorch with conda
|
||||
Installation command generator: https://pytorch.org/get-started/locally/
|
||||
```
|
||||
conda install pytorch torchvision torchaudio cudatoolkit=11.0 -c pytorch
|
||||
```
|
||||
|
||||
#### 5. Clone repo
|
||||
```
|
||||
git clone https://github.com/kinoai/hackathon-template
|
||||
```
|
||||
|
||||
#### 6. Install requirements with pip
|
||||
```
|
||||
cd hackathon-template
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
#### 7. Log into your wandb account
|
||||
```
|
||||
wandb login
|
||||
```
|
||||
|
||||
#### 8. PyCharm setup
|
||||
- open this repository as PyCharm project
|
||||
- set "hack_env" as project interpreter:<br>
|
||||
`Ctrl + Shift + A -> type "Project Interpreter"`
|
||||
- mark folder "project" as sources root:<br>
|
||||
`right click on directory -> "Mark Directory as" -> "Sources Root"`
|
||||
- set terminal emulation:<br>
|
||||
`Ctrl + Shift + A -> type "Edit Configurations..." -> select "Emulate terminal in output console"`
|
||||
- run training:<br>
|
||||
`right click on train.py file -> "Run 'train'"`
|
||||
|
||||
|
||||
|
||||
#### Important notes!
|
||||
- If you are not using GPU (CUDA incompatible GPU) you may need to specify the number of GPUs manually instead of leaving the default `-1` in `config.yaml`:
|
||||
```
|
||||
num_of_gpus: 0
|
||||
```
|
||||
<br>
|
||||
|
||||
|
||||
## [config.yaml](project/config.yaml) parameters explanation:
|
||||
## Config parameters explanation
|
||||
#### [config.yaml](project/config.yaml):
|
||||
```yaml
|
||||
num_of_gpus: -1 <- -1 means use all gpus available on your machine, 0 means train on cpu
|
||||
|
||||
@@ -143,32 +84,7 @@ printing:
|
||||
profiler: False <- True will print mean execution time of all methods at the end of the training
|
||||
|
||||
```
|
||||
<br>
|
||||
|
||||
|
||||
## Useful tips
|
||||
- PyTorch Lightning Bolts is official collection of prebuilt models across many research domains:
|
||||
- https://pytorch-lightning.readthedocs.io/en/latest/bolts.html
|
||||
- https://github.com/PyTorchLightning/pytorch-lightning-bolts
|
||||
|
||||
- Pre-trained pytorch model repository designed for research exploration:
|
||||
- https://pytorch.org/hub/
|
||||
|
||||
- List of all tools in PyTorch ecosystem:
|
||||
- https://pytorch.org/ecosystem/
|
||||
|
||||
- Additional pl.Trainer() parameters which can be useful:
|
||||
- <b>accumulate_grad_batches=5</b> - perform optimisation after accumulating gradient from 5 batches
|
||||
- <b>accumulate_grad_batches={5: 3, 10: 20}</b> - no accumulation for epochs 1-4. accumulate 3 for epochs 5-10. accumulate 20 after that
|
||||
- <b>auto_scale_batch_size='power'</b> - automatically find the largest batch size that fits into memory and is power of 2 (requires calling trainer.tune(model, datamodule))
|
||||
- <b>check_val_every_n_epoch=10</b> - run validation loop every 10 training epochs
|
||||
- <b>val_check_interval=0.25</b> - check validation set 4 times during a training epoch
|
||||
- <b>fast_dev_run=True</b> - runs 1 train, val, test batch and program ends (great for debugging)
|
||||
- <b>min_epochs=1</b> - force training for at least these many epochs
|
||||
- <b>overfit_batches=0.01</b> - use only 1% of the train set (and use the train set for val and test)
|
||||
- <b>overfit_batches=10</b> - use only 10 batches of the train set (and use the train set for val and test)
|
||||
- <b>limit_train_batches=0.25</b> - run through only 25% of the training set each epoch
|
||||
- <b>limit_val_batches=0.25</b>
|
||||
- <b>limit_test_batches=0.25</b>
|
||||
- <b>precision=16</b> - set tensor precision (default is 32 bits)
|
||||
- <b>amp_backend='apex'</b> - apex backend for mixed precision training https://github.com/NVIDIA/apex
|
||||
## Tips
|
||||
See [USEFUL_TIPS.md](USEFUL_TIPS.md)
|
||||
@@ -0,0 +1,62 @@
|
||||
## Setup
|
||||
|
||||
#### 1. Install anaconda
|
||||
https://docs.conda.io/projects/conda/en/latest/user-guide/install/download.html
|
||||
|
||||
#### 2. Create anaconda env
|
||||
```
|
||||
conda create --name hack_env
|
||||
conda activate hack_env
|
||||
```
|
||||
|
||||
#### 3. Make sure proper python PATH is loaded
|
||||
Unix
|
||||
```
|
||||
which python
|
||||
```
|
||||
Windows
|
||||
```
|
||||
for %i in (python.exe) do @echo. %~$PATH:i
|
||||
```
|
||||
Expected result: `PATH_TO_CONDA/envs/ENV_NAME/bin/python`
|
||||
|
||||
#### 4. Install pytorch with conda
|
||||
Installation command generator: https://pytorch.org/get-started/locally/
|
||||
```
|
||||
conda install pytorch torchvision torchaudio cudatoolkit=11.0 -c pytorch
|
||||
```
|
||||
|
||||
#### 5. Clone repo
|
||||
```
|
||||
git clone https://github.com/kinoai/hackathon-template
|
||||
```
|
||||
|
||||
#### 6. Install requirements with pip
|
||||
```
|
||||
cd hackathon-template
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
#### 7. Log into your wandb account
|
||||
```
|
||||
wandb login
|
||||
```
|
||||
|
||||
#### 8. PyCharm setup
|
||||
- open this repository as PyCharm project
|
||||
- set "hack_env" as project interpreter:<br>
|
||||
`Ctrl + Shift + A -> type "Project Interpreter"`
|
||||
- mark folder "project" as sources root:<br>
|
||||
`right click on directory -> "Mark Directory as" -> "Sources Root"`
|
||||
- set terminal emulation:<br>
|
||||
`Ctrl + Shift + A -> type "Edit Configurations..." -> select "Emulate terminal in output console"`
|
||||
- run training:<br>
|
||||
`right click on train.py file -> "Run 'train'"`
|
||||
|
||||
|
||||
|
||||
#### Important notes!
|
||||
- If you are not using GPU (CUDA incompatible GPU) you may need to specify the number of GPUs manually instead of leaving the default `-1` in `config.yaml`:
|
||||
```
|
||||
num_of_gpus: 0
|
||||
```
|
||||
@@ -0,0 +1,26 @@
|
||||
## Tips
|
||||
- PyTorch Lightning Bolts is official collection of prebuilt models across many research domains:
|
||||
- https://pytorch-lightning.readthedocs.io/en/latest/bolts.html
|
||||
- https://github.com/PyTorchLightning/pytorch-lightning-bolts
|
||||
|
||||
- Pre-trained pytorch model repository designed for research exploration:
|
||||
- https://pytorch.org/hub/
|
||||
|
||||
- List of all tools in PyTorch ecosystem:
|
||||
- https://pytorch.org/ecosystem/
|
||||
|
||||
- Additional pl.Trainer() parameters which can be useful:
|
||||
- <b>accumulate_grad_batches=5</b> - perform optimisation after accumulating gradient from 5 batches
|
||||
- <b>accumulate_grad_batches={5: 3, 10: 20}</b> - no accumulation for epochs 1-4. accumulate 3 for epochs 5-10. accumulate 20 after that
|
||||
- <b>auto_scale_batch_size='power'</b> - automatically find the largest batch size that fits into memory and is power of 2 (requires calling trainer.tune(model, datamodule))
|
||||
- <b>check_val_every_n_epoch=10</b> - run validation loop every 10 training epochs
|
||||
- <b>val_check_interval=0.25</b> - check validation set 4 times during a training epoch
|
||||
- <b>fast_dev_run=True</b> - runs 1 train, val, test batch and program ends (great for debugging)
|
||||
- <b>min_epochs=1</b> - force training for at least these many epochs
|
||||
- <b>overfit_batches=0.01</b> - use only 1% of the train set (and use the train set for val and test)
|
||||
- <b>overfit_batches=10</b> - use only 10 batches of the train set (and use the train set for val and test)
|
||||
- <b>limit_train_batches=0.25</b> - run through only 25% of the training set each epoch
|
||||
- <b>limit_val_batches=0.25</b>
|
||||
- <b>limit_test_batches=0.25</b>
|
||||
- <b>precision=16</b> - set tensor precision (default is 32 bits)
|
||||
- <b>amp_backend='apex'</b> - apex backend for mixed precision training https://github.com/NVIDIA/apex
|
||||
+4
-4
@@ -18,8 +18,8 @@ models:
|
||||
MNISTDataModule:
|
||||
batch_size: 64
|
||||
train_val_split_ratio: 0.9
|
||||
num_workers: 4
|
||||
pin_memory: True
|
||||
num_workers: 1
|
||||
pin_memory: False
|
||||
|
||||
transfer_learning_cifar10_classifier:
|
||||
hparams:
|
||||
@@ -35,8 +35,8 @@ models:
|
||||
CIFAR10DataModule:
|
||||
batch_size: 64
|
||||
train_val_split_ratio: 0.9
|
||||
num_workers: 4
|
||||
pin_memory: True
|
||||
num_workers: 1
|
||||
pin_memory: False
|
||||
|
||||
|
||||
resume_training:
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ def train(config):
|
||||
# Init model
|
||||
lit_model = MODEL.LitModel(hparams=MODEL_PARAMS)
|
||||
|
||||
# Init dataset
|
||||
# Init data
|
||||
datamodule = DATASET(**DATASET_PARAMS)
|
||||
datamodule.prepare_data()
|
||||
datamodule.setup()
|
||||
|
||||
Reference in new issue
Block a user