Skip to content

Exercises and supplementary material for the deep learning course 02456 using PyTorch.

Notifications You must be signed in to change notification settings

yeonsoo1/02456-deep-learning-with-PyTorch

 
 

Repository files navigation

02456 Deep Learning (with PyTorch)

This repository contains exercises for the DTU course 02456 Deep Learning. All exercises are written in the Python programming language and formatted into Jupyter Notebooks. If you're unfamiliar with notebooks, it can be a good idea to familiarize yourself with them in advance.

This repository borrows heavily from previous works, in particular:

  • 2015 DTU Summerschool in Deep Learning. A PhD summerschool that was held at DTU in 2015. Exercises both in numpy and Theano.

  • 02456-deep-learning. Previous version of the course material for this course, but using TensorFlow for the exercises.

  • Pytorch Tutorial. A remix popular deep learning materials, including material from 02456, collected in one coherent package using PyTorch, with a focus on natural language processing (NLP)

  • pytorch/tutorials. Official tutorials from the PyTorch repo.

Setup

The recommended (and by far the easiest) way to get started with the exercises is by using Google Colab. It allows you to work with Jupyter Notebooks in the cloud with all dependencies pre-installed, and Colab offers GPU utility for free which allwos you to run the exercises considerably faster.

If you prefer to work locally, we here provide installation guides for Linux and Mac using Docker.

  • NB: If you have an NVIDIA GPU you should follow the GPU instructions below, since working on a GPU rather than CPU will accelerate things substantially.
  • NB: If you are using Windows working locally is a bit more difficult. We will help you the best we can, but be prepared to do some resaerch on your own.

CPU (Linux & mac)

First you need to install Docker.

Setup Docker by typing this in the command line in the exercise folder (this one)

  • docker build -t munkai/pytorch:cpu -f Dockerfile.cpu .

Start Docker container

  • docker run -it -p 8888:8888 -v `pwd`:/work munkai/pytorch:cpu ./jupyter_run.sh

Go to your browser, and type in http://localhost:8888. It will ask for a password (token) that you can copy from your terminal.

GPU (Linux & mac)

Setting up your GPU may take a while, and you might need to consult your favorite search engine. You need Nvidia and nvidia-docker installed for this.

Make sure you have Nvidia's drivers installed for your system. The folowing instructions will install CUDA and NVIDA drivers on ubuntu 16.04. Adjust as appropriate.

DISTRO=ubuntu
VERSION=1604
ARCH=x86_64
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/${DISTRO}${VERSION}/${ARCH}/7fa2af80.pub
sudo sh -c 'echo "deb http://developer.download.nvidia.com/compute/cuda/repos/${DISTRO}${VERSION}/${ARCH}/" > /etc/apt/sources.list.d/cuda.list'
sudo apt-get update && sudo apt-get install -y --no-install-recommends cuda-drivers

Install nvidia-docker: See https://github.com/NVIDIA/nvidia-docker on how to install nvidia-docker.

Setup Docker with GPU by typing this in the command line in the exercise folder (this one)

  • docker build -t munkai/pytorch:gpu -f Dockerfile.gpu .

Running docker with a CUDA-enabled machine

  • nvidia-docker run -it -p 8888:8888 -v `pwd`:/work munkai/pytorch:gpu ./jupyter_run.sh

Go to your browser, and type in http://localhost:8888. It will ask for a password (token) that you can copy from your terminal.

CPU (Windows)

The following instructions will help you setup Docker on Windows.

  1. Install install Docker
  2. Make drive shareable - complete steps 1-3 in this guide
  3. Setup Docker by typing this in the command line in the exercise folder (this one)
  4. docker build -t munkai/pytorch:cpu -f Dockerfile.cpu .
  5. Make sure that jupyter_run.sh has Unix style line endings (git has probaly made it Windos style when you downloaded. Text editors like Sublime can change that).
  6. Run Docker (change command to match your setup)
  7. docker run -v c:/PATH/TO/EXERCISES/02456-deep-learning-with-PyTorch:/work -it --rm -p 8888:8888 munkai/pytorch:cpu ./jupyter_run.sh
  8. Go to your browser, and type in http://localhost:8888. It will ask for a password (token) that you can copy from your terminal.

And you are done! Once setup is complete you only need to perform the last 2 steps to get up and running.

Debugging

If you are having issues we have made a list of problems and solutions to help you. Plase help us extend this list and help people in the future by letting us know about you issues and the solutions you found.

GPU (Windows)

We haven't tested this, but it should be easy to combine the GPU (Linux & mac) and CPU (Windows) guides above. Let us know if this works/doesn't work for you.

7. Additional content

If you're interested in some PyTorch codebases check out the following links (reinforcement learning, GANs, ResNet, etc).

About

Exercises and supplementary material for the deep learning course 02456 using PyTorch.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 97.9%
  • Python 2.1%