E-Book, Englisch, 554 Seiten
Jha Mastering PyTorch
2. Auflage 2024
ISBN: 978-1-80107-996-9
Verlag: De Gruyter
Format: EPUB
Kopierschutz: 0 - No protection
Create and deploy deep learning models from CNNs to multimodal models, LLMs, and beyond
E-Book, Englisch, 554 Seiten
ISBN: 978-1-80107-996-9
Verlag: De Gruyter
Format: EPUB
Kopierschutz: 0 - No protection
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
Purchase of the print or Kindle book includes a free eBook in PDF format
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.
Autoren/Hrsg.
Fachgebiete
- Mathematik | Informatik EDV | Informatik Informatik Künstliche Intelligenz Wissensbasierte Systeme, Expertensysteme
- Mathematik | Informatik EDV | Informatik Professionelle Anwendung Computersimulation & Modelle, 3-D Graphik
- Mathematik | Informatik EDV | Informatik Informatik Künstliche Intelligenz Neuronale Netzwerke
Weitere Infos & Material
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
Preface
Deep learning is driving the AI revolution and PyTorch is making it easier than ever before for anyone to build deep learning applications. This book will help you uncover expert techniques and gain insights 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 convolutional neural network (CNN) architectures for image classification. Similarly, you will explore recurrent neural network (RNN) architectures as well as Transformers and use them for sentiment analysis. Next, you will learn how to create arbitrary neural network architectures and build Graph neural networks (GNNs). As you advance, you’ll apply deep learning (DL) across different domains such as music, text, and image generation using generative models including Generative adversarial networks (GANs) and diffusion.
Next, you’ll build and train your own deep reinforcement learning models in PyTorch, as well as interpreting DL models. You will not only learn how to build models but also how to deploy them into production and to mobile devices (Android and iOS) using expert tips and techniques. Next, you will master the skills of training large models efficiently in a distributed fashion, searching neural architectures effectively with AutoML, as well as rapidly prototyping models using fastai. You’ll then create a recommendation system using PyTorch. Finally, you’ll use major Hugging Face libraries together with PyTorch to build cutting edge artificial intelligence (AI) models.
By the end of this PyTorch book, you’ll be well equipped to perform complex deep learning tasks using PyTorch to build smart AI models.
Who this book is for
This book is for data scientists, machine learning researchers, and deep learning practitioners looking to implement advanced deep learning paradigms using PyTorch 2.x. Working knowledge of deep learning with Python programming is required.
What this book covers
, , includes brief notes on various deep learning terminologies and concepts useful for understanding later parts of this book. This chapter also gives a quick overview of PyTorch in contrast with TensorFlow as a language and tools that will be used throughout this book for building deep learning models. Finally, we train a neural network model using PyTorch.
, , is a rundown of the most advanced deep CNN model architectures that have been developed in recent years. We use PyTorch to create many of these models and train them for appropriate tasks.
, , walks through an example where we build a neural network model with a CNN and LSTM that generates text/captions as output when given images as inputs using PyTorch.
, , goes through recent advancements in recurrent neural architectures, specifically RNNs, LSTMs, and GRUs. Upon completion, you will be able to create complex recurrent architecture in PyTorch.
, , discusses some advanced, unique hybrid neural architectures such as the Transformers that 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.
, , walks us through the basic concepts behind GNNs, different kinds of graph learning tasks, and different types of GNN model architectures. The chapter then dives deep into a few of those architectures, namely Graph Convolutional Networks (GCNs) and Graph Attention Networks (GATs). This chapter uses PyTorch Geometric as the library of choice for building GNNs in PyTorch.
, , demonstrates the use of PyTorch to create deep learning models that can compose music and write text with practically nothing being provided to them at runtime.
, , discusses a special type of CNN model that can mix multiple input images and generate artistic-looking arbitrary images.
, , explains GANs and trains one using PyTorch on a specific task.
, , implements a diffusion model from scratch as a state-of-the-art text-to-image generation model, using PyTorch.
, , explores how PyTorch can be used to train agents on a deep reinforcement learning task, such as a player in a video game.
, , explores how to efficiently train large models with limited resources through distributed training as well as mixed precision training practices in PyTorch. By the end of this chapter, you will have mastered the skill of training large models efficiently using PyTorch.
, , runs through the process of deploying a deep learning model written in PyTorch into a real production system using Flask and Docker, as well as TorchServe. Then you’ll learn how to export PyTorch models both using TorchScript and ONNX. You’ll also learn how to ship PyTorch code as a C++ application. Finally, you’ll learn how to use PyTorch on some of the popular cloud computing platforms.
, , walks through the process of using various pre-trained PyTorch models and deploying them on different mobile operating systems – Android and iOS.
, , discusses various tools and libraries such as fastai and PyTorch Lightning that make the process of model training in PyTorch several times faster. This chapter also explains how to profile PyTorch code to understand resource utilization.
, , walks through setting up ML experiments effectively using AutoML and Optuna with PyTorch.
, , focuses on making machine learning models interpretable to a layman using tools such as Captum, combined with PyTorch.
, , builds a deep-learning-based movie recommendation system from scratch using PyTorch.
, , discusses how to use Hugging Face libraries such as Transformers, Accelerate, Optimum, and so on, with PyTorch to build cutting-edge multi-modal AI models.
To get the most out of this book
To fully benefit from this book, it is necessary that you meet the following prerequisites and recommendations:
- Hands-on Python experience as well as basic knowledge of PyTorch is expected. Because most exercises in this book are in the form of notebooks, a working experience with Jupyter notebooks is expected.
- Some of the exercises in some of the chapters might require a GPU for faster model training, and therefore having an NVIDIA GPU is a plus.
- Finally, having registered accounts with cloud computing platforms such as AWS, Google Cloud, and Microsoft Azure will be helpful to navigate parts of as well as to facilitate distributed training in over several virtual machines.
Download the example code files
The code bundle for the book is hosted on GitHub at https://github.com/arj7192/MasteringPyTorchV2. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Download the color images
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://packt.link/gbp/9781801074308.
Conventions used
There are a number of text conventions used throughout this book.
: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example: “Mount the downloaded disk image file as another disk in your system.”
A block of code is set as follows:
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
Any command-line input or output is...