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

v0.0.5发布于 2025-01-22 18:56 UTC18,587star +4 / 7 天2,755fork同步于 2026-11-11 05:23 UTC

专家点评

上手难度:进阶更新于 2026-11-11

Meta 官方 Llama 示例库,用 notebook 顶替你自己从零搭的推理、微调、RAG 样板代码

适用场景

  • 第一次把 Llama 跑起来:想先确认模型能加载、能对话、能出 token,再谈别的。这里给的是能直接执行的 notebook,比翻 transformers 文档拼 demo 快,但别指望它替你处理环境
  • 微调方案选型阶段:需要看 LoRA、QLoRA、全参微调各自的脚本长什么样、参数怎么传,用来判断自己的数据量和卡数该走哪条路。自己写会漏掉 pad_token、梯度累积这些细节
  • 接第三方 Llama 托管服务:要对比 Together、Fireworks、Bedrock 这类 provider 的调用差异,仓库里有现成配方,省去逐个读各家 SDK 文档
  • 做 RAG 原型:需要一份能跑通的 LangChain + Llama 组合示例,用来验证检索链路是否成立,而不是自己从 embedding 到 prompt 拼一遍

踩坑

  • 仓库重构过,按 llama-recipes 旧名或旧链接找内容会 404,部分目录已移到 archive-main 快照分支。照网上教程走的时候会撞上
  • README 没给安装步骤和硬件要求,notebook 默认你已有模型权重或 Llama API 访问权限。clone 完直接跑第一个 cell 大概率卡在鉴权和依赖版本上
  • issue 里反复出现单卡加载大模型(13B 单卡)和 pad_token 最佳实践这两类问题,说明示例代码在显存边界和 tokenizer 配置上没给出确定答案,需要自己判断

同类对比

真要跑生产微调,用 axolotl 或 torchtune,配置化和可复现性比 notebook 强;只做推理部署则直接看 vLLM 的文档,不必经过这个仓库

怎么上手

由 README 提炼,执行前请确认
README 未说明
硬件要求按 README 说明

README 未说明

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 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 未给出安装步骤

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

4 个版本v0.0.5
  1. 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_recipes to llama_cookbook and deprecates the llama_recipes package name.

    Highlighted Changes


    What's Changed

  2. 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

  3. 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

    New and updated recipes

    Documentation update

    Misc fixes

    New Contributors

  4. 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.

    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

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    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

    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