Mastering PyTorch: Build powerful deep learning architectures using advanced PyTorch features, 2nd Edition
- Length: 538 pages
- Edition: 1
- Language: English
- Publisher: Packt Publishing
- Publication Date: 2023-07-11
- ISBN-10: 1801074305
- ISBN-13: 9781801074308
- Sales Rank: #7587362 (See Top 100 Books)
Master advanced techniques and algorithms for machine learning with PyTorch using real-world examples
Key Features
- Understand how to use PyTorch to build advanced neural network models including graph neural networks and reinforcement learning models
- Learn the latest tech, such as generating images from text using diffusion models
- Become an expert in deploying PyTorch models in the cloud, on mobile and across platforms
- Get the best from PyTorch by working with key libraries, including Hugging Face, fast.ai, and PyTorch Lightning
Book Description
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 from your data and build complex neural network models.
You’ll create convolutional neural networks (CNNs) for image classification and recurrent neural networks (RNNs) 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. You’ll not only build and train your own deep reinforcement learning models in PyTorch but also deploy PyTorch models to production, including mobiles and embedded 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 fast.ai for prototyping models to training models using PyTorch Lightning. You’ll discover libraries for AutoML and explainable AI, create recommendation systems using TorchRec, and build language and vision transformers with Hugging Face.
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.
What you will learn
- Implement text, image, and music generating models using PyTorch
- Build a deep Q-network (DQN) model in PyTorch
- Deploy PyTorch models on mobiles and embedded devices
- Become well-versed with rapid prototyping using PyTorch with fast.ai
- Perform neural architecture search effectively using AutoML
- Easily interpret machine learning models using Captum
- Develop your own recommendation system using TorchRec
- Design ResNets, LSTMs, and graph neural networks
- Create language and vision transformer models using Hugging Face
Who This Book Is For
This book is for data scientists, machine learning researchers, and deep learning practitioners looking to implement advanced deep learning models using PyTorch. This book is an ideal resource for those looking to switch from TensorFlow to PyTorch. Working knowledge of deep learning with Python programming is required.
Mastering Pytorch, Second Edition: Build powerful deep learning architectures using advanced PyTorch features 2 Combining CNNs and LSTMs Join our book community on Discord Building a neural network with CNNs and LSTMs Text encoding demo Building an image caption generator using PyTorch Downloading the image captioning datasets Preprocessing caption (text) data Preprocessing image data Defining the image captioning data loader Defining the CNN-LSTM model Training the CNN-LSTM model Generating image captions using the trained model Summary 3 Deep CNN Architectures Join our book community on Discord Why are CNNs so powerful? Evolution of CNN architectures Developing LeNet from scratch Using PyTorch to build LeNet Training LeNet Testing LeNet Fine-tuning the AlexNet model Using PyTorch to fine-tune AlexNet Running a pre-trained VGG model Exploring GoogLeNet and Inception v3 Inception modules 1x1 convolutions Global average pooling Auxiliary classifiers Inception v3 Discussing ResNet and DenseNet architectures DenseNet Understanding EfficientNets and the future of CNN architectures Summary 5 Hybrid Advanced Models Join our book community on Discord Building a transformer model for language modeling Reviewing language modeling Understanding the transformer model architecture Defining a transformer model in PyTorch Loading and processing the dataset Training the transformer model Developing a RandWireNN model from scratch Understanding RandWireNNs Developing RandWireNNs using PyTorch Defining a training routine and loading data Defining the randomly wired graph Defining RandWireNN model modules Transforming a random graph into a neural network Training the RandWireNN model Evaluating and visualizing the RandWireNN model Summary 7 Music and Text Generation with PyTorch Join our book community on Discord Building a transformer-based text generator with PyTorch Training the transformer-based language model Saving and loading the language model Using the language model to generate text Using a pre-trained GPT-2 model as a text generator Out-of-the-box text generation with GPT-2 Text generation strategies using PyTorch Greedy search Beam search Top-k and top-p sampling Generating MIDI music with LSTMs using PyTorch Loading the MIDI music data Defining the LSTM model and training routine Training and testing the music generation model Summary 8 Neural Style Transfer Join our book community on Discord Understanding how to transfer style between images Implementing neural style transfer using PyTorch Loading the content and style images Loading and trimming the pre-trained VGG19 model Building the neural style transfer model Training the style transfer model Experimenting with the style transfer system Summary 6 Deep Convolutional GANs Join our book community on Discord Defining the generator and discriminator networks Understanding the DCGAN generator and discriminator Training a DCGAN using PyTorch Defining the generator Defining the discriminator Loading the image dataset Training loops for DCGANs Using GANs for style transfer Understanding the pix2pix architecture Exploring the Pix2Pix generator Exploring the Pix2Pix discriminator Summary 11 Deep Reinforcement Learning Join our book community on Discord Reviewing reinforcement learning concepts Types of reinforcement learning algorithms Discussing Q-learning Understanding deep Q-learning Using two separate DNNs Experience replay buffer Building a DQN model in PyTorch Initializing the main and target CNN models Defining the experience replay buffer Setting up the environment Defining the CNN optimization function Managing and running episodes Training the DQN model to learn Pong Summary 13 Operationalizing PyTorch Models into Production Join our book community on Discord Model serving in PyTorch Creating a PyTorch model inference pipeline Saving and loading a trained model Building the inference pipeline Building a basic model server Writing a basic app using Flask Using Flask to build our model server Setting up model inference for Flask serving Building a Flask app to serve model Using a Flask server to run predictions Creating a model microservice Serving a PyTorch model using TorchServe Installing TorchServe Launching and using a TorchServe server Exporting universal PyTorch models using TorchScript and ONNX Understanding the utility of TorchScript Model tracing with TorchScript Model scripting with TorchScript Running a PyTorch model in C++ Using ONNX to export PyTorch models Serving PyTorch models in the cloud Using PyTorch with AWS Serving a PyTorch model using an AWS instance Using TorchServe with Amazon SageMaker Serving PyTorch model on Google Cloud Serving PyTorch models with Azure Working on Azure's Data Science Virtual Machine Discussing Azure Machine Learning Service Summary 16 PyTorch and AutoML Join our book community on Discord Finding the best neural architectures with AutoML Using Auto-PyTorch for optimal MNIST model search Loading the MNIST dataset Running a neural architecture search with Auto-PyTorch Visualizing the optimal AutoML model Using Optuna for hyperparameter search Defining the model architecture and loading dataset Defining the model training routine and optimization schedule Running Optuna's hyperparameter search Summary 17 PyTorch and Explainable AI Join our book community on Discord Model interpretability in PyTorch Training the handwritten digits classifier – a recap Visualizing the convolutional filters of the model Visualizing the feature maps of the model Using Captum to interpret models Setting up Captum Exploring Captum's interpretability tools Summary
Donate to keep this site alive
How to download source code?
1. Go to: https://github.com/PacktPublishing
2. In the Find a repository… box, search the book title: Mastering PyTorch: Build powerful deep learning architectures using advanced PyTorch features, 2nd Edition
, sometime you may not get the results, please search the main title.
3. Click the book title in the search results.
3. Click Code to download.
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.