{"id":13477896,"url":"https://github.com/meta-llama/llama-models","last_synced_at":"2025-05-13T17:02:31.798Z","repository":{"id":249839433,"uuid":"821134374","full_name":"meta-llama/llama-models","owner":"meta-llama","description":"Utilities intended for use with Llama models.","archived":false,"fork":false,"pushed_at":"2025-05-02T21:15:43.000Z","size":4434,"stargazers_count":6962,"open_issues_count":116,"forks_count":1142,"subscribers_count":95,"default_branch":"main","last_synced_at":"2025-05-06T16:11:15.471Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/meta-llama.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-06-27T22:14:09.000Z","updated_at":"2025-05-06T07:11:01.000Z","dependencies_parsed_at":"2024-08-05T22:17:53.246Z","dependency_job_id":"a36c9f94-4978-48e2-bf22-073f4f91da97","html_url":"https://github.com/meta-llama/llama-models","commit_stats":{"total_commits":154,"total_committers":32,"mean_commits":4.8125,"dds":0.5714285714285714,"last_synced_commit":"3a5906d138313fa30eec49eb13b209aabf153ed0"},"previous_names":["meta-llama/llama-models"],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meta-llama%2Fllama-models","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meta-llama%2Fllama-models/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meta-llama%2Fllama-models/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meta-llama%2Fllama-models/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meta-llama","download_url":"https://codeload.github.com/meta-llama/llama-models/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253990449,"owners_count":21995773,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T16:01:49.354Z","updated_at":"2025-05-13T17:02:31.689Z","avatar_url":"https://github.com/meta-llama.png","language":"Python","funding_links":[],"categories":["Python","🧠 SOTA 2024-2025: Mobile LLMs \u0026 Multimodal","Project List","🆕 New and Emerging AI Tools","Resources","HarmonyOS","A01_文本生成_文本对话","2. Model Codebases \u0026 Model Families"],"sub_categories":["🤖 On-Device Large Language Models","\u003cspan id=\"tool\"\u003eLLM (LLM \u0026 Tool)\u003c/span\u003e","Other Cloud Provider Credits","Pretrained Language Models","Windows Manager","大语言对话模型及数据"],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"/Llama_Repo.jpeg\" width=\"400\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n        🤗 \u003ca href=\"https://huggingface.co/meta-Llama\"\u003e Models on Hugging Face\u003c/a\u003e\u0026nbsp | \u003ca href=\"https://ai.meta.com/blog/\"\u003e Blog\u003c/a\u003e\u0026nbsp |  \u003ca href=\"https://llama.meta.com/\"\u003eWebsite\u003c/a\u003e\u0026nbsp | \u003ca href=\"https://llama.meta.com/get-started/\"\u003eGet Started\u003c/a\u003e\u0026nbsp | \u003ca href=\"https://github.com/meta-llama/llama-cookbook\"\u003eLlama Cookbook\u003c/a\u003e\u0026nbsp\n\u003cbr\u003e\n\n---\n\n# Llama Models\n\nLlama 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:\n1. **Open access**: Easy accessibility to cutting-edge large language models, fostering collaboration and advancements among developers, researchers, and organizations\n2. **Broad ecosystem**: Llama models have been downloaded hundreds of millions of times, there are thousands of community projects built on Llama and platform support is broad from cloud providers to startups - the world is building with Llama!\n3. **Trust \u0026 safety**: Llama models are part of a comprehensive approach to trust and safety, releasing models and tools that are designed to enable community collaboration and encourage the standardization of the development and usage of trust and safety tools for generative AI\n\nOur 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.\n\n## Llama Models\n\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/llama-models)](https://pypi.org/project/llama-models/)\n[![Discord](https://img.shields.io/discord/1257833999603335178)](https://discord.gg/TZAAYNVtrU)\n\n|  **Model** | **Launch date** | **Model sizes** | **Context Length** | **Tokenizer** | **Acceptable use policy**  |  **License** | **Model Card** |\n| :----: | :----: | :----: | :----:|:----:|:----:|:----:|:----:|\n| Llama 2 | 7/18/2023 | 7B, 13B, 70B | 4K | Sentencepiece | [Use Policy](models/llama2/USE_POLICY.md) | [License](models/llama2/LICENSE) | [Model Card](models/llama2/MODEL_CARD.md) |\n| Llama 3 | 4/18/2024 | 8B, 70B | 8K | TikToken-based | [Use Policy](models/llama3/USE_POLICY.md) | [License](models/llama3/LICENSE) | [Model Card](models/llama3/MODEL_CARD.md) |\n| Llama 3.1 | 7/23/2024 | 8B, 70B, 405B | 128K | TikToken-based | [Use Policy](models/llama3_1/USE_POLICY.md) | [License](models/llama3_1/LICENSE) | [Model Card](models/llama3_1/MODEL_CARD.md) |\n| Llama 3.2 | 9/25/2024 | 1B, 3B | 128K | TikToken-based | [Use Policy](models/llama3_2/USE_POLICY.md) | [License](models/llama3_2/LICENSE) | [Model Card](models/llama3_2/MODEL_CARD.md) |\n| Llama 3.2-Vision | 9/25/2024 | 11B, 90B | 128K | TikToken-based | [Use Policy](models/llama3_2/USE_POLICY.md) | [License](models/llama3_2/LICENSE) | [Model Card](models/llama3_2/MODEL_CARD_VISION.md) |\n| Llama 3.3 | 12/04/2024 | 70B | 128K | TikToken-based | [Use Policy](models/llama3_3/USE_POLICY.md) | [License](models/llama3_3/LICENSE) | [Model Card](models/llama3_3/MODEL_CARD.md) |\n| Llama 4 | 4/5/2025 | Scout-17B-16E, Maverick-17B-128E | 10M, 1M | TikToken-based | [Use Policy](models/llama4/USE_POLICY.md) | [License](models/llama4/LICENSE) | [Model Card](models/llama4/MODEL_CARD.md) |\n\n## Download\n\nTo download the model weights and tokenizer:\n\n1. Visit the [Meta Llama website](https://llama.meta.com/llama-downloads/).\n2. Read and accept the license.\n3. Once your request is approved you will receive a signed URL via email.\n4. Install the [Llama CLI](https://github.com/meta-llama/llama-stack): `pip install llama-stack`. (**\u003c-- Start Here if you have received an email already.**)\n5. Run `llama model list` to show the latest available models and determine the model ID you wish to download. **NOTE**:\nIf you want older versions of models, run `llama model list --show-all` to show all the available Llama models.\n\n6. Run: `llama download --source meta --model-id CHOSEN_MODEL_ID`\n7. Pass the URL provided when prompted to start the download.\n\nRemember 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`.\n\n## Running the models\n\nIn order to run the models, you will need to install dependencies after checking out the repository.\n\n```bash\n# Run this within a suitable Python environment (uv, conda, or virtualenv)\npip install .[torch]\n```\n\nExample 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.\n\n```bash\n#!/bin/bash\n\nNGPUS=4\nCHECKPOINT_DIR=~/.llama/checkpoints/Llama-4-Scout-17B-16E-Instruct\nPYTHONPATH=$(git rev-parse --show-toplevel) \\\n  torchrun --nproc_per_node=$NGPUS \\\n  -m models.llama4.scripts.chat_completion $CHECKPOINT_DIR \\\n  --world_size $NGPUS\n```\n\nThe 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`.\n\n\n## Running inference with FP8 and Int4 Quantization\n\nYou 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:\n- `fp8_mixed`: Mixed precision inference with FP8 for some weights and bfloat16 for activations.\n- `int4_mixed`: Mixed precision inference with Int4 for some weights and bfloat16 for activations.\n\nUsing 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.\n\n```bash\nMODE=fp8_mixed  # or int4_mixed\nif [ $MODE == \"fp8_mixed\" ]; then\n  NGPUS=2\nelse\n  NGPUS=1\nfi\nCHECKPOINT_DIR=~/.llama/checkpoints/Llama-4-Scout-17B-16E-Instruct\nPYTHONPATH=$(git rev-parse --show-toplevel) \\\n  torchrun --nproc_per_node=$NGPUS \\\n  -m models.llama4.scripts.chat_completion $CHECKPOINT_DIR \\\n  --world_size $NGPUS \\\n  --quantization-mode $MODE\n```\n\n\nFor more flexibility in running inference (including using other providers), please see the [`Llama Stack`](https://github.com/meta-llama/llama-stack) toolset.\n\n\n## Access to Hugging Face\n\nWe also provide downloads on [Hugging Face](https://huggingface.co/meta-llama), in both transformers and native `llama4` formats. To download the weights from Hugging Face, please follow these steps:\n\n- Visit one of the repos, for example [meta-llama/Llama-4-Scout-17B-16E](https://huggingface.co/meta-llama/Llama-4-Scout-17B-16E).\n- Read and accept the license. Once your request is approved, you'll be granted access to all Llama 3.1 models as well as previous versions. Note that requests used to take up to one hour to get processed.\n- To download the original native weights to use with this repo, click on the \"Files and versions\" tab and download the contents of the `original` folder. You can also download them from the command line if you `pip install huggingface-hub`:\n\n```bash\nhuggingface-cli download meta-llama/Llama-4-Scout-17B-16E-Instruct-Original --local-dir meta-llama/Llama-4-Scout-17B-16E-Instruct-Original\n```\n\n- To use with transformers, the following snippet will download and cache the weights:\n\n  ```python\n  # inference.py\n  from transformers import AutoTokenizer, Llama4ForConditionalGeneration\n  import torch\n\n  model_id = \"meta-llama/Llama-4-Scout-17B-16E-Instruct\"\n\n  tokenizer = AutoTokenizer.from_pretrained(model_id)\n\n  messages = [\n      {\"role\": \"user\", \"content\": \"Who are you?\"},\n  ]\n  inputs = tokenizer.apply_chat_template(\n      messages, add_generation_prompt=True, return_tensors=\"pt\", return_dict=True\n  )\n\n  model = Llama4ForConditionalGeneration.from_pretrained(\n      model_id, device_map=\"auto\", torch_dtype=torch.bfloat16\n  )\n\n  outputs = model.generate(**inputs.to(model.device), max_new_tokens=100)\n  outputs = tokenizer.batch_decode(outputs[:, inputs[\"input_ids\"].shape[-1] :])\n  print(outputs[0])\n  ```\n  ```bash\n   torchrun --nnodes=1 --nproc_per_node=8 inference.py\n   ```\n\n## Installations\n\nYou can install this repository as a [package](https://pypi.org/project/llama-models/) by just doing `pip install llama-models`\n\n## Responsible Use\n\nLlama models are a new technology that carries potential risks with use. Testing conducted to date has not — and could not — cover all scenarios.\nTo help developers address these risks, we have created the [Responsible Use Guide](https://ai.meta.com/static-resource/responsible-use-guide/).\n\n## Issues\n\nPlease report any software “bug” or other problems with the models through one of the following means:\n- Reporting issues with the model: [https://github.com/meta-llama/llama-models/issues](https://github.com/meta-llama/llama-models/issues)\n- Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)\n- Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)\n\n\n## Questions\n\nFor common questions, the FAQ can be found [here](https://llama.meta.com/faq), which will be updated over time as new questions arise.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeta-llama%2Fllama-models","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeta-llama%2Fllama-models","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeta-llama%2Fllama-models/lists"}