Deep Learning Examples with PyTorch.
- MNIST PCA: Principal Component Analysis of MNIST dataset,
- MNIST Autoencoder: Autoencoder,
- MNIST Autoencoder Cross Validation: Model selection via cross-validation,
- MNIST Convolutional NN: Convolutional neural network for the MNIST dataset,
- MNIST VAE: Variational Autoencoder,
This project uses several tools for code quality, testing, and documentation:
- Poetry: Manages dependencies and virtual environments for consistent builds and setup
- PyTorch: The core deep learning library
- mypy: Static type checking
- Ruff: Fast and comprehensive linter
- pytest: Flexible framework for unit testing
- Coverage.py: Measures code coverage
- Jupyter Notebook: Interactive development for experimenting and prototyping
-
CUDA-Compatible GPU: Check the CUDA-enabled products list to see if your GPU is supported.
-
NVIDIA Drivers: Install the latest drivers for your GPU from the NVIDIA website.
-
CUDA Toolkit: Download and install the CUDA Toolkit. The version of the CUDA Toolkit should match the version of the cuDNN library.
-
cuDNN Library: GPU-accelerated primitives for deep neural networks. Download and install the cuDNN library.
Install Poetry (if you haven't already) and install the project dependencies:
curl -sSL https://install.python-poetry.org | python3 -
poetry install
To run an example, e.g. the MNIST Autoencoder, use a command like:
poetry run python -m examples.mnist_autoencoder
To start Jupyter and run a notebook, use the following command:
poetry run jupyter notebook --notebook-dir ./notebooks
To run the tests with coverage (and, optionally, with mypy) use:
poetry run pytest
poetry run pytest --mypy
Static type checking with MyPy:
poetry run mypy src tests
Checks the codebase (minus notebooks) for linting issues. Add --fix
to automatically fix some issues.
poetry run ruff check src tests
poetry run ruff check src tests --fix
Format the codebase:
poetry run ruff format src tests