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 PyTorch on your own data, and to judge whether the result is worth deploying.
Day One covers classical machine learning in scikit-learn. This includes classification, clustering and anomaly detection, along with the validation and feature engineering that decide whether a model holds up. Starting with classical methods shows you when a neural network is the right tool, and when a simpler model would do the job for a fraction of the effort. The judgement is easier to make once you have built both.
Day Two moves into PyTorch itself. You start with tensors, autograd and accelerators, then train networks through the skorch API. The skorch API puts a familiar fit and predict interface over PyTorch, so your scikit-learn habits carry over. You then learn to read a training run in TensorBoard, and what its shape tells you about overfitting, vanishing gradients, a learning rate set wrong, or a class imbalance in the data. Regularisation is taught as a response to that diagnosis rather than as a list of techniques.
Day Three focuses on real data, sequence models and transformers. Real image and audio files arrive in inconsistent shapes, in datasets too large to hold in memory, with classes represented unevenly. You prepare them with data loaders, augmentation in Albumentations, and spectrograms for audio. The day also covers recurrent and LSTM models for time-series prediction, the transformer architecture, and fine-tuning pre-trained HuggingFace models, which is usually a better starting point 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 the model 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. This includes image and audio classification, sequence and time-series prediction, and fine-tuned language and vision models.
This course also suits teams with a scikit-learn practice that works who are being asked for deep learning on top of it. Those teams 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 in Pandas or Polars DataFrames. High-school mathematics is enough. Basic probability and linear algebra help, but are not required. 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. You can skip Day 1 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