Deep Learning with PyTorch
About This Course
PyTorch is the library most deep learning research and much production work is now written in. This course teaches you to build and train networks with it on your own data, and to judge whether the result is worth deploying.
Day 1 is classical machine learning in scikit-learn: classification, clustering, anomaly detection, and the validation and feature engineering that decide whether any of it holds up. It is here so you can tell when a neural network is the right tool and when a simpler model would do the job for a fraction of the effort — a judgement that is easier to make once you have built both. Day 2 moves into PyTorch proper. You start with tensors, autograd and accelerators, then train networks through the skorch API, which puts a familiar fit and predict interface over PyTorch and keeps the scikit-learn habits you arrived with.
Most of the difficulty in deep learning is not writing the model, so the course spends its time where the trouble is. You read a training run in TensorBoard and learn what its shape tells you: overfitting, vanishing gradients, a learning rate set wrong, a class imbalance in the data. Regularisation is taught as a response to a diagnosis rather than as a list of techniques. Day 3 takes on data as it actually arrives — image and audio files in inconsistent shapes, datasets too large to hold in memory, classes represented unevenly — and covers augmentation with Albumentations, spectrograms for audio, and fine-tuning pre-trained HuggingFace models, which is what you would usually do rather than training from scratch.
You write code in every section, and the exercises ship with worked solutions. You should leave able to take a problem of your own, choose an architecture for it, train it on a GPU, and tell from the diagnostics whether it is working.
Who This Course Is For
Data scientists, analysts, quants, researchers, engineers and software developers who already analyse data in Python and now need models that classical methods cannot deliver: image and audio classification, sequence and time-series prediction, or fine-tuned language and vision models.
It also suits teams who have a scikit-learn practice that works and are being asked for deep learning on top of it, and who need to tell which of the two a given problem actually calls for before committing GPU time to it.
Prerequisites
This course is designed to be able to be completed immediately after completing Python Charmers' Introduction to Python course, or equivalent programming experience (approximately 3 months of regular usage).
You should be comfortable working with data in NumPy arrays or Pandas DataFrames. High-school mathematics is enough: basic probability and linear algebra help but are not required, and no prior deep learning experience is assumed. You do not need a GPU of your own, and you will not be asked to derive back-propagation by hand.
Day 1 covers classical machine learning with scikit-learn. Skip it if you have recently completed Python for Machine Learning or Python for Scientists and Engineers, or if you already use scikit-learn regularly.
What You'll Learn
- Build and train neural networks in PyTorch, on GPUs and other accelerators.
- Judge when a neural network is the right tool and when classical machine learning will do.
- Diagnose a training run from its TensorBoard output, and apply the regularisation that fixes what you find.
- Build a working image classifier with convolutional layers, and a sequence model for time-series prediction.
- Prepare your own image and audio data for training, including augmentation and datasets too large to fit in memory.
- Fine-tune a pre-trained HuggingFace model rather than training from scratch.
Course Syllabus
Day 1: Machine learning foundations
- Core machine learning concepts and the scikit-learn estimator interface
- Classification, and choosing an estimator for the problem
- Clustering, applied to satellite imagery, time series and text
- Outlier and anomaly detection with pyOD
- Validation, model selection and diagnostic tools
- Feature engineering and selection
- Deploying models, and monitoring them for degradation
Day 2: Neural networks in PyTorch
- Tensors, automatic differentiation and AI accelerators
- Network architecture: layers, activation functions and nn.Module
- Training with the skorch API, and writing a training loop when you need one
- Loss functions, optimisers, learning-rate schedules and batch size
- Monitoring training runs with TensorBoard
- Regularisation: weight decay, dropout and batch normalisation
- Convolutional and residual layers for imagery
Day 3: Real data, sequences and transformers
- Pooling and regularisation for convolutional networks
- Recurrent and LSTM models for time-series prediction
- The transformer architecture: attention, embeddings and positional encoding
- Datasets and data loaders, including data too large for memory
- Working with your own image and audio data, including spectrograms
- Data augmentation with Albumentations, and augmentation for audio
- Fine-tuning pre-trained HuggingFace models, and gradual unfreezing
Appendices
- Writing your own training loop, Lightning, the HuggingFace Trainer API, JAX, and neural architecture search with AutoPyTorch