Helion


Szczegóły ebooka

Deep Learning with PyTorch Lightning

Deep Learning with PyTorch Lightning


Building and implementing deep learning (DL) is becoming a key skill for those who want to be at the forefront of progress.But with so much information and complex study materials out there, getting started with DL can feel quite overwhelming.

Written by an AI thought leader, Deep Learning with PyTorch Lightning helps researchers build their first DL models quickly and easily without getting stuck on the complexities. With its help, you'll be able to maximize productivity for DL projects while ensuring full flexibility - from model formulation to implementation.

Throughout this book, you'll learn how to configure PyTorch Lightning on a cloud platform, understand the architectural components, and explore how they are configured to build various industry solutions. You'll build a neural network architecture, deploy an application from scratch, and see how you can expand it based on your specific needs, beyond what the framework can provide.

In the later chapters, you'll also learn how to implement capabilities to build and train various models like Convolutional Neural Nets (CNN), Natural Language Processing (NLP), Time Series, Self-Supervised Learning, Semi-Supervised Learning, Generative Adversarial Network (GAN) using PyTorch Lightning.

By the end of this book, you'll be able to build and deploy DL models with confidence.

  • Deep Learning with PyTorch Lightning
  • Contributors
  • About the authors
  • Acknowledgements
  • About the reviewers
  • Preface
    • Who this book is for
    • What this book covers
    • To get the most out of this book
    • Download the example code files
    • Download the colour images
    • Conventions used
    • Get in touch
    • Share Your Thoughts
  • 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
    • <pip install> 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
      • Self-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 Neural Networks
      • Why Neural Networks?
      • 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 Deep Learning 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
      • Installing Libraries
      • 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 CNNRNN 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
    • Why subscribe?
  • Other Books You May Enjoy
    • Packt is searching for authors like you
    • Share Your Thoughts