Skip to content

Commit fe51935

Browse files
committed
Merge branch 'main' into feature/flop_counter
2 parents 03f1ca7 + 6e52cb9 commit fe51935

37 files changed

+1318
-439
lines changed

LICENSE

Lines changed: 0 additions & 125 deletions
This file was deleted.

README.md

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,37 @@
11
# Llama Recipes: Examples to get started using the Llama models from Meta
2-
3-
The 'llama-recipes' repository is a companion to the [Llama 2 model](https://github.com/facebookresearch/llama). The goal of this repository is to provide a scalable library for fine-tuning Llama 2, along with some example scripts and notebooks to quickly get started with using the Llama 2 models in a variety of use-cases, including fine-tuning for domain adaptation and building LLM-based applications with Llama 2 and other tools in the LLM ecosystem. The examples here showcase how to run Llama 2 locally, in the cloud, and on-prem.
4-
2+
<!-- markdown-link-check-disable -->
3+
The 'llama-recipes' repository is a companion to the [Meta Llama 2](https://github.com/meta-llama/llama) and [Meta Llama 3](https://github.com/meta-llama/llama3) models. The goal of this repository is to provide a scalable library for fine-tuning Meta Llama models, along with some example scripts and notebooks to quickly get started with using the models in a variety of use-cases, including fine-tuning for domain adaptation and building LLM-based applications with Meta Llama and other tools in the LLM ecosystem. The examples here showcase how to run Meta Llama locally, in the cloud, and on-prem.
4+
<!-- markdown-link-check-enable -->
5+
> [!IMPORTANT]
6+
> Llama 3 has a new prompt template and special tokens (based on the tiktoken tokenizer).
7+
> | Token | Description |
8+
> |---|---|
9+
> `<\|begin_of_text\|>` | This is equivalent to the BOS token. |
10+
> `<\|eot_id\|>` | This signifies the end of the message in a turn. |
11+
> `<\|start_header_id\|>{role}<\|end_header_id\|>` | These tokens enclose the role for a particular message. The possible roles can be: system, user, assistant. |
12+
> `<\|end_of_text\|>` | This is equivalent to the EOS token. On generating this token, Llama 3 will cease to generate more tokens |
13+
>
14+
> A multiturn-conversation with Llama 3 follows this prompt template:
15+
> ```
16+
> <|begin_of_text|><|start_header_id|>system<|end_header_id|>
17+
>
18+
> {{ system_prompt }}<|eot_id|><|start_header_id|>user<|end_header_id|>
19+
>
20+
> {{ user_message_1 }}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
21+
>
22+
> {{ model_answer_1 }}<|eot_id|><|start_header_id|>user<|end_header_id|>
23+
>
24+
> {{ user_message_2 }}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
25+
> ```
26+
> More details on the new tokenizer and prompt template: <PLACEHOLDER_URL>
527
> [!NOTE]
628
> The llama-recipes repository was recently refactored to promote a better developer experience of using the examples. Some files have been moved to new locations. The `src/` folder has NOT been modified, so the functionality of this repo and package is not impacted.
729
>
830
> Make sure you update your local clone by running `git pull origin main`
931
1032
## Table of Contents
1133
12-
- [Llama Recipes: Examples to get started using the Llama models from Meta](#llama-recipes-examples-to-get-started-using-the-llama-models-from-meta)
34+
- [Llama Recipes: Examples to get started using the Meta Llama models from Meta](#llama-recipes-examples-to-get-started-using-the-llama-models-from-meta)
1335
- [Table of Contents](#table-of-contents)
1436
- [Getting Started](#getting-started)
1537
- [Prerequisites](#prerequisites)
@@ -76,11 +98,11 @@ pip install --extra-index-url https://download.pytorch.org/whl/test/cu118 -e .[t
7698
```
7799
78100
79-
### Getting the Llama models
80-
You can find Llama 2 models on Hugging Face hub [here](https://huggingface.co/meta-llama), **where models with `hf` in the name are already converted to Hugging Face checkpoints so no further conversion is needed**. The conversion step below is only for original model weights from Meta that are hosted on Hugging Face model hub as well.
101+
### Getting the Meta Llama models
102+
You can find Meta Llama models on Hugging Face hub [here](https://huggingface.co/meta-llama), **where models with `hf` in the name are already converted to Hugging Face checkpoints so no further conversion is needed**. The conversion step below is only for original model weights from Meta that are hosted on Hugging Face model hub as well.
81103
82104
#### Model conversion to Hugging Face
83-
The recipes and notebooks in this folder are using the Llama 2 model definition provided by Hugging Face's transformers library.
105+
The recipes and notebooks in this folder are using the Meta Llama model definition provided by Hugging Face's transformers library.
84106
85107
Given that the original checkpoint resides under models/7B you can install all requirements and convert the checkpoint with:
86108
@@ -105,15 +127,15 @@ Most of the code dealing with Llama usage is organized across 2 main folders: `r
105127
Contains examples are organized in folders by topic:
106128
| Subfolder | Description |
107129
|---|---|
108-
[quickstart](./recipes/quickstart) | The "Hello World" of using Llama2, start here if you are new to using Llama2.
109-
[finetuning](./recipes/finetuning)|Scripts to finetune Llama2 on single-GPU and multi-GPU setups
110-
[inference](./recipes/inference)|Scripts to deploy Llama2 for inference locally and using model servers
130+
[quickstart](./recipes/quickstart) | The "Hello World" of using Llama, start here if you are new to using Llama.
131+
[finetuning](./recipes/finetuning)|Scripts to finetune Llama on single-GPU and multi-GPU setups
132+
[inference](./recipes/inference)|Scripts to deploy Llama for inference locally and using model servers
111133
[use_cases](./recipes/use_cases)|Scripts showing common applications of Llama2
112134
[responsible_ai](./recipes/responsible_ai)|Scripts to use PurpleLlama for safeguarding model outputs
113135
[llama_api_providers](./recipes/llama_api_providers)|Scripts to run inference on Llama via hosted endpoints
114-
[benchmarks](./recipes/benchmarks)|Scripts to benchmark Llama 2 models inference on various backends
136+
[benchmarks](./recipes/benchmarks)|Scripts to benchmark Llama models inference on various backends
115137
[code_llama](./recipes/code_llama)|Scripts to run inference with the Code Llama models
116-
[evaluation](./recipes/evaluation)|Scripts to evaluate fine-tuned Llama2 models using `lm-evaluation-harness` from `EleutherAI`
138+
[evaluation](./recipes/evaluation)|Scripts to evaluate fine-tuned Llama models using `lm-evaluation-harness` from `EleutherAI`
117139

118140
### `src/`
119141

@@ -133,5 +155,8 @@ Contains modules which support the example recipes:
133155
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
134156

135157
## License
136-
See the License file [here](LICENSE) and Acceptable Use Policy [here](USE_POLICY.md)
158+
<!-- markdown-link-check-disable -->
159+
See the License file for Meta Llama 2 [here](https://llama.meta.com/llama2/license/) and Acceptable Use Policy [here](https://llama.meta.com/llama2/use-policy/)
137160

161+
See the License file for Meta Llama 3 [here](https://llama.meta.com/llama3/license/) and Acceptable Use Policy [here](https://llama.meta.com/llama3/use-policy/)
162+
<!-- markdown-link-check-enable -->

USE_POLICY.md

Lines changed: 0 additions & 49 deletions
This file was deleted.

recipes/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ This folder contains examples organized by topic:
22

33
| Subfolder | Description |
44
|---|---|
5-
[quickstart](./quickstart) | The "Hello World" of using Llama2, start here if you are new to using Llama2.
5+
[quickstart](./quickstart)|The "Hello World" of using Llama2, start here if you are new to using Llama2
6+
[multilingual](./multilingual)|Scripts to add a new language to Llama2
67
[finetuning](./finetuning)|Scripts to finetune Llama2 on single-GPU and multi-GPU setups
78
[inference](./inference)|Scripts to deploy Llama2 for inference locally and using model servers
89
[use_cases](./use_cases)|Scripts showing common applications of Llama2

0 commit comments

Comments
 (0)