ai_repoΒΆ
ExamplesΒΆ
π’ MNIST classification with a MLP
python projects/classify_mnist/train.py task=mlp
π€Έ Acrobot score optimization with neuroevolution
python -m projects.ne_control_score task=acrobot
Table of ContentsΒΆ
I. IntroductionΒΆ
This repo aims to:
Reduce code & configuration boilerplate with:
Hydra for task configuration.
Simplify machine learning workflows:
Hyperparameter optimization with AutoRL-Sweepers & Optuna.
SLURM job definition, queuing and monitoring with Submitit through its Hydra Launcher plugin.
Docker / Apptainer environment containerization for both regular & SLURM-based execution.
Transition from regular execution to SLURM-based execution by only swapping container technology and as little as a single Hydra configuration field.
Automate workspace & coding processes:
Package upgrades through Renovate.
Docstring documentation generation with Sphinx.
Pre-commit formatting & linting hooks with pre-commit.
Documentation/Docker image validation/deployment, formatting, linting, type-checking & unit tests upon contribution to the
main
branch using GitHub Actions.
Facilitate collaboration through:
An object-oriented structure for code sharing & reusability.
A mono-repository workspace with task/experiment-specific subdirectories.
A very informative & clear to navigate Python API reference thanks to Autodoc and plugins like sphinx-autodoc-typehints and sphinx-paramlinks.
Shared logging with Weights & Biases.
Promote high-quality and reproducible code by:
Linting with Ruff, formatting with Black, unit-testing with pytest.
DType & Shape type hinting for PyTorch tensors using jaxtyping & NumPy arrays using nptyping. Fully type checkable at runtime with Beartype.
Providing a common Development Container recipe with the above features enabled + documentation preview with esbonio.
Smoothen up rough edges by providing:
Extensive documentation on how to install/execute on regular & SLURM-based systems.
Unassuming guides on how to contribute to the codebase.
Tutorials on how to facilitate code transport across machines.
II. OverviewΒΆ
ServiceΒΆ
π OverviewΒΆ
A service
refers to a Python package located at
common/SERVICE_NAME/
. Each service
is meant to sketch out a form of
execution.
π ExamplesΒΆ
EngineΒΆ
π OverviewΒΆ
An engine
refers to a Python package located at
common/SERVICE_NAME/ENGINE_NAME
. Each engine
is meant to drive a
specific type of execution.
π ExamplesΒΆ
ProjectΒΆ
π OverviewΒΆ
A project
refers to a Python package located at projects/PROJECT_NAME/
.
π ExamplesΒΆ
TaskΒΆ
π OverviewΒΆ
A task
is a work unit specified by a Hydra .yaml
config file located in projects/PROJECT_NAME/task/TASK_NAME.yaml
.
π ExamplesΒΆ
SubtaskΒΆ
A subtask
is a sub-work unit of a task
(ex: a model training run
with a specific set of hyper-parameters).
Rough repository treeΒΆ
ai_repo/
ββ .github/ <-- Config files for GitHub Actions (tests, containers, etc)
ββ common/ <-- Code common to various `projects`
β ββ infer/ <-- Model inference
β β ββ lightning/ <-- Inference from Lightning checkpoints
β ββ optim/ <-- Model optimization
β ββ dl/ <-- Deep Learning
β β ββ datamodule/ <-- Lightning DataModules
β β ββ litmodule/ <-- Lightning Modules
β β β ββ nnmodule/ <-- PyTorch Modules
β β ββ train.py
β ββ ne/ <-- Neuroevolution
β ββ agent/
β ββ net/
β ββ space/ <-- Where agents evolve
β ββ evolve.py
ββ docs/ <-- Documentation
ββ projects/ <-- Contains all existing projects
β
β ******************************************
ββ my_new_dl_project/ <-- ******** Your new project folder *********
ββ task/ <-- *********** Your task folder *************
β ββ config.yaml <-- ****** Your task configuration file ******
ββ __main__.py <-- ************ Your entry-point ************
ββ datamodule.py <-- ******* Your Lightning DataModule ********
ββ litmodule.py <-- ********* Your Lightning Module **********
ββ nnmodule.py <-- ********** Your PyTorch Module ***********
******************************************