
Mastering PyTorch: Create and deploy deep learning models from CNNs to multimodal models, LLMs, and beyond 2nd Edition
Author(s): Ashish Ranjan Jha (Author)
- Publisher: Packt Publishing
- Publication Date: 31 May 2024
- Edition: 2nd
- Language: English
- Print length: 558 pages
- ISBN-10: 1801074305
- ISBN-13: 9781801074308
Book Description
Master advanced techniques and algorithms for machine learning with PyTorch using real-world examples
Updated for PyTorch 2.x, including integration with Hugging Face, mobile deployment, diffusion models, and graph neural networks
Get With Your Book: PDF Copy, AI Assistant, and Next-Gen Reader Free
Key Features
- Understand how to use PyTorch to build advanced neural network models
- Get the best from PyTorch by working with Hugging Face, fastai, PyTorch Lightning, PyTorch Geometric, Flask, and Docker
- Unlock faster training with multiple GPUs and optimize model deployment using efficient inference frameworks
Book Description
PyTorch is making it easier than ever before for anyone to build deep learning applications. This PyTorch deep learning book will help you uncover expert techniques to get the most out of your data and build complex neural network models.
You’ll build convolutional neural networks for image classification and recurrent neural networks 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, including diffusion models. You’ll not only build and train your own deep reinforcement learning models in PyTorch but also learn to optimize model training using multiple CPUs, GPUs, and mixed-precision training. You’ll deploy PyTorch models to production, including mobile devices. Finally, you’ll discover the PyTorch ecosystem and its rich set of libraries. These libraries will add another set of tools to your deep learning toolbelt, teaching you how to use fastai to prototype models and PyTorch Lightning to train models. You’ll discover libraries for AutoML and explainable AI (XAI), create recommendation systems, and build language and vision transformers with Hugging Face.
By the end of this book, you’ll be able to perform complex deep learning tasks using PyTorch to build smart artificial intelligence models.
What you will learn
- Implement text, vision, and music generation models using PyTorch
- Build a deep Q-network (DQN) model in PyTorch
- Deploy PyTorch models on mobile devices (Android and iOS)
- Become well versed in rapid prototyping using PyTorch with fastai
- Perform neural architecture search effectively using AutoML
- Easily interpret machine learning models using Captum
- Design ResNets, LSTMs, and graph neural networks (GNNs)
- Create language and vision transformer models using Hugging Face
Who this book is for
This deep learning with PyTorch book is for data scientists, machine learning engineers, machine learning researchers, and deep learning practitioners looking to implement advanced deep learning models using PyTorch. This book is ideal for those looking to switch from TensorFlow to PyTorch. Working knowledge of deep learning with Python is required.
Table of Contents
- Overview of Deep Learning using PyTorch
- Deep CNN architectures
- Combining CNNs and LSTMs
- Deep Recurrent Model Architectures
- Advanced Hybrid Models
- Graph Neural Networks
- Music and Text Generation with PyTorch
- Neural Style Transfer
- Deep Convolutional GANs
- Image Generation Using Diffusion
- Deep Reinforcement Learning
- Model Training Optimizations
- Operationalizing PyTorch Models into Production
- PyTorch on Mobile Devices
- Rapid Prototyping with PyTorch
- PyTorch and AutoML
- PyTorch and Explainable AI
- Recommendation Systems with TorchRec
- PyTorch and Hugging Face
Editorial Reviews
Review
“Mastering PyTorch, Second Edition is one of the most practical books I have read on machine learning. With a foundational understanding of deep learning and some experience with Python and PyTorch, this book elevates your skills to the next level. Ashish guides you through an engaging journey, exploring various aspects of deep learning with a hands-on approach to not only enhancing your proficiency in PyTorch but also deepening your theoretical insights into key deep learning concepts.”
Kunal Shrivastava, Roboticist, Co-Founder and CEO at SUIND
“This book is a great way to learn PyTorch by walking through a vast number of classic and cutting-edge deep learning applications, ranging from classic computer vision convolution-based architectures to more recent advances in generative AI using diffusion models. It covers topics such as reinforcement learning, graph neural networks, and recommender systems. The book also teaches how to productionize models for server-side applications and mobile applications—an often overlooked aspect in similar books.
All these facets make Mastering Pytorch a great book for someone who wants to understand the entire lifecycle of model development using PyTorch, from data preparation and model training to deployment!”
Joao Gomes, ML Engineer and Former Maintainer of PyTorch Vision
“Mastering PyTorch by Ashish Ranjan Jha is an exceptional resource, offering a breadth in its coverage of PyTorch that I have never seen elsewhere. It functions as both a reference book and a cookbook, making it an invaluable tool for anyone working with deep learning. The book seamlessly takes you from the basics of PyTorch to more advanced topics like GNNs and diffusion models, while also delving into crucial yet often overlooked areas such as deployment to production, mobile devices, and explainable AI.
The book also explores essential tools like PyTorch Lightning and Hugging Face, ensuring readers have access to the latest advancements in the field. The book’s extensive code examples make complex concepts accessible and practical.
For me, the most valuable chapters were those on TorchScript, tracing, ONNX, and saving models for mobile devices. These sections provide deep insights and practical knowledge that are often challenging to find elsewhere.
Whether you are a beginner or an experienced practitioner, this book is a must-have for mastering PyTorch and deep learning.”
Manu Joseph, Creator of PyTorch Tabular
About the Author
Ashish Ranjan Jha received his bachelor’s degree in electrical engineering from IIT Roorkee (India), a master’s degree in Computer Science from EPFL (Switzerland), and an MBA degree from Quantic School of Business (Washington). He has received a distinction in all 3 of his degrees. He has worked for large technology companies, including Oracle and Sony as well as the more recent tech unicorns such as Revolut, mostly focused on artificial intelligence. He currently works as a machine learning engineer. Ashish has worked on a range of products and projects, from developing an app that uses sensor data to predict the mode of transport to detecting fraud in car damage insurance claims. Besides being an author, machine learning engineer, and data scientist, he also blogs frequently on his personal blog site about the latest research and engineering topics around machine learning.
Wow! eBook

