کتاب A Hands-On Guide to Fine-Tuning Large Language Models with PyTorch and Hugging Face [انگلیسی]

لینک آمازون: https://amazon.com/dp/B0DV3Y1GMP

درباره کتاب

Revised Edition (October/2025)
Are you ready to fine-tune your own LLMs?

This book is a practical guide to fine-tuning Large Language Models (LLMs), combining high-level concepts with step-by-step instructions to train these powerful models for your specific use cases.

Who Is This Book For?

This is an intermediate-level resource—positioned between building a large language model from scratch and deploying an LLM in production—designed for practitioners with some prior experience in deep learning.
If terms like Transformers, attention mechanisms, Adam optimizer, tokens, embeddings, or GPUs sound familiar, you’re in the right place. Familiarity with Hugging Face and PyTorch is assumed. If you’re new to these concepts, consider starting with a beginner-friendly introduction to deep learning with PyTorch before diving in.

What You’ll Learn:Load quantized models using BitsAndBytes.Configure Low-Rank Adapters (LoRA) using Hugging Face’s PEFT.Format datasets effectively using chat templates and formatting functions.Fine-tune LLMs on consumer-grade GPUs using techniques such as gradient checkpointing and accumulation.Deploy LLMs locally in the GGUF format using Llama.cpp and Ollama.Troubleshoot common error messages and exceptions to keep your fine-tuning process on track.

This book doesn’t just skim the surface; it zooms in on the critical adjustments and configurations—those all-important “knobs”—that make or break the fine-tuning process.
By the end, you’ll have the skills and confidence to fine-tune LLMs for your own real-world applications. Whether you’re looking to enhance existing models or tailor them to niche tasks, this book is your essential companion.

Table of ContentsFrequently Asked Questions (FAQ)Chapter 0: TL;DRChapter 1: Pay Attention to LLMsChapter 2: Loading a Quantized Base ModelChapter 3: Low-Rank Adaptation (LoRA)Chapter 4: Formatting Your DatasetChapter 5: Fine-Tuning with SFTTrainerChapter 6: Deploying It LocallyChapter -1: TroubleshootingAppendix A: Setting Up Your GPU PodAppendix B: Data Types’ Internal Representation

From the Publisher

Is this book for me?

Are you ready to fine-tune your own LLMs?

This book is a practical guide to fine-tuning Large Language Models (LLMs), combining high-level concepts with step-by-step instructions to train these powerful models for your specific use cases.

By the end, you’ll have the skills and confidence to fine-tune LLMs for your own real-world applications.

What do I need to know?

This is an intermediate-level resource designed for practitioners with some prior experience in deep learning.

If terms like Transformers, attention mechanisms, Adam optimizer, tokens, embeddings, or GPUs sound familiar, you’re in the right place. If you’re new to these concepts, consider starting with a beginner-friendly introduction to deep learning with PyTorch before diving in.

What’s inside Load quantized models Configure Low-Rank Adapters (LoRA) Format datasets effectively using chat templates Fine-tune LLMs on consumer-grade GPUs Deploy LLMs locally Troubleshoot common error messages and exceptions

Why this book?

The rise of LLMs has been rapid and exciting, but the ever-changing landscape of tools, models, and libraries often leads to outdated tutorials and broken documentation everywhere. This book cuts through the noise, focusing on the core concepts—like quantization and LoRA—that are here to stay. Mastering these will make adapting to future changes much easier.

You’ll get a clear, comprehensive view of the fine-tuning process, paired with detailed explanations of the required settings and configurations. Sometimes, to truly understand why something works (or doesn’t), you need to peek under the hood—and we’ll do just that.

Written in an informal, conversational style, this book is designed to feel like a dialogue. Expect questions, answers, and even a few pop culture references sprinkled throughout to keep things fun and relatable.

“Hi, I’m Daniel”

I am a data scientist, developer, teacher, and author of the Deep Learning with PyTorch Step-by-Step series of books, which are used as textbooks at universities in the United States and Spain. My books have also been translated into Simplified Chinese by China Machine Press.

I’ve been teaching machine learning, distributed computing technologies, time series, and large language models at Data Science Retreat, the longest-running Berlin-based bootcamp, since 2016, helping more than 200 students advance their careers.

ASIN ‏ : ‎ B0DV3Y1GMP
Accessibility ‏ : ‎ Learn more
Publication date ‏ : ‎ January 25, 2025
Language ‏ : ‎ English
File size ‏ : ‎ 15.7 MB
Simultaneous device usage ‏ : ‎ Unlimited
Screen Reader ‏ : ‎ Supported
Enhanced typesetting ‏ : ‎ Enabled
X-Ray ‏ : ‎ Not Enabled
Word Wise ‏ : ‎ Not Enabled
Print length ‏ : ‎ 520 pages
Page Flip ‏ : ‎ Enabled
Best Sellers Rank: #151,297 in Kindle Store (See Top 100 in Kindle Store) #20 in Neural Networks #21 in Natural Language Processing (Kindle Store) #40 in Natural Language Processing (Books)
Customer Reviews: 4.6 4.6 out of 5 stars 10 ratings

, , , , , , ,