COMP6248 Differentiable Programming (and Deep Learning)

2021-22


Maintained by Dr Kate Farrahi & Dr Jonathon Hare.

Lab 8 - Autoencoders and generative modelling

Kate Farrahi, 29th April 2019

Change History

  • 20190429: Initial version
  • 20200126: Minor updates for the 1920 AY

Introduction

In this lab you’ll explore Auto-Encoder architectures.

Through this lab you’ll learn how to:

  • How to build a simple auto-encoder
  • How to build robustness by training a denoising auto-encoder
  • How to build a variational auto-encoder

Getting started

To work through this lab you’ll use the Python 3 language in a Jupyter Notebook environment, with the pytorch tensor library, the torchvision utility library and the torchbearer model training library. We’ll also use the matplotlib, scikit-learn and numpy packages. We will primarily be using Google Colab to run the notebooks as this gives you access to an environment with all the tools required. If you wish to run the notebooks locally, see the information in the section below.

The following is a list of the notebooks for this lab, with links to open directly in Google Colab (once opened you should immediately save a copy in your Google Drive otherwise anything you do will be lost once the browser closes), or to download locally. You should work through the notebooks in numeric order as they follow on from each other.

8.1 Auto-Encoder Open In Colab preview download
8.2 Denoising AE Open In Colab preview download
8.3 VAE Open In Colab preview download

Prerequisites for running on your own machines

You’ll need access to a computer with the following installed:

  • Python (>= 3.6)
  • notebook (>=5.4.1)
  • pytorch (>= 0.4)
  • torchvision (>=0.2.1)
  • torchbearer (>= 0.2.6)
  • NumPy (>= 1.12.1)
  • SciPy (>= 1.0.1)
  • scikit-learn (>= 0.19.1)
  • matplotlib (>= 2.2.2)
  • spacy (>= 2.0.18)
  • torchtext (>= 0.3.1)

If you want to work on your own machine we recommend using the Anaconda python distribution. Running conda install pytorch torchvision -c pytorch (see https://pytorch.org/get-started/locally/ for more options) will install both pytorch and torchvision. Torchbearer can be installed with pip install torchbearer. This lab can be run without hardware acceleration, but it will be slow!

Copyright ©2022 The University of Southampton. All rights reserved.