Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: Howard Huang, Eli Stevens, Luca Antiga, Thomas Viehmann

Rating No ratings yet

Everything you need to create neural networks with PyTorch, including Large Language and diffusion models. PyTorch core developer Howard Huang updates the bestselling original Deep Learning with PyTorch with new insights into the transformers architecture and generative AI models. In Deep Learning with PyTorch, Second Edition you’ll find • Deep learning fundamentals reinforced with hands-on projects • Mastering PyTorch's flexible APIs for neural network development • Implementing CNNs, transformers, and diffusion models • Optimizing models for training and deployment • Generative AI models to create images and text Instantly familiar to anyone who knows PyData tools like NumPy, PyTorch simplifies deep learning without sacrificing advanced features. In this book you’ll learn how to create your own neural network and deep learning systems and take full advantage of PyTorch’s built-in tools for automatic differentiation, hardware acceleration, distributed training, and more. You’ll discover how easy PyTorch makes it to build your entire DL pipeline, including using the PyTorch Tensor API, loading data in Python, monitoring training, and visualizing results. Each new technique you learn is put into action with practical code examples in each chapter, culminating into you building your own convolution neural networks, transformers, and even a real-world medical image classifier. About the technology The powerful PyTorch library makes deep learning simple—without sacrificing the features you need to create efficient neural networks, LLMs, and other ML models. Pythonic by design, it’s instantly familiar to users of NumPy, Scikit-learn, and other ML frameworks. This thoroughly-revised second edition covers the latest PyTorch innovations, including how to create and refine generative AI models. About the reader For Python programmers with a background in machine learning.

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
# Deep Learning with PyTorch, 2nd Edition — Reading Guide ## 【One-Line Pitch】 A hands-on, project-driven tour of PyTorch that takes you from tensor fundamentals through CNNs, transformers, and diffusion models, culminating in a real-world medical imaging project—ideal for Python programmers with some ML background who want to build and deploy modern deep learning systems. ## 【Book Arc】 - **Opening (~0%–10%)**: Introduces deep learning concepts and why PyTorch stands out among frameworks, then immediately gets you running pretrained models for image recognition, image editing (inpainting, style transfer), and scene description using models from the Hugging Face Model Zoo. - **Early (~10%–30%)**: Builds the core foundation—tensors as the universal data structure, indexing, broadcasting, dtype management, GPU movement, and serialization—then shows how to represent real-world data (images, volumetric data, tabular data, time series, text) as tensors ready for training. - **Middle (~30%–60%)**: Covers the mechanics of learning: loss functions, gradient descent, autograd, and optimizers. Progresses from linear models to neural networks with the `nn` module, then to convolutional networks for image classification (CIFAR-10), including model design trade-offs around width, depth, and regularization. - **Middle–Late (~60%–80%)**: Dives into modern architectures—transformers (self-attention, causal attention, encoder-decoder variants, tokenization, Vision Transformer) and diffusion models (forward process, training, sampling)—then launches a large-scale medical project: building an end-to-end lung cancer detection system from CT scans using the LUNA dataset. - **Late (~80%–90%)**: Focuses on the medical project's refinement: improving classification with precision/recall/F1 metrics, balancing datasets, and preventing overfitting with data augmentation. Introduces segmentation using the Segment Anything Model (SAM) for candidate detection. - **Ending (~90%–100%)**: Covers production concerns: multi-GPU training (data, model, pipeline, tensor, and fully sharded parallelism), serving models with Gradio and FastAPI, exporting to ONNX and `torch.export`, optimizing with `torch.compile`, profiling, and deploying to C++ (LibTorch) and mobile (ExecuTorch). ## 【Key Takeaways】 - **Tensors are the universal language of PyTorch** (Early): Everything—images, text, time series, medical scans—becomes a tensor. Mastering indexing, broadcasting, strides, and GPU transfer early pays off throughout the book. - **Real-world data representation is a design problem** (Early): The book shows concrete patterns for converting images (channels-last vs. channels-first), tabular data (one-hot encoding, thresholds), time series (time dimensions), and text (embeddings) into tensor form—a skill often glossed over elsewhere. - **Learning is parameter estimation via gradient descent** (Middle): The authors demystify backpropagation by building intuition with a simple "hot problem" before introducing autograd, making the leap from linear models to neural networks feel natural. - **The `nn` module is the backbone of model building** (Middle): Subclassing `nn.Module`, using the functional API, and understanding how PyTorch tracks parameters and submodules are essential patterns for any custom architecture. - **Convolutions generalize image learning** (Middle): The book makes a strong case for why fully connected networks fail on images, then systematically introduces padding, pooling, and depth/width trade-offs with practical accuracy comparisons. - **Transformers are built from self-attention** (Middle–Late): Using a character-by-character name generator, the book builds up dot-product attention, causal masking, and the decoder architecture—making the leap to Vision Transformers and LLMs tractable. - **Diffusion models are a practical generative tool** (Middle–Late): The forward noising process and reverse sampling are explained with working code, demystifying how modern image generators work. - **Real projects require metrics beyond accuracy** (Late): The lung cancer case study shows why 99.7% accuracy can be meaningless for imbalanced medical data, introducing precision, recall, F1 score, and data augmentation as essential tools. ## 【Reading Tips】 - **Skim the first two chapters** if you're already comfortable with ML basics—the pretrained network demos are fun but not critical. Start deep at Chapter 3 (tensors) if you're new to PyTorch. - **Code along with Chapters 3–8**: The tensor operations and neural network construction are best learned by typing. The exercises at each chapter end are worth doing, especially the CIFAR-10 classifier. - **Treat Chapter 9 (transformers) as a mini-course**: It's the most conceptually dense chapter. Read it twice if needed—the attention mechanism is the key to understanding modern LLMs and the Vision Transformer. - **The medical imaging project (Chapters 11–15) is the book's capstone**: Even if you're not interested in healthcare, the patterns for large-scale data pipelines, dataset classes, training loops, and model evaluation are directly transferable. - **The final chapters (16–17) are reference material**: Skim for awareness of multi-GPU parallelism and deployment options; you can return when you actually need to scale or ship a model. ## 【Coverage Limits】 This guide is based on a sample of the book's table of contents and front matter; detailed chapter content beyond the outline (e.g., specific code implementations, exercise solutions) is not covered. The excerpts do not include the full text of chapters on advanced topics like distributed training internals or deployment specifics. ##
Excerpt 1
书名: Deep Learning with PyTorch Training and applying deep learning and generative AI models, 2nd Edition (Howard Huang, Eli Stevens, Luca Antiga etc.)(Z-Libr...
View in text
Page 6
se contact Special Sales Department Manning Publications Co. 20 Baldwin Road PO Box 761 Shelter Island, NY 11964 Email: orders@manning.com ©2026 by Manning P...
View in text
Page 10
tructing our first tensors 43 ■ The essence of tensors 43 3.3 Indexing tensors 46 3.4 Broadcasting 47 3.5 Named tensors 48 3.6 Tensor element types 51 Specif...
View in text
Page 13
ting it all together for our network 213 8.3 Subclassing nn.Module 215 Our network as an nn.Module 216 ■ How PyTorch keeps track of parameters and submodules...
View in text
Page 15
del learning to detect nodules? 379 13.11 Conclusion 380 13.12 Exercises 380 Licensed to THIAGO BANDEIRA <thiago@lar.ifce.edu.br> CONTENTSxiv 14 Improving tr...
View in text
Page 19
by the clarity of our prompts than by the machinery itself. The pace of progress has been astounding, and part of what I want to do in this book is peel back...
View in text
Tags
AI categories
PythonAI
pytorch
ISBN: 1633438856
Publish Year: 2026
Language: English
Pages: 546
File Format: PDF
File Size: 28.8 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…