Book Image

PyTorch Deep Learning Hands-On

By : Sherin Thomas, Sudhanshu Passi
Book Image

PyTorch Deep Learning Hands-On

By: Sherin Thomas, Sudhanshu Passi

Overview of this book

PyTorch Deep Learning Hands-On is a book for engineers who want a fast-paced guide to doing deep learning work with PyTorch. It is not an academic textbook and does not try to teach deep learning principles. The book will help you most if you want to get your hands dirty and put PyTorch to work quickly. PyTorch Deep Learning Hands-On shows how to implement the major deep learning architectures in PyTorch. It covers neural networks, computer vision, CNNs, natural language processing (RNN), GANs, and reinforcement learning. You will also build deep learning workflows with the PyTorch framework, migrate models built in Python to highly efficient TorchScript, and deploy to production using the most sophisticated available tools. Each chapter focuses on a different area of deep learning. Chapters start with a refresher on how the model works, before sharing the code you need to implement it in PyTorch. This book is ideal if you want to rapidly add PyTorch to your deep learning toolset.
Table of Contents (11 chapters)
10
Index

Model implementation

Implementing the model is, after all, the most important step in our pipeline. In a way, we have built the whole pipeline for this step. Apart from building the network architecture, there are numerous details we need to consider to optimize our implementation (in terms of effort, time, and perhaps code efficiency as well).

In this session, we will discuss profiling and bottleneck tools available in the PyTorch package itself and ignite, a recommended trainer utility for PyTorch. The first part covers bottleneck and profiling utility, which is essential when the model starts underperforming and you need to know what went wrong where. The second part of this session explains ignite, the trainer module.

A trainer network is not really an essential component, but it is a good-to-have helper utility that saves a lot of time writing boilerplate and fixing bugs. Sometimes, it can reduce the number of lines of your program by half, which also helps to improve...