- 第一次把 Llama 跑起来:想先确认模型能加载、能对话、能出 token,再谈别的。这里给的是能直接执行的 notebook,比翻 transformers 文档拼 demo 快,但别指望它替你处理环境
- 微调方案选型阶段:需要看 LoRA、QLoRA、全参微调各自的脚本长什么样、参数怎么传,用来判断自己的数据量和卡数该走哪条路。自己写会漏掉 pad_token、梯度累积这些细节
- 接第三方 Llama 托管服务:要对比 Together、Fireworks、Bedrock 这类 provider 的调用差异,仓库里有现成配方,省去逐个读各家 SDK 文档
- 做 RAG 原型:需要一份能跑通的 LangChain + Llama 组合示例,用来验证检索链路是否成立,而不是自己从 embedding 到 prompt 拼一遍
llama-cookbook
meta-llamaMIT更新放缓 有专家点评Llama 官方示例手册,手把手教你在推理、微调、RAG 等场景中落地 Llama 系列模型,并覆盖多家云服务商的端到端方案。
Welcome to the Llama Cookbook! This is your go to guide for Building with Llama: Getting started with Inference, Fine-Tuning, RAG. We also show you how to solve end to end problems using Llama model family and using them on various provider services
专家点评
上手难度:进阶更新于 2026-11-11Meta 官方 Llama 示例库,用 notebook 顶替你自己从零搭的推理、微调、RAG 样板代码
适用场景
踩坑
- 仓库重构过,按 llama-recipes 旧名或旧链接找内容会 404,部分目录已移到 archive-main 快照分支。照网上教程走的时候会撞上
- README 没给安装步骤和硬件要求,notebook 默认你已有模型权重或 Llama API 访问权限。clone 完直接跑第一个 cell 大概率卡在鉴权和依赖版本上
- issue 里反复出现单卡加载大模型(13B 单卡)和 pad_token 最佳实践这两类问题,说明示例代码在显存边界和 tokenizer 配置上没给出确定答案,需要自己判断
同类对比
真要跑生产微调,用 axolotl 或 torchtune,配置化和可复现性比 notebook 强;只做推理部署则直接看 vLLM 的文档,不必经过这个仓库
项目说明
由 README 自动翻译提炼Meta 官方 Llama 示例库,提供推理、微调、RAG 与端到端用例的 notebook 和配方
Llama 官方示例手册,手把手教你在推理、微调、RAG 等场景中落地 Llama 系列模型,并覆盖多家云服务商的端到端方案。
核心能力
- 提供 Llama 4 推理与 Llama API 上手 notebook
- 覆盖微调、RAG 与推理的入门参考示例
- 收录 WhatsApp 机器人、论文分析等端到端用例
- 汇总多家第三方 Llama 服务商的集成配方
- 保留原 llama-recipes 库源码与微调 FAQ
容易踩的坑
仓库近期重构过,部分链接失效或目录缺失,旧内容需查 archive-main 快照分支;llama-recipes 已改名为 llama-cookbook,按旧名找资料会对不上;多数 notebook 需自备 Llama 模型或 Llama API 访问权限,README 未给出安装步骤
- v0.0.5Llama-cookbook v0.0.5 Release最新正式版2025-01-22 · 2025-01-22 18:56 UTC
Llama-cookbook v0.0.5 Release Notes
This release changes the package name from
llama_recipestollama_cookbookand deprecates thellama_recipespackage name.Highlighted Changes
- Name:
llama_cookbookandpip install llama-cookbook - Update instructions https://github.com/meta-llama/llama-cookbook/pull/852
- Update src package https://github.com/meta-llama/llama-cookbook/pull/861, https://github.com/meta-llama/llama-cookbook/pull/848
What's Changed
- Improve discoverability of 3.2 recipes by @subramen in https://github.com/meta-llama/llama-cookbook/pull/684
- fix readme by @wukaixingxp in https://github.com/meta-llama/llama-cookbook/pull/679
- fix AutoModel and bump transformers version to 4.45 by @wukaixingxp in https://github.com/meta-llama/llama-cookbook/pull/686
- post1 release version bump by @mreso in https://github.com/meta-llama/llama-cookbook/pull/687
- Update multi_modal_infer.py by @init27 in https://github.com/meta-llama/llama-cookbook/pull/696
- Add recipe for Llama Triaging & Reporting Tool by @subramen in https://github.com/meta-llama/llama-cookbook/pull/651
- Updates to accommodate OpenLLM leaderboard v2 tasks and change Meta Llama 3.1 to Llama 3.1 by @wukaixingxp in https://github.com/meta-llama/llama-cookbook/pull/639
- Improve model checkpoint saving logic by @lucas-ventura in https://github.com/meta-llama/llama-cookbook/pull/691
- Delete cookie by @init27 in https://github.com/meta-llama/llama-cookbook/pull/700
- [Fixed] RuntimeError: probability tensor contains either inf, nan or element < 0 by @himanshushukla12 in https://github.com/meta-llama/llama-cookbook/pull/704
- chore: update train_utils.py by @eltociear in https://github.com/meta-llama/llama-cookbook/pull/690
- Update requirements.txt by @varunfb in https://github.com/meta-llama/llama-cookbook/pull/664
- added missing word and corrected spelling by @jnfinitym in https://github.com/meta-llama/llama-cookbook/pull/707
- Fix the bug when continue the peft. by @24kMengXin in https://github.com/meta-llama/llama-cookbook/pull/717
- Fix link to LLM finetuning overview by @vvolhejn in https://github.com/meta-llama/llama-cookbook/pull/719
- fix Colab link in quickstart_peft_finetuning.ipynb by @jgrivolla in https://github.com/meta-llama/llama-cookbook/pull/720
- Fix fine-tuning training loss accumulation by @celestinoalan in https://github.com/meta-llama/llama-cookbook/pull/725
- quick fix on readmes and deadlinks by @wukaixingxp in https://github.com/meta-llama/llama-cookbook/pull/729
- Initial Crusoe examples to 3p_integrations recipes by @ethxnp in https://github.com/meta-llama/llama-cookbook/pull/716
- Fix numpy seed in finetuning.py by @patrik-lambert in https://github.com/meta-llama/llama-cookbook/pull/728
- Fix/unit test 3.2 by @mreso in https://github.com/meta-llama/llama-cookbook/pull/726
- Tool Calling Tutorial and Example by @init27 in https://github.com/meta-llama/llama-cookbook/pull/697
- Update wordlist.txt by @init27 in https://github.com/meta-llama/llama-cookbook/pull/736
- Support converting fine-tuned llama 3.2 vision model to HF format and then local inference by @wukaixingxp in https://github.com/meta-llama/llama-cookbook/pull/737
- Save the
preprocessor_config.jsonandchat_template.jsonfor mllama model after conversion by @wukaixingxp in https://github.com/meta-llama/llama-cookbook/pull/741 - Append epoch rather than best val. loss to val_loss by @celestinoalan in https://github.com/meta-llama/llama-cookbook/pull/744
- Update wordlist.txt by @init27 in https://github.com/meta-llama/llama-cookbook/pull/745
- Notebook llama by @init27 in https://github.com/meta-llama/llama-cookbook/pull/739
- Small notes on next steps by @init27 in https://github.com/meta-llama/llama-cookbook/pull/746
- Fix minor grammatical errors by @terrchen in https://github.com/meta-llama/llama-cookbook/pull/748
- Update hello_llama_cloud.ipynb by @sharmax-vikas in https://github.com/meta-llama/l
- Name:
- v0.0.4.post1Llama-recipes v.0.0.4.post1 Release Notes2024-09-26 · 2024-09-26 19:32 UTC
查看更新说明
This release import bug fixes and some doc changes.
What's Changed
- Improve discoverability of 3.2 recipes by @subramen in https://github.com/meta-llama/llama-recipes/pull/684
- fix readme by @wukaixingxp in https://github.com/meta-llama/llama-recipes/pull/679
- fix AutoModel and bump transformers version to 4.45 by @wukaixingxp in https://github.com/meta-llama/llama-recipes/pull/686
- post1 release version bump by @mreso in https://github.com/meta-llama/llama-recipes/pull/687
- v0.0.4Llama-recipes v.0.0.4 Release Notes2024-09-25 · 2024-09-25 18:55 UTC
查看更新说明
This release accompanies the release of Llama 3.2 which included new versions of the Llama models in sizes of 1B, 3B, 11B and 90B. To get started with the new models you can find information in the official documentation or the on the HuggingFace hub. Further details can also be found in the model card and the The Llama 3 Herd of Models paper. For this release we updated the documentation and made sure all components work with the new models including multimodal finetuning.
What's Changed
Integrate Llama 3.2
- Upstream merge by @albertodepaola in https://github.com/meta-llama/llama-recipes/pull/677
New and updated recipes
- Adding end-to-end llama chatbot recipe using Retrieval Augmented Fine Tuning (RAFT) by @wukaixingxp in https://github.com/meta-llama/llama-recipes/pull/569
- [WIP] adding chatbot-e2e by @HamidShojanazeri in https://github.com/meta-llama/llama-recipes/pull/462
- [Azure] Update Azure API usage example to 3.1 by @WuhanMonkey in https://github.com/meta-llama/llama-recipes/pull/615
- Corrected wrong order of commands by @BakungaBronson in https://github.com/meta-llama/llama-recipes/pull/602
- Fill in one sentence in the prompt guard tutorial. by @cynikolai in https://github.com/meta-llama/llama-recipes/pull/609
- Llamaguard notebook colab link fix by @tryrobbo in https://github.com/meta-llama/llama-recipes/pull/619
- Updating llama 3 references to 3.1 model by @init27 in https://github.com/meta-llama/llama-recipes/pull/632
- recipes/quickstart/Getting_to_know_Llama.ipynb, typo fix lama -> llama line 127 by @cselip in https://github.com/meta-llama/llama-recipes/pull/635
- Update hello_llama_cloud.ipynb by @MrDlt in https://github.com/meta-llama/llama-recipes/pull/584
- Update hello_llama_cloud.ipynb by @MrDlt in https://github.com/meta-llama/llama-recipes/pull/638
- Add preprocessor to patch PromptGuard scores for inserted characters by @cynikolai in https://github.com/meta-llama/llama-recipes/pull/636
- Eval reproduce recipe using lm-evaluation-harness and our 3.1 evals datasets by @wukaixingxp in https://github.com/meta-llama/llama-recipes/pull/627
Documentation update
- Update readme text to be version-agnostic by @subramen in https://github.com/meta-llama/llama-recipes/pull/614
- Move supported features table to main README by @subramen in https://github.com/meta-llama/llama-recipes/pull/616
- document less obvious training config parameters by @kjslag in https://github.com/meta-llama/llama-recipes/pull/522
Misc fixes
- Enable users to trust remote code in samsum dataset by @mreso in https://github.com/meta-llama/llama-recipes/pull/628
- Use new get_model_state_dict api for save_pretrained peft model by @mreso in https://github.com/meta-llama/llama-recipes/pull/629
- Fix version number in Python example by @wstnmssr in https://github.com/meta-llama/llama-recipes/pull/643
- Fix checkpoint saving by @mreso in https://github.com/meta-llama/llama-recipes/pull/650
- Adding custom dataset file by @goswamig in https://github.com/meta-llama/llama-recipes/pull/659
- Make gradio and langchain optional dependencies by @mreso in https://github.com/meta-llama/llama-recipes/pull/676
- Update get_default_finetune_args.py by @edamamez in https://github.com/meta-llama/llama-recipes/pull/662
- Fix/custom dataset chat template by @mreso in https://github.com/meta-llama/llama-recipes/pull/665
- Create v0.0.4 release by @mreso in https://github.com/meta-llama/llama-recipes/pull/678
New Contributors
- @cynikolai made their first contribution in https://github.com/meta-llama/llama-recipes/pull/609
- @BakungaBronson made their first contribution in https://gith
- v0.0.3Llama-recipes v.0.0.3 Release Notes2024-07-23 · 2024-07-23 17:43 UTC
查看更新说明
Llama 3.1 Integration
This release accompanies the release of Llama 3.1 which included new versions of the Llama 8B and 70B models as well as the new 405B version. To get started with the new models you can find information in the official documentation or the on the HuggingFace hub. Further details can also be found in the model card and the Llama 3.1 paper. For this release we updated the documentation and made sure all components work with the new models.
- Release update by @albertodepaola @cynikolai @mreso @subramen @tryrobbo @varunfb in #603
New Features
We also added new features like FSDP + QLoRA fine-tuning and H2O algorithm for long context inference.
- Implement H2O for long context inference on summarization tasks by @Kyriection in #411
- Resume the fine-tuning process from the previous PEFT checkpoint folder by @wukaixingxp in #531
- Update hf weight conversion script to llama 3 by @dongwang218 in #551
- Adding support for FSDP+Qlora. by @HamidShojanazeri in #572
Additional Examples
Besides, we added new examples to get you up and running quickly with the Llama models
- Add Groq/Llama3 recipes (cookbook and command line examples) by @dloman118 in #553
- [WIP] Peft Finetuning Quickstart Notebook by @mreso in #558
- 4 notebooks ported from 4 DLAI agent short courses using Llama 3 by @jeffxtang in #560
- [lamini] Add lamini text2sql memory tuning tutorial by @powerjohnnyli in #573
- colab links fixed for dlai agents notebooks by @jeffxtang in #593
- Port of DLAI LlamaIndex Agent short course lessons 2-4 to use Llama 3 by @jeffxtang in #594
Codebase Refactor
We also refactored our codebase to improve discoverability of our documentation and recipes
- New structure and rename for tools, docs and quickstart folder by @pia-papanna in #575
- Add Langchain agent notebooks to 3P_Integrations by @subramen in #576
- Updates to benchmarks code by @subramen in #577
- Add README for quickstart + update to codellama url by @subramen in #578
- Updating the folder name 3p_integrations by @pia-papanna in #581
- Deleting Agents folder and adding llamaindex by @pia-papanna in #582
- Update 3p_integration README.md by [@subramen](https://github.c
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Welcome to the official repository for helping you get started with inference, fine-tuning and end-to-end use-cases of building with the Llama Model family.
This repository covers the most popular community approaches, use-cases and the latest recipes for Llama Text and Vision models.
Latest Llama 4 recipes
- Get started with Llama API
- Integrate Llama API with WhatsApp
- 5M long context using Llama 4 Scout
- Analyze research papers with Llama 4 Maverick
- Create a character mind map from a book using Llama 4 Maverick
Repository Structure:
- 3P Integrations: Getting Started Recipes and End to End Use-Cases from various Llama providers
- End to End Use Cases: As the name suggests, spanning various domains and applications
- Getting Started: Reference for inferencing, fine-tuning and RAG examples
- src: Contains the src for the original llama-recipes library along with some FAQs for fine-tuning.
Note: We recently did a refactor of the repo, archive-main is a snapshot branch from before the refactor
FAQ:
-
Q: What happened to llama-recipes? A: We recently renamed llama-recipes to llama-cookbook.
-
Q: I have some questions for Fine-Tuning, is there a section to address these? A: Check out the Fine-Tuning FAQ here.
-
Q: Some links are broken/folders are missing: A: We recently did a refactor of the repo, archive-main is a snapshot branch from before the refactor.
-
Q: Where can we find details about the latest models? A: Official Llama models website.
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
License
See the License file for Meta Llama 4 here and Acceptable Use Policy here
See the License file for Meta Llama 3.3 here and Acceptable Use Policy here
See the License file for Meta Llama 3.2 here and Acceptable Use Policy here
See the License file for Meta Llama 3.1 here and Acceptable Use Policy here
See the License file for Meta Llama 3 here and Acceptable Use Policy here
See the License file for Meta Llama 2 here and Acceptable Use Policy here