Skip to content

mfaulk/deep_learning_examples

Repository files navigation

Deep Learning Examples

Deep Learning Examples with PyTorch.

Examples

  1. MNIST PCA: Principal Component Analysis of MNIST dataset,
  2. MNIST Autoencoder: Autoencoder,
  3. MNIST Autoencoder Cross Validation: Model selection via cross-validation,
  4. MNIST Convolutional NN: Convolutional neural network for the MNIST dataset,
  5. MNIST VAE: Variational Autoencoder,

Tools

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

Setup

CUDA: GPU Support

  1. CUDA-Compatible GPU: Check the CUDA-enabled products list to see if your GPU is supported.

  2. NVIDIA Drivers: Install the latest drivers for your GPU from the NVIDIA website.

  3. CUDA Toolkit: Download and install the CUDA Toolkit. The version of the CUDA Toolkit should match the version of the cuDNN library.

  4. cuDNN Library: GPU-accelerated primitives for deep neural networks. Download and install the cuDNN library.

Install Dependencies

Install Poetry (if you haven't already) and install the project dependencies:

curl -sSL https://install.python-poetry.org | python3 -
poetry install

Usage

To run an example, e.g. the MNIST Autoencoder, use a command like:

poetry run python -m examples.mnist_autoencoder

Jupyter Notebooks

To start Jupyter and run a notebook, use the following command:

poetry run jupyter notebook --notebook-dir ./notebooks

Testing

To run the tests with coverage (and, optionally, with mypy) use:

poetry run pytest
poetry run pytest --mypy

MyPy

Static type checking with MyPy:

poetry run mypy src tests

Ruff

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

About

Deep Learning Examples with PyTorch

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published