The structure of this template is heavily influenced by Cookiecutter Data Science and Lightning-Hydra-Template.
What it does
Install dependencies
# clone project
git clone https://github.com/YourGithubName/your-repo-name
cd your-repo-name
# [OPTIONAL] create conda environment
conda create -n myenv python=3.9
conda activate myenv
# install pytorch according to instructions
# https://pytorch.org/get-started/
# install requirements
pip install -r requirements.txt
Train model with default configuration
# train on CPU
python src/train.py trainer=cpu
# train on GPU
python src/train.py trainer=gpu
Train model with chosen experiment configuration from configs/experiment/
python src/train.py experiment=experiment_name.yaml
You can override any parameter from command line like this
python src/train.py trainer.max_epochs=20 data.batch_size=64
The directory structure of new project looks like this:
├── configs <- Configuration files
│
├── data <- Project data
│ ├── external <- Data from third party sources.
│ ├── interim <- Intermediate data that has been transformed.
│ ├── processed <- The final, canonical data sets for modeling.
│ └── raw <- The original, immutable data dump.
│
├── logs <- Logs generated by lightning loggers
│
├── notebooks <- Jupyter notebooks. Naming convention is a number (for ordering),
│ the creator's initials, and a short `-` delimited description,
│ e.g. `1.0-jqp-initial-data-exploration.ipynb`.
│
├── results <- Experiment results to report
│ ├── figures <- Figures
│ └── outputs <- Model outputs or tables
│
├── src <- Source code
│ ├── data_analysis <- Code for running data analysis experiments (EDA, regressions, visualization)
│ ├── data_preprocessing <- Code for preprocessing data (data collection & processing)
│ ├── ml_experiments <- Code for running ML experiments (training, testing, inference)
│ │ ├── data <- Modules for data loaders
│ │ ├── models <- Modules for model classes
│ │ ├── infer.py <- Run inference
│ │ ├── eval.py <- Run evaluation
│ │ └── train.py <- Run training
│ │
│ ├── visualization <- Code for visualizing end results
│ │
│ └── utils <- Utility scripts
│
├── tests <- Tests of any kind
│
├── .env.example <- Example of file for storing private environment variables
├── .gitignore <- List of files ignored by git
├── Makefile <- Makefile with commands like `make train` or `make test`
├── requirements.txt <- File for installing python dependencies
├── setup.py <- File for installing project as a package
└── README.md