{"data":{"slug":"dvgodoy-finetuningllms","name":"FineTuningLLMs","tagline":"Official repository for 'A Hands-On Guide to Fine-Tuning LLMs with PyTorch and Hugging Face'","github_url":"https://github.com/dvgodoy/FineTuningLLMs","owner":"dvgodoy","repo":"FineTuningLLMs","owner_avatar_url":"https://avatars.githubusercontent.com/u/5184020?v=4","primary_language":"Jupyter Notebook","stars":865,"forks":119,"topics":["bitsandbytes","fine-tuning","finetuning","finetuning-llms","hugging-face","huggingface","large-language-models","llamacpp","lora","ollama","peft","peft-fine-tuning-llm","pytorch","transformers"],"archived":false,"github_pushed_at":"2026-02-28T14:57:29+00:00","maintenance_label":"Slowing","stars_delta_30d":14,"url":"https://www.graphcanon.com/tools/dvgodoy-finetuningllms","markdown_url":"https://www.graphcanon.com/tools/dvgodoy-finetuningllms.md","api_url":"https://www.graphcanon.com/api/graphcanon/tools/dvgodoy-finetuningllms","graph_url":"https://www.graphcanon.com/api/graphcanon/graph?tool=dvgodoy-finetuningllms","description":"Official repository of my book \"A Hands-On Guide to Fine-Tuning LLMs with PyTorch and Hugging Face\"","homepage_url":null,"license":"MIT","open_issues":4,"watchers":6,"ai_summary":"Provides materials including Jupyter Notebooks for guiding users through the process of fine-tuning Large Language Models using PyTorch and the Hugging Face library.","readme_excerpt":"# A Hands-On Guide to Fine-Tuning LLMs with PyTorch and Hugging Face\n\n<p align=\"center\">\n  <img src=\"https://github.com/dvgodoy/FineTuningLLMs/blob/main/images/cover.png?raw=True\" width=\"400\"/>\n  <br>\n  <strong><a href=\"https://www.amazon.com/dp/B0DV3Y1GMP\">Kindle</a> | <a href=\"https://www.amazon.com/dp/B0DV4H7YW2\">Paperback</a> | <a href=\"https://leanpub.com/finetuning\">PDF [Leanpub]<a> | <a href=\"https://danielgodoy.gumroad.com/l/finetuning\">PDF [Gumroad]<a></strong>\n</p>\n\n## Setup\n\n- [FAQ](https://github.com/dvgodoy/FineTuningLLMs/blob/main/FAQ.md)\n- [Appendix A - Setting Up Your GPU Pod](https://github.com/dvgodoy/FineTuningLLMs/blob/main/AppendixA.md)\n\n## Google Colab\n\nYou can easily **load the notebooks directly from GitHub** using Colab and run them using a **GPU** provided by Google. You need to be logged in a Google Account of your own.\n\nYou can go through the chapters already using the links below:\n\n- [Chapter 0 - TL;DR](https://colab.research.google.com/github/dvgodoy/FineTuningLLMs/blob/main/Chapter0.ipynb)\n- [Chapter 1 - Pay Attention to LLMs](https://colab.research.google.com/github/dvgodoy/FineTuningLLMs/blob/main/Chapter1.ipynb)\n- [Chapter 2 - Loading a Quantized Model](https://colab.research.google.com/github/dvgodoy/FineTuningLLMs/blob/main/Chapter2.ipynb)\n- [Chapter 3 - Low-Rank Adaptation (LoRA)](https://colab.research.google.com/github/dvgodoy/FineTuningLLMs/blob/main/Chapter3.ipynb)\n- [Chapter 4 - Formatting Your Dataset](https://colab.research.google.com/github/dvgodoy/FineTuningLLMs/blob/main/Chapter4.ipynb)\n- [Chapter 5 - Fine-Tuning with `SFTTrainer`](https://colab.research.google.com/github/dvgodoy/FineTuningLLMs/blob/main/Chapter5.ipynb)\n- [Chapter 6 - Deploying It Locally](https://colab.research.google.com/github/dvgodoy/FineTuningLLMs/blob/main/Chapter6.ipynb)\n- [Appendix B - Data Types' Internal Representation](https://colab.research.google.com/github/dvgodoy/FineTuningLLMs/blob/main/AppendixB.ipynb)\n\n\n## Preface\n\nIf you’re reading this, I probably don’t need to tell you that large language models are pretty much _everywhere_, right?\n\nSince the release of ChatGPT in November 2022, it feels almost impossible to keep up with the rapid pace of developments. Every day, there’s a new technique, a new model, or a groundbreaking announcement. These are surely exciting times—but they can also feel overwhelming, exhausting and, at times, frustrating.\n\n\"_Where do I even begin to learn this?_\" is a perfectly valid question—and a tough one to answer on your own. I wrote this book as a tentative response to that question. It focuses on key concepts that, in my view, have proven to be stable and are likely to remain central to the fine-tuning process for the foreseeable future: quantization, low-rank adapters, and formatting templates.\n\nMastering these concepts is crucial for understanding the current landscape and will also empower you to handle future developments. They might also be useful to train or fine-tune a variety of large models, not just language models. They are essential tools in any data scientist's toolkit.\n\n****\n**This is an intermediate-level book, so to make the most of its content, you need a solid foundation. If Transformers, attention, Adam, tokens, embeddings, and GPUs do not ring any bells, I'd suggest you to start with my beginner-friendly series, _Deep Learning with PyTorch Step-by-Step_.**\n****\n\nI chose the Hugging Face ecosystem as the foundation for this book because it is the _de facto_ standard for working with deep learning models, whether they're language models or not. The concepts I  discuss—quantization, adapters, and templates—are neatly implemented and integrated into the ecosystem, making them relatively straightforward to use. But you have to understand how to configure them effectively and what those configurations are actually doing under the hood. It wasn't easy to find out such information out there, though. I missed a comprehensive overview explaining how these tec","github_created_at":"2024-08-15T15:14:15+00:00","created_at":"2026-07-11T11:39:57.43403+00:00","updated_at":"2026-09-20T06:30:28.813281+00:00","categories":[{"slug":"llm-frameworks","name":"LLM Frameworks","url":"https://www.graphcanon.com/categories/llm-frameworks","markdown_url":"https://www.graphcanon.com/categories/llm-frameworks.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/llm-frameworks"},{"slug":"model-training","name":"Model Training","url":"https://www.graphcanon.com/categories/model-training","markdown_url":"https://www.graphcanon.com/categories/model-training.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/model-training"}],"tags":[{"slug":"bitsandbytes","name":"bitsandbytes"},{"slug":"fine-tuning","name":"fine-tuning"},{"slug":"finetuning","name":"finetuning"},{"slug":"hugging-face","name":"hugging-face"},{"slug":"large-language-models","name":"large-language-models"},{"slug":"llamacpp","name":"llamacpp"},{"slug":"lora","name":"lora"},{"slug":"ollama","name":"ollama"}],"trust":{"provenance":{"is_fork":false,"github_id":843003613,"owner_type":"User","methodology":"github_public_v1","parent_repo":null,"near_duplicate_slugs":[]},"computed_at":"2026-09-19T18:26:03.905Z","maintenance":{"label":"Slowing","score":36,"methodology":"github_public_v1","releases_90d":0,"days_since_push":203,"last_release_at":null,"stars_delta_30d":14,"open_issues_delta_30d":0},"security_summary":{"status":"no_lockfile","scanner":null,"low_count":0,"high_count":0,"last_scan_at":"2026-07-11T11:39:59.579Z","medium_count":0,"scan_profile":"none","critical_count":0}},"capability_facts":{"scan":{"source":"repo_scan","observed_at":"2026-09-19T18:26:05.164Z"},"languages":{"value":["jupyter notebook"],"source":"github.language","observed_at":"2026-09-19T18:26:05.164Z"},"license_spdx":{"value":"MIT","source":"github.license","observed_at":"2026-09-19T18:26:05.164Z"}},"decision_facts":{"hosting":null,"pricing":null,"requirements":null,"constraints":null,"when_to_use":["You need hands-on, step-by-step instructions using PyTorch and the Hugging Face ecosystem","Prefer learning through executable code examples in Jupyter Notebook format"],"when_not_to_use":["Not interested in PyTorch; prefer TensorFlow or another framework","Seek theoretical background over practical applications"],"source":"enrich:decision_facts","observed_at":"2026-07-12T16:27:54.202Z"},"constraint_facets":null,"decision_summary":[{"label":"Adopt for","value":"FineTuningLLMs is designed for users familiar with PyTorch and Hugging Face who seek practical guidance via Jupyter Notebooks."}]}}