|
@@ -4,8 +4,8 @@
|
|
"cell_type": "markdown",
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"metadata": {},
|
|
"source": [
|
|
"source": [
|
|
- "## Running Meta Llama 3 on Google Colab using Hugging Face transformers library\n",
|
|
|
|
- "This notebook goes over how you can set up and run Llama 3 using Hugging Face transformers library\n",
|
|
|
|
|
|
+ "## Running Meta Llama 3.1 on Google Colab using Hugging Face transformers library\n",
|
|
|
|
+ "This notebook goes over how you can set up and run Llama 3.1 using Hugging Face transformers library\n",
|
|
"<a href=\"https://colab.research.google.com/github/meta-llama/llama-recipes/blob/main/recipes/quickstart/Running_Llama2_Anywhere/Running_Llama_on_HF_transformers.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
|
|
"<a href=\"https://colab.research.google.com/github/meta-llama/llama-recipes/blob/main/recipes/quickstart/Running_Llama2_Anywhere/Running_Llama_on_HF_transformers.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
|
|
]
|
|
]
|
|
},
|
|
},
|
|
@@ -14,7 +14,7 @@
|
|
"metadata": {},
|
|
"metadata": {},
|
|
"source": [
|
|
"source": [
|
|
"### Steps at a glance:\n",
|
|
"### Steps at a glance:\n",
|
|
- "This demo showcases how to run the example with already converted Llama 3 weights on [Hugging Face](https://huggingface.co/meta-llama). Please Note: To use the downloads on Hugging Face, you must first request a download as shown in the steps below making sure that you are using the same email address as your Hugging Face account.\n",
|
|
|
|
|
|
+ "This demo showcases how to run the example with already converted Llama 3.1 weights on [Hugging Face](https://huggingface.co/meta-llama). Please Note: To use the downloads on Hugging Face, you must first request a download as shown in the steps below making sure that you are using the same email address as your Hugging Face account.\n",
|
|
"\n",
|
|
"\n",
|
|
"To use already converted weights, start here:\n",
|
|
"To use already converted weights, start here:\n",
|
|
"1. Request download of model weights from the Llama website\n",
|
|
"1. Request download of model weights from the Llama website\n",
|
|
@@ -45,7 +45,7 @@
|
|
"Request download of model weights from the Llama website\n",
|
|
"Request download of model weights from the Llama website\n",
|
|
"Before you can run the model locally, you will need to get the model weights. To get the model weights, visit the [Llama website](https://llama.meta.com/) and click on “download models”. \n",
|
|
"Before you can run the model locally, you will need to get the model weights. To get the model weights, visit the [Llama website](https://llama.meta.com/) and click on “download models”. \n",
|
|
"\n",
|
|
"\n",
|
|
- "Fill the required information, select the models “Meta Llama 3” and accept the terms & conditions. You will receive a URL in your email in a short time."
|
|
|
|
|
|
+ "Fill the required information, select the models “Meta Llama 3.1” and accept the terms & conditions. You will receive a URL in your email in a short time."
|
|
]
|
|
]
|
|
},
|
|
},
|
|
{
|
|
{
|
|
@@ -94,7 +94,7 @@
|
|
"source": [
|
|
"source": [
|
|
"Then, we will set the model variable to a specific model we’d like to use. In this demo, we will use the 8b chat model `meta-llama/Meta-Llama-3.1-8B-Instruct`. Using Meta models from Hugging Face requires you to\n",
|
|
"Then, we will set the model variable to a specific model we’d like to use. In this demo, we will use the 8b chat model `meta-llama/Meta-Llama-3.1-8B-Instruct`. Using Meta models from Hugging Face requires you to\n",
|
|
"\n",
|
|
"\n",
|
|
- "1. Accept Terms of Service for Meta Llama 3 on Meta [website](https://llama.meta.com/llama-downloads).\n",
|
|
|
|
|
|
+ "1. Accept Terms of Service for Meta Llama 3.1 on Meta [website](https://llama.meta.com/llama-downloads).\n",
|
|
"2. Use the same email address from Step (1) to login into Hugging Face.\n",
|
|
"2. Use the same email address from Step (1) to login into Hugging Face.\n",
|
|
"\n",
|
|
"\n",
|
|
"Follow the instructions on this Hugging Face page to login from your [terminal](https://huggingface.co/docs/huggingface_hub/en/quick-start). "
|
|
"Follow the instructions on this Hugging Face page to login from your [terminal](https://huggingface.co/docs/huggingface_hub/en/quick-start). "
|
|
@@ -208,7 +208,7 @@
|
|
"#### 2. Clone the llama repo and get the weights\n",
|
|
"#### 2. Clone the llama repo and get the weights\n",
|
|
"Git clone the [Meta Llama 3 repo](https://github.com/meta-llama/llama3). Run the `download.sh` script and follow the instructions. This will download the model checkpoints and tokenizer.\n",
|
|
"Git clone the [Meta Llama 3 repo](https://github.com/meta-llama/llama3). Run the `download.sh` script and follow the instructions. This will download the model checkpoints and tokenizer.\n",
|
|
"\n",
|
|
"\n",
|
|
- "This example demonstrates a Meta Llama 3 model with 8B-instruct parameters, but the steps we follow would be similar for other llama models, as well as for other parameter models."
|
|
|
|
|
|
+ "This example demonstrates a Meta Llama 3.1 model with 8B-instruct parameters, but the steps we follow would be similar for other llama models, as well as for other parameter models."
|
|
]
|
|
]
|
|
},
|
|
},
|
|
{
|
|
{
|
|
@@ -223,7 +223,7 @@
|
|
"* `cd transformers`\n",
|
|
"* `cd transformers`\n",
|
|
"* `pip install -e .`\n",
|
|
"* `pip install -e .`\n",
|
|
"* `pip install torch tiktoken blobfile accelerate`\n",
|
|
"* `pip install torch tiktoken blobfile accelerate`\n",
|
|
- "* `python3 src/transformers/models/llama/convert_llama_weights_to_hf.py --input_dir ${path_to_meta_downloaded_model} --output_dir ${path_to_save_converted_hf_model} --model_size 8B --llama_version 3`"
|
|
|
|
|
|
+ "* `python3 src/transformers/models/llama/convert_llama_weights_to_hf.py --input_dir ${path_to_meta_downloaded_model} --output_dir ${path_to_save_converted_hf_model} --model_size 8B --llama_version 3.1`"
|
|
]
|
|
]
|
|
},
|
|
},
|
|
{
|
|
{
|
|
@@ -233,7 +233,7 @@
|
|
"\n",
|
|
"\n",
|
|
"#### 4. Prepare the script\n",
|
|
"#### 4. Prepare the script\n",
|
|
"Import the following necessary modules in your script: \n",
|
|
"Import the following necessary modules in your script: \n",
|
|
- "* `AutoModel` is the Llama 2 model class\n",
|
|
|
|
|
|
+ "* `AutoModel` is the Llama 3 model class\n",
|
|
"* `AutoTokenizer` prepares your prompt for the model to process\n",
|
|
"* `AutoTokenizer` prepares your prompt for the model to process\n",
|
|
"* `pipeline` is an abstraction to generate model outputs"
|
|
"* `pipeline` is an abstraction to generate model outputs"
|
|
]
|
|
]
|