Book Image

Mastering PyTorch

By : Ashish Ranjan Jha
Book Image

Mastering PyTorch

By: Ashish Ranjan Jha

Overview of this book

Deep learning is driving the AI revolution, and PyTorch is making it easier than ever before for anyone to build deep learning applications. This PyTorch book will help you uncover expert techniques to get the most out of your data and build complex neural network models. The book starts with a quick overview of PyTorch and explores using convolutional neural network (CNN) architectures for image classification. You'll then work with recurrent neural network (RNN) architectures and transformers for sentiment analysis. As you advance, you'll apply deep learning across different domains, such as music, text, and image generation using generative models and explore the world of generative adversarial networks (GANs). You'll not only build and train your own deep reinforcement learning models in PyTorch but also deploy PyTorch models to production using expert tips and techniques. Finally, you'll get to grips with training large models efficiently in a distributed manner, searching neural architectures effectively with AutoML, and rapidly prototyping models using PyTorch and fast.ai. By the end of this PyTorch book, you'll be able to perform complex deep learning tasks using PyTorch to build smart artificial intelligence models.
Table of Contents (20 chapters)
1
Section 1: PyTorch Overview
4
Section 2: Working with Advanced Neural Network Architectures
8
Section 3: Generative Models and Deep Reinforcement Learning
13
Section 4: PyTorch in Production Systems

What this book covers

Chapter 1, Overview of Deep Learning Using PyTorch, includes brief notes on various DL terms and concepts that are will help you to understand later parts of the book. This chapter also gives you a quick overview of PyTorch as a language and the tools that will be used throughout this book to build DL models. Finally, we will train a neural network model using PyTorch.

Chapter 2, Combining CNNs and LSTMs, walks us through an example where we will build a neural network model with a CNN and long short-term memory (LSTM) that generates text/captions as output when given images as input using PyTorch.

Chapter 3, Deep CNN Architectures, gives a rundown of the most advanced deep CNN model architectures in recent years. We use PyTorch to create many of these models and train them for different tasks.

Chapter 4, Deep Recurrent Model Architectures, goes through the recent advancements in recurrent neural architectures, specifically RNNs, LSTMs, and gated recurrent units (GRUs). Upon completion of this chapter, you will be able to create your own complex recurrent architectures in PyTorch.

Chapter 5, Hybrid Advanced Models, discusses some advanced, unique hybrid neural architectures, such as Transformers, which have revolutionized the world of natural language processing. This chapter also discusses RandWireNNs, taking a peek into the world of neural architecture search using PyTorch.

Chapter 6, Music and Text Generation with PyTorch, demonstrates the use of PyTorch to create DL models that can compose music and write text with practically nothing being provided to them at runtime.

Chapter 7, Neural Style Transfer, discusses a special type of generative neural network model that can mix multiple input images and generate artistic-looking arbitrary images.

Chapter 8, Deep Convolutional GANs, explains GANs and sees you train one on a specific task using PyTorch.

Chapter 9, Deep Reinforcement Learning, explores how PyTorch can be used to train agents in a deep reinforcement learning task, such as a video game.

Chapter 10, Operationalizing PyTorch Models into Production, runs through the process of deploying a DL model written in PyTorch into a real production system using Flask and Docker as well as TorchServe. Then, we'll learn how to export PyTorch models using TorchScript and ONNX. We'll also learn how to ship PyTorch code as a C++ application. Finally, we will also learn how to use PyTorch on some of the popular cloud computing platforms.

Chapter 11, Distributed Training, explores how to efficiently train large models with limited resources through distributed training practices in PyTorch.

Chapter 12, PyTorch and AutoML, walks us through setting up machine learning experiments effectively using AutoML with PyTorch.

Chapter 13, PyTorch and Explainable AI, focuses on making machine learning models interpretable to a layman using tools such as Captum combined with PyTorch.

Chapter 14, Rapid Prototyping with PyTorch, discusses various tools and libraries such as fast.ai and PyTorch Lightning that make the process of model training in PyTorch several times faster.