Mastering PyTorch - Second Edition, (Early Access) 9781801074308

Master advanced techniques and algorithms for machine learning with PyTorch using real-world examples Key Features Unde

2,614 144 17MB

English Pages 326 Year 2023

Report DMCA / Copyright

DOWNLOAD EPUB FILE

Table of contents :
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

Mastering PyTorch - Second Edition, (Early Access)
 9781801074308

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
Recommend Papers