Machine LearningIntermediate

Deep Learning with PyTorch

Tensors, autograd, CNNs, RNNs and training loops from scratch.

Taught by Rohan Maharjan · ML Engineer

What you'll learn

  • Create and manipulate tensors, and explain how autograd builds and traverses the computation graph
  • Write a complete PyTorch training and validation loop with nn.Module, a loss function and an optimiser
  • Build efficient Dataset and DataLoader pipelines and move training to a GPU with mixed precision
  • Design and train a convolutional neural network for image classification
  • Train LSTM and GRU models for sequence and text data with padding and packing
  • Fine-tune pretrained torchvision models, save and resume checkpoints, and export a model to ONNX

About this course

PyTorch is the framework behind most research papers and a large share of production deep learning, and this course teaches it from the ground up. You will start with tensors and automatic differentiation, write a training loop by hand so nothing is hidden, then build convolutional networks for images and recurrent networks for sequences. Along the way you will learn the practical skills that separate working code from tutorials: Dataset and DataLoader design, moving computation to a GPU, mixed precision, checkpoints, learning-rate schedules and transfer learning with torchvision models. The final lesson covers evaluation, exporting to ONNX and serving. The course is for developers and data scientists who know Python and NumPy, have met basic machine learning ideas such as loss functions and gradient descent, and now want to build and train neural networks in PyTorch with confidence. A GPU is helpful but every example runs on a CPU.

Course content

7 lessons
  1. 1Tensors and AutogradPyTorch's core data structure, how it maps to NumPy, and how autograd computes gradients for you.Preview
  2. 2Building a Training Loop From ScratchDefine a model with nn.Module, pick a loss and optimiser, and write the train and validate loop you will reuse everywhere.
  3. 3Datasets, DataLoaders and the GPUWrite custom Dataset classes, batch efficiently with DataLoader, and train on a GPU with mixed precision.
  4. 4Convolutional Neural Networks for ImagesBuild a CNN with conv, pooling and batch-norm layers, train it on CIFAR-10 and add augmentation and schedules.
  5. 5Recurrent Networks for SequencesModel text and time series with embeddings, LSTM and GRU layers, handling variable lengths with padding and packing.
  6. 6Transfer Learning With torchvisionFine-tune pretrained ResNet and other torchvision models on your own images, freezing and unfreezing layers deliberately.
  7. 7Checkpoints, Evaluation and ExportSave and resume training, evaluate with proper metrics, and export to TorchScript or ONNX for serving.