Mastering PyTorch, Second Edition

This is the code repository for the book Mastering PyTorch, Second Edition, published by Packt.

drawing

What is this book about?

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.

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.

Notebooks in each chapter

You can run the notebooks directly from the table below:

Chapter no. Chapter title Notebook/Utility Script (GitHub) Open in Kaggle Open in Colab
1 Overview of Deep Learning Using PyTorch mnist_pytorch.ipynb Kaggle Open In Colab
mnist_tensorflow.ipynb Kaggle Open In Colab
2 Deep CNN Architectures DenseNetBlock.ipynb Kaggle Open In Colab
GoogLeNet.ipynb Kaggle Open In Colab
ResNetBlock.ipynb Kaggle Open In Colab
lenet.ipynb Kaggle Open In Colab
transfer_learning_alexnet.ipynb Kaggle Open In Colab
vgg13_pretrained_run_inference.ipynb Kaggle Open In Colab
3 Combining CNNs and LSTMs image_captioning_pytorch.ipynb Kaggle Open In Colab
4 Deep Recurrent Model Architectures lstm.ipynb Kaggle Open In Colab
rnn.ipynb Kaggle Open In Colab
5 Advanced Hybrid Models out_of_the_box_transformers.ipynb Kaggle Open In Colab
rand_wire_nn.ipynb Kaggle Open In Colab
transformer.ipynb Kaggle Open In Colab
6 Graph Neural Networks GNN.ipynb Kaggle Open In Colab
7 Music and Text Generation with PyTorch music_generation.ipynb Kaggle Open In Colab
text_generation.ipynb Kaggle Open In Colab
text_generation_out_of_the_box.ipynb Kaggle Open In Colab
text_generation_out_of_the_box_gpt3.ipynb Kaggle Open In Colab
8 Neural Style Transfer neural_style_transfer.ipynb Kaggle Open In Colab
9 Deep Convolutional GANs dcgan.ipynb Kaggle Open In Colab
pix2pix_architecture.ipynb Kaggle Open In Colab
10 Image Generation Using Diffusion image_generation_using_diffusion.ipynb Kaggle Open In Colab
taj_mahal_image.ipynb Kaggle Open In Colab
text_to_image_generation_using_stable_diffusion_v1_5.ipynb Kaggle Open In Colab
11 Deep Reinforcement Learning pong.ipynb Kaggle Open In Colab
13 Operationalizing PyTorch Models into Production mnist_pytorch.ipynb Kaggle Open In Colab
model_scripting.ipynb Kaggle Open In Colab
model_tracing.ipynb Kaggle Open In Colab
onnx.ipynb Kaggle Open In Colab
run_inference.ipynb Kaggle Open In Colab
15 Rapid Prototyping with PyTorch fastai.ipynb Kaggle Open In Colab
poutyne.ipynb Kaggle Open In Colab
pytorch_lightning.ipynb Kaggle Open In Colab
pytorch_profiler.ipynb Kaggle Open In Colab
16 PyTorch and AutoML automl-pytorch.ipynb Kaggle Open In Colab
optuna_pytorch.ipynb Kaggle Open In Colab
17 PyTorch and Explainable AI captum_interpretability.ipynb Kaggle Open In Colab
pytorch_interpretability.ipynb Kaggle Open In Colab
18 Recommendation Systems with PyTorch torch-recsys.ipynb Kaggle Open In Colab
19 PyTorch and Hugging Face HuggingFaceAccelerate.ipynb Kaggle Open In Colab
HuggingFaceDatasets.ipynb Kaggle Open In Colab
HuggingFaceHub.ipynb Kaggle Open In Colab
HuggingFaceOptimum.ipynb Kaggle Open In Colab
HuggingFacePyTorch.ipynb Kaggle Open In Colab

Know more on the Discord server Coding

You can get more engaged on the discord server for more latest updates and discussions in the community at Discord

Download a free PDF Coding

If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost. Simply click on the link to claim your free PDF. Free-Ebook Coding

We also provide a PDF file that has color images of the screenshots/diagrams used in this book at GraphicBundle Coding

Get to know the Author

Ashish Ranjan Jha studied electrical engineering at IIT Roorkee, computer science at École Polytechnique Fédérale de Lausanne (EPFL), and he also completed his MBA at Quantic School of Business, with a distinction in all three degrees. He has worked for bigger tech companies like Oracle and Sony, and recent tech unicorns – Revolut and Tractable, in the fields of data science, machine learning and artificial intelligence. He currently works as head of ML and AI at XYZ Reality, based in London (a construction tech start-up where construction meets AR/VR meets ML/AI to enable real-time data driven construction intelligence). He is also an advisor to SUIND, an agritech startup that uses drones for intelligence. Along with that, he has also authored a book, Fight Fraud with Machine Learning.

Other Related Books