🤗 Models on Hugging Face | Blog | Website | Get Started | Llama Cookbook
Llama is an accessible, open large language model (LLM) designed for developers, researchers, and businesses to build, experiment, and responsibly scale their generative AI ideas. Part of a foundational system, it serves as a bedrock for innovation in the global community. A few key aspects:
Our mission is to empower individuals and industry through this opportunity while fostering an environment of discovery and ethical AI advancements. The model weights are licensed for researchers and commercial entities, upholding the principles of openness.
| Model | Launch date | Model sizes | Context Length | Tokenizer | Acceptable use policy | License | Model Card |
|---|---|---|---|---|---|---|---|
| Llama 2 | 7/18/2023 | 7B, 13B, 70B | 4K | Sentencepiece | Use Policy | License | Model Card |
| Llama 3 | 4/18/2024 | 8B, 70B | 8K | TikToken-based | Use Policy | License | Model Card |
| Llama 3.1 | 7/23/2024 | 8B, 70B, 405B | 128K | TikToken-based | Use Policy | License | Model Card |
| Llama 3.2 | 9/25/2024 | 1B, 3B | 128K | TikToken-based | Use Policy | License | Model Card |
| Llama 3.2-Vision | 9/25/2024 | 11B, 90B | 128K | TikToken-based | Use Policy | License | Model Card |
| Llama 3.3 | 12/04/2024 | 70B | 128K | TikToken-based | Use Policy | License | Model Card |
| Llama 4 | 4/5/2025 | Scout-17B-16E, Maverick-17B-128E | 10M, 1M | TikToken-based | Use Policy | License | Model Card |
To download the model weights and tokenizer:
Visit the Meta Llama website.
Read and accept the license.
Once your request is approved you will receive a signed URL via email.
Install the Llama Models CLI: pip install llama-models. (<-- Start Here if you have received an email already.)
Run llama-model list to show the latest available models and determine the model ID you wish to download. NOTE:
If you want older versions of models, run llama-model list --show-all to show all the available Llama models.
Run: llama-model download --source meta --model-id CHOSEN_MODEL_ID
Pass the URL provided when prompted to start the download.
Remember that the links expire after 24 hours and a certain amount of downloads. You can always re-request a link if you start seeing errors such as 403: Forbidden.
Once installed, the llama-model CLI provides the following commands:
llama-model list # List available models
llama-model list --show-all # List all models (including older versions)
llama-model describe -m MODEL_ID # Show detailed information about a model
llama-model download # Download models from Meta or Hugging Face
llama-model verify-download # Verify integrity of downloaded models
llama-model remove -m MODEL_ID # Remove a downloaded model
llama-model prompt-format -m MODEL_ID # Show the prompt format for a model
For detailed help on any command, run llama-model COMMAND --help.
In order to run the models, you will need to install dependencies after checking out the repository.
# Run this within a suitable Python environment (uv, conda, or virtualenv)
pip install .[torch]
Example scripts are available in models/{ llama3, llama4 }/scripts/ sub-directory. Note that the Llama4 series of models require at least 4 GPUs to run inference at full (bf16) precision.
#!/bin/bash
NGPUS=4
CHECKPOINT_DIR=~/.llama/checkpoints/Llama-4-Scout-17B-16E-Instruct
PYTHONPATH=$(git rev-parse --show-toplevel) \
torchrun --nproc_per_node=$NGPUS \
-m models.llama4.scripts.chat_completion $CHECKPOINT_DIR \
--world_size $NGPUS
The above script should be used with an Instruct (Chat) model. For a Base model, update the CHECKPOINT_DIR path and use the script models.llama4.scripts.completion.
You can reduce the memory footprint of the models at the cost of minimal loss in accuracy by running inference with FP8 or Int4 quantization. Use the --quantization-mode flag to specify the quantization mode. There are two modes:
fp8_mixed: Mixed precision inference with FP8 for some weights and bfloat16 for activations.int4_mixed: Mixed precision inference with Int4 for some weights and bfloat16 for activations.Using FP8, running Llama-4-Scout-17B-16E-Instruct requires 2 GPUs with 80GB of memory. Using Int4, you need a single GPU with 80GB of memory.
MODE=fp8_mixed # or int4_mixed
if [ $MODE == "fp8_mixed" ]; then
NGPUS=2
else
NGPUS=1
fi
CHECKPOINT_DIR=~/.llama/checkpoints/Llama-4-Scout-17B-16E-Instruct
PYTHONPATH=$(git rev-parse --show-toplevel) \
torchrun --nproc_per_node=$NGPUS \
-m models.llama4.scripts.chat_completion $CHECKPOINT_DIR \
--world_size $NGPUS \
--quantization-mode $MODE
For more flexibility in running inference (including using other providers), please see the Llama Stack toolset.
We also provide downloads on Hugging Face, in both transformers and native llama4 formats. To download the weights from Hugging Face, please follow these steps:
original folder. You can also download them from the command line if you pip install huggingface-hub:huggingface-cli download meta-llama/Llama-4-Scout-17B-16E-Instruct-Original --local-dir meta-llama/Llama-4-Scout-17B-16E-Instruct-Original
To use with transformers, the following snippet will download and cache the weights:
# inference.py
from transformers import AutoTokenizer, Llama4ForConditionalGeneration
import torch
model_id = "meta-llama/Llama-4-Scout-17B-16E-Instruct"
tokenizer = AutoTokenizer.from_pretrained(model_id)
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, return_tensors="pt", return_dict=True
)
model = Llama4ForConditionalGeneration.from_pretrained(
model_id, device_map="auto", torch_dtype=torch.bfloat16
)
outputs = model.generate(**inputs.to(model.device), max_new_tokens=100)
outputs = tokenizer.batch_decode(outputs[:, inputs["input_ids"].shape[-1] :])
print(outputs[0])
torchrun --nnodes=1 --nproc_per_node=8 inference.py
You can install this repository as a package by just doing pip install llama-models
Llama models are a new technology that carries potential risks with use. Testing conducted to date has not — and could not — cover all scenarios. To help developers address these risks, we have created the Responsible Use Guide.
Please report any software “bug” or other problems with the models through one of the following means:
For common questions, the FAQ can be found here, which will be updated over time as new questions arise.
Python
100.0%
🤗 Models on Hugging Face | Blog | Website | Get Started | Llama Cookbook
Llama is an accessible, open large language model (LLM) designed for developers, researchers, and businesses to build, experiment, and responsibly scale their generative AI ideas. Part of a foundational system, it serves as a bedrock for innovation in the global community. A few key aspects:
Our mission is to empower individuals and industry through this opportunity while fostering an environment of discovery and ethical AI advancements. The model weights are licensed for researchers and commercial entities, upholding the principles of openness.
| Model | Launch date | Model sizes | Context Length | Tokenizer | Acceptable use policy | License | Model Card |
|---|---|---|---|---|---|---|---|
| Llama 2 | 7/18/2023 | 7B, 13B, 70B | 4K | Sentencepiece | Use Policy | License | Model Card |
| Llama 3 | 4/18/2024 | 8B, 70B | 8K | TikToken-based | Use Policy | License | Model Card |
| Llama 3.1 | 7/23/2024 | 8B, 70B, 405B | 128K | TikToken-based | Use Policy | License | Model Card |
| Llama 3.2 | 9/25/2024 | 1B, 3B | 128K | TikToken-based | Use Policy | License | Model Card |
| Llama 3.2-Vision | 9/25/2024 | 11B, 90B | 128K | TikToken-based | Use Policy | License | Model Card |
| Llama 3.3 | 12/04/2024 | 70B | 128K | TikToken-based | Use Policy | License | Model Card |
| Llama 4 | 4/5/2025 | Scout-17B-16E, Maverick-17B-128E | 10M, 1M | TikToken-based | Use Policy | License | Model Card |
To download the model weights and tokenizer:
Visit the Meta Llama website.
Read and accept the license.
Once your request is approved you will receive a signed URL via email.
Install the Llama Models CLI: pip install llama-models. (<-- Start Here if you have received an email already.)
Run llama-model list to show the latest available models and determine the model ID you wish to download. NOTE:
If you want older versions of models, run llama-model list --show-all to show all the available Llama models.
Run: llama-model download --source meta --model-id CHOSEN_MODEL_ID
Pass the URL provided when prompted to start the download.
Remember that the links expire after 24 hours and a certain amount of downloads. You can always re-request a link if you start seeing errors such as 403: Forbidden.
Once installed, the llama-model CLI provides the following commands:
llama-model list # List available models
llama-model list --show-all # List all models (including older versions)
llama-model describe -m MODEL_ID # Show detailed information about a model
llama-model download # Download models from Meta or Hugging Face
llama-model verify-download # Verify integrity of downloaded models
llama-model remove -m MODEL_ID # Remove a downloaded model
llama-model prompt-format -m MODEL_ID # Show the prompt format for a model
For detailed help on any command, run llama-model COMMAND --help.
In order to run the models, you will need to install dependencies after checking out the repository.
# Run this within a suitable Python environment (uv, conda, or virtualenv)
pip install .[torch]
Example scripts are available in models/{ llama3, llama4 }/scripts/ sub-directory. Note that the Llama4 series of models require at least 4 GPUs to run inference at full (bf16) precision.
#!/bin/bash
NGPUS=4
CHECKPOINT_DIR=~/.llama/checkpoints/Llama-4-Scout-17B-16E-Instruct
PYTHONPATH=$(git rev-parse --show-toplevel) \
torchrun --nproc_per_node=$NGPUS \
-m models.llama4.scripts.chat_completion $CHECKPOINT_DIR \
--world_size $NGPUS
The above script should be used with an Instruct (Chat) model. For a Base model, update the CHECKPOINT_DIR path and use the script models.llama4.scripts.completion.
You can reduce the memory footprint of the models at the cost of minimal loss in accuracy by running inference with FP8 or Int4 quantization. Use the --quantization-mode flag to specify the quantization mode. There are two modes:
fp8_mixed: Mixed precision inference with FP8 for some weights and bfloat16 for activations.int4_mixed: Mixed precision inference with Int4 for some weights and bfloat16 for activations.Using FP8, running Llama-4-Scout-17B-16E-Instruct requires 2 GPUs with 80GB of memory. Using Int4, you need a single GPU with 80GB of memory.
MODE=fp8_mixed # or int4_mixed
if [ $MODE == "fp8_mixed" ]; then
NGPUS=2
else
NGPUS=1
fi
CHECKPOINT_DIR=~/.llama/checkpoints/Llama-4-Scout-17B-16E-Instruct
PYTHONPATH=$(git rev-parse --show-toplevel) \
torchrun --nproc_per_node=$NGPUS \
-m models.llama4.scripts.chat_completion $CHECKPOINT_DIR \
--world_size $NGPUS \
--quantization-mode $MODE
For more flexibility in running inference (including using other providers), please see the Llama Stack toolset.
We also provide downloads on Hugging Face, in both transformers and native llama4 formats. To download the weights from Hugging Face, please follow these steps:
original folder. You can also download them from the command line if you pip install huggingface-hub:huggingface-cli download meta-llama/Llama-4-Scout-17B-16E-Instruct-Original --local-dir meta-llama/Llama-4-Scout-17B-16E-Instruct-Original
To use with transformers, the following snippet will download and cache the weights:
# inference.py
from transformers import AutoTokenizer, Llama4ForConditionalGeneration
import torch
model_id = "meta-llama/Llama-4-Scout-17B-16E-Instruct"
tokenizer = AutoTokenizer.from_pretrained(model_id)
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, return_tensors="pt", return_dict=True
)
model = Llama4ForConditionalGeneration.from_pretrained(
model_id, device_map="auto", torch_dtype=torch.bfloat16
)
outputs = model.generate(**inputs.to(model.device), max_new_tokens=100)
outputs = tokenizer.batch_decode(outputs[:, inputs["input_ids"].shape[-1] :])
print(outputs[0])
torchrun --nnodes=1 --nproc_per_node=8 inference.py
You can install this repository as a package by just doing pip install llama-models
Llama models are a new technology that carries potential risks with use. Testing conducted to date has not — and could not — cover all scenarios. To help developers address these risks, we have created the Responsible Use Guide.
Please report any software “bug” or other problems with the models through one of the following means:
For common questions, the FAQ can be found here, which will be updated over time as new questions arise.
Python
100.0%