Deep Learning with PyTorch Lightning: Build and train high-performance artificial intelligence and self-supervised models using Python

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Build, train, deploy, and scale deep learning models quickly and accurately, improving your productivity using the lightweight PyTorch Wrapper Key Features Become well-versed with PyTorch Lightning architecture and learn how it can be implemented in various industry domains Speed up your research using PyTorch Lightning by creating new loss functions, networks, and architectures Train and build new algorithms for massive data using distributed training Book Description PyTorch Lightning lets researchers build their own Deep Learning (DL) models without having to worry about the boilerplate. With the help of this book, you'll be able to maximize productivity for DL projects while ensuring full flexibility from model formulation through to implementation. You'll take a hands-on approach to implementing PyTorch Lightning models to get up to speed in no time. You'll start by learning how to configure PyTorch Lightning on a cloud platform, understand the architectural components, and explore how they are configured to build various industry solutions. Next, you'll build a network and application from scratch and see how you can expand it based on your specific needs, beyond what the framework can provide. The book also demonstrates how to implement out-of-box capabilities to build and train Self-Supervised Learning, semi-supervised learning, and time series models using PyTorch Lightning. As you advance, you'll discover how generative adversarial networks (GANs) work. Finally, you'll work with deployment-ready applications, focusing on faster performance and scaling, model scoring on massive volumes of data, and model debugging. By the end of this PyTorch book, you'll have developed the knowledge and skills necessary to build and deploy your own scalable DL applications using PyTorch Lightning. What you will learn Customize models that are built for different datasets, model architectures, and optimizers Understand how a variety of Deep Learning models from image recognition and time series to GANs, semi-supervised and self-supervised models can be built Use out-of-the-box model architectures and pre-trained models using transfer learning Run and tune DL models in a multi-GPU environment using mixed-mode precisions Explore techniques for model scoring on massive workloads Discover troubleshooting techniques while debugging DL models Who this book is for This deep learning book is for citizen data scientists and expert data scientists transitioning from other frameworks to PyTorch Lightning. This book will also be useful for deep learning researchers who are just getting started with coding for deep learning models using PyTorch Lightning. Working knowledge of Python programming and an intermediate-level understanding of statistics and deep learning fundamentals is expected. Table of Contents PyTorch Lightning Adventure Getting Off the Ground with Your First Deep Learning Model Transfer Learning Using Pre-Trained Models Ready-to- Use Models from Bolts Time Series Models Deep Generative Models Semi-Supervised Learning Self-Supervised Learning Deploying and Scoring Models Scaling and Managing Training

Author(s): Kunal Sawarkar, Dheeraj Arremsetty
Edition: 1
Publisher: Packt
Year: 2022

Language: English
Pages: 364
City: Birmingham
Tags: pytorch deep learning

Cover
Title Page
Copyright and Credits
Contributors
Table of Contents
Preface
Section 1: Kickstarting with PyTorch Lightning
Chapter 1: PyTorch Lightning Adventure
What makes PyTorch Lightning so special?
The first one….
So many frameworks?
PyTorch versus TensorFlow
A golden mean – PyTorch Lightning
– My Lightning adventure
Understanding the key components of PyTorch Lightning
DL pipeline
PyTorch Lightning abstraction layers
Crafting AI applications using PyTorch Lightning
Image recognition models
Transfer learning
NLP Transformer models
Lightning Flash
Time series models with LSTM
Generative Adversarial Networks with Autoencoders
Semi-supervised models combining CNN and RNN
Self-supervised models for contrastive learning
Deploying and scoring models
Scaling models and productivity tips
Further reading
Summary
Chapter 2: Getting off the Ground with the First Deep Learning Model
Technical requirements
Getting started with NNs
Why NNs?
About the XOR operator
MLP architecture
Building a Hello World MLP model
Importing libraries
Preparing the data
Configuring the model
Training the model
Loading the model
Making predictions
Building our first DL model
So, what makes it deep?
CNN architecture
Building a CNN model for image recognition
Importing the packages
Collecting the data
Preparing the data
Building the model
Training the model
Evaluating the accuracy of the model
Model improvement exercises
Summary
Chapter 3: Transfer Learning Using Pre-Trained Models
Technical requirements
Getting started with transfer learning
An image classifier using a pre-trained ResNet-50 architecture
Preparing the data
Extracting the dataset
Pre-processing the dataset
Loading the dataset
Building the model
Training the model
Evaluating the accuracy of the model
Text classification using BERT transformers
Collecting the data
Preparing the dataset
Setting up the DataLoader instances
Building the model
Setting up model training and testing
Training the model
Evaluating the model
Summary
Chapter 4: Ready-to-Cook Models from Lightning Flash
Technical requirements
Getting started with Lightning Flash
Flash is as simple as 1-2-3
Video classification using Flash
Slow and SlowFast architecture
Importing libraries
Loading the dataset
Configuring the backbone
Fine-tuning the model
Making predictions using the model
Automatic speech recognition using Flash
Importing libraries
Loading the dataset
Configuring the backbone
Fine-tuning the model
Speech prediction using the model
Further learning
Summary
Section 2: Solving using PyTorch Lightning
Chapter 5: Time Series Models
Technical requirements
Introduction to time series
Time series forecasting using deep learning
Getting started with time series models
Traffic volume forecasting using the LSTM time series model
Dataset analysis
Feature engineering
Creating a custom dataset
Configuring the LSTM model using PyTorch Lightning
Setting up the optimizer
Training the model
Measuring the training loss
Loading the model
A prediction on the test dataset
The next steps
Summary
Chapter 6: Deep Generative Models
Technical requirements
Getting started with GAN models
What is a GAN?
Creating new food items using a GAN
Loading the dataset
Feature engineering utility functions
The discriminator model
The generator model
The generative adversarial model
Training the GAN model
The model output showing fake images
Creating new butterfly species using a GAN
GAN training challenges
Creating images using DCGAN
Summary
Chapter 7: Semi-Supervised Learning
Technical requirements
Getting started with semi-supervised learning
Going through the CNN–RNN architecture
Generating captions for images
Downloading the dataset
Assembling the data
Training the model
Generating the caption
Next steps
Summary
Chapter 8: Self-Supervised Learning
Technical requirements
Getting started with Self-Supervised Learning
So, what does it mean to be Self-Supervised?
What is Contrastive Learning?
SimCLR architecture
How does SimCLR work?
SimCLR model for image recognition
Collecting the dataset
Setting up data augmentation
Loading the dataset
Training configuration
Model training
Model evaluation
Next steps
Summary
Section 3: Advanced Topics
Chapter 9: Deploying and Scoring Models
Technical requirements
Deploying and scoring a deep learning model natively
The pickle (.PKL) model file format
Deploying our deep learning model
Saving and loading model checkpoints
Deploying and scoring a model using Flask
Deploying and scoring inter-portable models
What is the ONNX format? Why does it matter?
Saving and loading the ONNX model
Deploying and scoring the ONNX model using Flask
Next steps
Further reading
Summary
Chapter 10: Scaling and Managing Training
Technical Requirements
Managing training
Saving model hyperparameters
Efficient debugging
Monitoring the training loss using TensorBoard
Scaling up training
Speeding up model training using a number of workers
GPU/TPU training
Mixed precision training/16-bit training
Controlling training
Saving model checkpoints when using the cloud
Changing the default behavior of the checkpointing feature
Resuming training from a saved checkpoint
Saving downloaded and assembled data when using the cloud
Further reading
Summary
Index
Other Books You May Enjoy