Better code highlighting in README

This commit is contained in:
Lucas authored and GitHub committed 2021-01-26 18:13:39 +01:00
1 parent 513dbee887
commit 3002778f68
1 file changed
+13 -12
+13 -12
View File
@@ -1,4 +1,4 @@
## Deep learning project template ## Lightning + Hydra template for Deep Learning projects
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> and <b>Hydra</b>.<br> Built with <b>PyTorch Lightning</b> and <b>Hydra</b>.<br>
Also contains special <b>Weights&Biases</b> integration, but can be used with any other logger.<br> Also contains special <b>Weights&Biases</b> integration, but can be used with any other logger.<br>
@@ -278,7 +278,7 @@ What it does
## How to run ## How to run
First, install dependencies: First, install dependencies:
```bash ```yaml
# clone project # clone project
git clone https://github.com/YourGithubName/your-repo-name git clone https://github.com/YourGithubName/your-repo-name
cd your-repo-name cd your-repo-name
@@ -293,7 +293,7 @@ pip install -r requirements.txt
``` ```
Next, you can train model with default configuration without logging: Next, you can train model with default configuration without logging:
```bash ```yaml
cd project cd project
python train.py python train.py
``` ```
@@ -305,46 +305,47 @@ wandb:
project: "your_project_name" project: "your_project_name"
entity: "your_wandb_team_name" entity: "your_wandb_team_name"
``` ```
```bash
```yaml
# train model with Weights&Biases # train model with Weights&Biases
python train.py logger=wandb python train.py logger=wandb
``` ```
Or you can train model with chosen experiment config: Or you can train model with chosen experiment config:
```bash ```yaml
# experiment configurations are placed in 'project/configs/experiment' folder # experiment configurations are placed in 'project/configs/experiment' folder
python train.py +experiment=exp_example_simple python train.py +experiment=exp_example_simple
``` ```
To execute all experiments from folder run: To execute all experiments from folder run:
```bash ```yaml
# execute all experiments from folder `project/configs/experiment` # execute all experiments from folder `project/configs/experiment`
python train.py --multirun '+experiment=glob(*)' python train.py --multirun '+experiment=glob(*)'
``` ```
You can override any parameter from command line like this: You can override any parameter from command line like this:
```bash ```yaml
python train.py trainer.max_epochs=20 model.lr=0.0005 python train.py trainer.max_epochs=20 model.lr=0.0005
``` ```
To train on GPU: To train on GPU:
```bash ```yaml
python train.py trainer.gpus=1 python train.py trainer.gpus=1
``` ```
Attach some callback set to run: Attach some callback set to run:
```bash ```yaml
# callback sets configurations are placed in 'project/configs/callbacks' folder # callback sets configurations are placed in 'project/configs/callbacks' folder
python train.py callbacks=default_callbacks python train.py callbacks=default_callbacks
``` ```
Combaining it all: Combaining it all:
```bash ```yaml
python train.py --multirun '+experiment=glob(*)' trainer.max_epochs=10 logger=wandb python train.py --multirun '+experiment=glob(*)' trainer.max_epochs=10 logger=wandb
``` ```
To create a sweep over some hyperparameters run: To create a sweep over some hyperparameters run:
```bash ```yaml
# this will run 6 experiments one after the other, # this will run 6 experiments one after the other,
# each with different combination of batch_size and learning rate # each with different combination of batch_size and learning rate
python train.py --multirun datamodule.batch_size=32,64,128 model.lr=0.001,0.0005 python train.py --multirun datamodule.batch_size=32,64,128 model.lr=0.001,0.0005
@@ -352,7 +353,7 @@ python train.py --multirun datamodule.batch_size=32,64,128 model.lr=0.001,0.0005
## Import ## Import
Optionally you can install project as a package with [setup.py](setup.py): Optionally you can install project as a package with [setup.py](setup.py):
```bash ```yaml
pip install -e . pip install -e .
``` ```
So you can easily import any file into any other file like so: So you can easily import any file into any other file like so: