这本书(Hands-On Large Language Models)原作者是 Jay Alammar,Maarten Grootendorst。 英文好的同学强烈推荐支持原书,访问 原书地址 。
这是中文版本的 hands-on LLMs,推荐大家访问原书。
- 对代码进行了更详细的注释,并且在部分内容加上自己的理解。
- 有更适合国内网络环境使用的 Notebook 版本,不需要翻墙可以使用(主要是更快)
- 配套的中文 B站视频, YouTube 视频 讲解。
建议海外用户通过 Google Colab 运行所有示例,以获得最简单的设置。Google Colab 允许您免费使用具有 16GB 显存的 T4 GPU。所有示例主要使用 Google Colab 构建和测试,因此它应该是更稳定的平台。然而,任何其他云提供商都应该可以工作。
国内用户如果想要运行,最好还是用中文可运行 Notebook,你可以复制我的容器直接运行这些代码,注册链接,这样不需要翻墙,国内网络环境访问 Google Colab 可能比较慢。
章节 | Google Colab | 中文 Notebook 复制后可直接运行 |
视频讲解 (可点击) |
---|---|---|---|
第一章: 介绍大模型 | |||
第二章: Tokens and Embeddings | |||
第三章: Looking Inside Transformer LLMs | 在录了~ | ||
第四章: Text Classification | 在录了~ | ||
第五章: Text Clustering and Topic Modeling | 在录了~ | ||
第六章: Prompt Engineering | 在录了~ | ||
第七章: Advanced Text Generation Techniques and Tools | 在录了~ | ||
第八章: Semantic Search and Retrieval-Augmented Generation | 在录了~ | ||
第九章: Multimodal Large Language Models | 在录了~ | ||
第十章: Creating Text Embedding Models | 在录了~ | ||
第十一章: Fine-tuning Representation Models for Classification | 在录了~ | ||
第 12.1 章: 大模型 SFT | |||
bonous1 - 动手实现 LoRA(非import peft) | LoRA 原理和 PyTorch 代码实现 |
Tip
You can check the setup folder for a quick-start guide to install all packages locally and you can check the conda folder for a complete guide on how to setup your environment, including conda and PyTorch installation. Note that the depending on your OS, Python version, and dependencies your results might be slightly differ. However, they should this be similar to the examples in the book.
We attempted to put as much information into the book without it being overwhelming. However, even with a 400-page book there is still much to discover! If you are interested in similar illustrated/visual guides we created, these might be of interest to you:
A Visual Guide to Mamba | A Visual Guide to Quantization | The Illustrated Stable Diffusion |
---|---|---|
Please consider citing the book if you consider it useful for your research:
@book{hands-on-llms-book,
author = {Jay Alammar and Maarten Grootendorst},
title = {Hands-On Large Language Models},
publisher = {O'Reilly},
year = {2024},
isbn = {978-1098150969},
url = {https://www.oreilly.com/library/view/hands-on-large-language/9781098150952/},
github = {https://github.com/HandsOnLLM/Hands-On-Large-Language-Models}
}