NietWitt commited on
Commit
4f8e997
1 Parent(s): 1bf9ef9

Upload 16 files

Browse files
.gitignore ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/#use-with-ide
110
+ .pdm.toml
111
+
112
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
+ __pypackages__/
114
+
115
+ # Celery stuff
116
+ celerybeat-schedule
117
+ celerybeat.pid
118
+
119
+ # SageMath parsed files
120
+ *.sage.py
121
+
122
+ # Environments
123
+ .env
124
+ .venv
125
+ env/
126
+ venv/
127
+ ENV/
128
+ env.bak/
129
+ venv.bak/
130
+
131
+ # Spyder project settings
132
+ .spyderproject
133
+ .spyproject
134
+
135
+ # Rope project settings
136
+ .ropeproject
137
+
138
+ # mkdocs documentation
139
+ /site
140
+
141
+ # mypy
142
+ .mypy_cache/
143
+ .dmypy.json
144
+ dmypy.json
145
+
146
+ # Pyre type checker
147
+ .pyre/
148
+
149
+ # pytype static type analyzer
150
+ .pytype/
151
+
152
+ # Cython debug symbols
153
+ cython_debug/
154
+
155
+ # PyCharm
156
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
159
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
+ #.idea/
CODE_OF_CONDUCT.md ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to make participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies within all project spaces, and it also applies when
49
+ an individual is representing the project or its community in public spaces.
50
+ Examples of representing a project or community include using an official
51
+ project e-mail address, posting via an official social media account, or acting
52
+ as an appointed representative at an online or offline event. Representation of
53
+ a project may be further defined and clarified by project maintainers.
54
+
55
+ This Code of Conduct also applies outside the project spaces when there is a
56
+ reasonable belief that an individual's behavior may have a negative impact on
57
+ the project or its community.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported by contacting the project team at <opensource-conduct@meta.com>. All
63
+ complaints will be reviewed and investigated and will result in a response that
64
+ is deemed necessary and appropriate to the circumstances. The project team is
65
+ obligated to maintain confidentiality with regard to the reporter of an incident.
66
+ Further details of specific enforcement policies may be posted separately.
67
+
68
+ Project maintainers who do not follow or enforce the Code of Conduct in good
69
+ faith may face temporary or permanent repercussions as determined by other
70
+ members of the project's leadership.
71
+
72
+ ## Attribution
73
+
74
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
75
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
76
+
77
+ [homepage]: https://www.contributor-covenant.org
78
+
79
+ For answers to common questions about this code of conduct, see
80
+ https://www.contributor-covenant.org/faq
CONTRIBUTING.md ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing to Llama 3
2
+ We want to make contributing to this project as easy and transparent as
3
+ possible.
4
+
5
+ ## Our Development Process
6
+ ... (in particular how this is synced with internal changes to the project)
7
+
8
+ ## Pull Requests
9
+ We actively welcome your pull requests.
10
+
11
+ 1. Fork the repo and create your branch from `main`.
12
+ 2. If you've added code that should be tested, add tests.
13
+ 3. If you've changed APIs, update the documentation.
14
+ 4. Ensure the test suite passes.
15
+ 5. Make sure your code lints.
16
+ 6. If you haven't already, complete the Contributor License Agreement ("CLA").
17
+
18
+ ## Contributor License Agreement ("CLA")
19
+ In order to accept your pull request, we need you to submit a CLA. You only need
20
+ to do this once to work on any of Meta's open source projects.
21
+
22
+ Complete your CLA here: <https://code.facebook.com/cla>
23
+
24
+ ## Issues
25
+ We use GitHub issues to track public bugs. Please ensure your description is
26
+ clear and has sufficient instructions to be able to reproduce the issue.
27
+
28
+ Meta has a [bounty program](http://facebook.com/whitehat/info) for the safe
29
+ disclosure of security bugs. In those cases, please go through the process
30
+ outlined on that page and do not file a public issue.
31
+
32
+ ## Coding Style
33
+ * 2 spaces for indentation rather than tabs
34
+ * 80 character line length
35
+ * ...
36
+
37
+ ## License
38
+ By contributing to Llama 3, you agree that your contributions will be licensed
39
+ under the LICENSE file in the root directory of this source tree.
LICENSE ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ META LLAMA 3 COMMUNITY LICENSE AGREEMENT
2
+
3
+ Meta Llama 3 Version Release Date: April 18, 2024
4
+ “Agreement” means the terms and conditions for use, reproduction, distribution and modification of the Llama Materials set forth herein.
5
+
6
+ “Documentation” means the specifications, manuals and documentation accompanying Meta Llama 3 distributed by Meta at https://llama.meta.com/get-started/.
7
+
8
+ “Licensee” or “you” means you, or your employer or any other person or entity (if you are entering into this Agreement on such person or entity’s behalf), of the age required under applicable laws, rules or regulations to provide legal consent and that has legal authority to bind your employer or such other person or entity if you are entering in this Agreement on their behalf.
9
+
10
+ “Meta Llama 3” means the foundational large language models and software and algorithms, including machine-learning model code, trained model weights, inference-enabling code, training-enabling code, fine-tuning enabling code and other elements of the foregoing distributed by Meta at https://llama.meta.com/llama-downloads.
11
+
12
+ “Llama Materials” means, collectively, Meta’s proprietary Meta Llama 3 and Documentation (and any portion thereof) made available under this Agreement.
13
+
14
+ “Meta” or “we” means Meta Platforms Ireland Limited (if you are located in or, if you are an entity, your principal place of business is in the EEA or Switzerland) and Meta Platforms, Inc. (if you are located outside of the EEA or Switzerland).
15
+
16
+ By clicking “I Accept” below or by using or distributing any portion or element of the Llama Materials, you agree to be bound by this Agreement.
17
+
18
+ 1. License Rights and Redistribution.
19
+
20
+ a. Grant of Rights. You are granted a non-exclusive, worldwide, non-transferable and royalty-free limited license under Meta’s intellectual property or other rights owned by Meta embodied in the Llama Materials to use, reproduce, distribute, copy, create derivative works of, and make modifications to the Llama Materials.
21
+ b. Redistribution and Use.
22
+ i. If you distribute or make available the Llama Materials (or any derivative works thereof), or a product or service that uses any of them, including another AI model, you shall (A) provide a copy of this Agreement with any such Llama Materials; and (B) prominently display “Built with Meta Llama 3” on a related website, user interface, blogpost, about page, or product documentation. If you use the Llama Materials to create, train, fine tune, or otherwise improve an AI model, which is distributed or made available, you shall also include “Llama 3” at the beginning of any such AI model name.
23
+ ii. If you receive Llama Materials, or any derivative works thereof, from a Licensee as part of an integrated end user product, then Section 2 of this Agreement will not apply to you.
24
+ iii. You must retain in all copies of the Llama Materials that you distribute the following attribution notice within a “Notice” text file distributed as a part of such copies: “Meta Llama 3 is licensed under the Meta Llama 3 Community License, Copyright © Meta Platforms, Inc. All Rights Reserved.”
25
+ iv. Your use of the Llama Materials must comply with applicable laws and regulations (including trade compliance laws and regulations) and adhere to the Acceptable Use Policy for the Llama Materials (available at https://llama.meta.com/llama3/use-policy), which is hereby incorporated by reference into this Agreement.
26
+ v. You will not use the Llama Materials or any output or results of the Llama Materials to improve any other large language model (excluding Meta Llama 3 or derivative works thereof).
27
+
28
+ 2. Additional Commercial Terms. If, on the Meta Llama 3 version release date, the monthly active users of the products or services made available by or for Licensee, or Licensee’s affiliates, is greater than 700 million monthly active users in the preceding calendar month, you must request a license from Meta, which Meta may grant to you in its sole discretion, and you are not authorized to exercise any of the rights under this Agreement unless or until Meta otherwise expressly grants you such rights.
29
+
30
+ 3. Disclaimer of Warranty. UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN “AS IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, AND META DISCLAIMS ALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS AND ASSUME ANY RISKS ASSOCIATED WITH YOUR USE OF THE LLAMA MATERIALS AND ANY OUTPUT AND RESULTS.
31
+
32
+ 4. Limitation of Liability. IN NO EVENT WILL META OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, FOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY OR PUNITIVE DAMAGES, EVEN IF META OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF ANY OF THE FOREGOING.
33
+
34
+ 5. Intellectual Property.
35
+ a. No trademark licenses are granted under this Agreement, and in connection with the Llama Materials, neither Meta nor Licensee may use any name or mark owned by or associated with the other or any of its affiliates, except as required for reasonable and customary use in describing and redistributing the Llama Materials or as set forth in this Section 5(a). Meta hereby grants you a license to use “Llama 3” (the “Mark”) solely as required to comply with the last sentence of Section 1.b.i. You will comply with Meta’s brand guidelines (currently accessible at https://about.meta.com/brand/resources/meta/company-brand/ ). All goodwill arising out of your use of the Mark will inure to the benefit of Meta.
36
+ b. Subject to Meta’s ownership of Llama Materials and derivatives made by or for Meta, with respect to any derivative works and modifications of the Llama Materials that are made by you, as between you and Meta, you are and will be the owner of such derivative works and modifications.
37
+ c. If you institute litigation or other proceedings against Meta or any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Llama Materials or Meta Llama 3 outputs or results, or any portion of any of the foregoing, constitutes infringement of intellectual property or other rights owned or licensable by you, then any licenses granted to you under this Agreement shall terminate as of the date such litigation or claim is filed or instituted. You will indemnify and hold harmless Meta from and against any claim by any third party arising out of or related to your use or distribution of the Llama Materials.
38
+
39
+ 6. Term and Termination. The term of this Agreement will commence upon your acceptance of this Agreement or access to the Llama Materials and will continue in full force and effect until terminated in accordance with the terms and conditions herein. Meta may terminate this Agreement if you are in breach of any term or condition of this Agreement. Upon termination of this Agreement, you shall delete and cease use of the Llama Materials. Sections 3, 4 and 7 shall survive the termination of this Agreement.
40
+
41
+ 7. Governing Law and Jurisdiction. This Agreement will be governed and construed under the laws of the State of California without regard to choice of law principles, and the UN Convention on Contracts for the International Sale of Goods does not apply to this Agreement. The courts of California shall have exclusive jurisdiction of any dispute arising out of this Agreement.
42
+
43
+
44
+ Meta Llama 3 Acceptable Use Policy
45
+ Meta is committed to promoting safe and fair use of its tools and features, including Meta Llama 3. If you access or use Meta Llama 3, you agree to this Acceptable Use Policy (“Policy”). The most recent copy of this policy can be found at https://llama.meta.com/llama3/use-policy
46
+ Prohibited Uses
47
+ We want everyone to use Meta Llama 3 safely and responsibly. You agree you will not use, or allow others to use, Meta Llama 3 to:
48
+ 1. Violate the law or others’ rights, including to:
49
+ a. Engage in, promote, generate, contribute to, encourage, plan, incite, or further illegal or unlawful activity or content, such as:
50
+ i. Violence or terrorism
51
+ ii. Exploitation or harm to children, including the solicitation, creation, acquisition, or dissemination of child exploitative content or failure to report Child Sexual Abuse Material
52
+ iii. Human trafficking, exploitation, and sexual violence
53
+ iv. The illegal distribution of information or materials to minors, including obscene materials, or failure to employ legally required age-gating in connection with such information or materials.
54
+ v. Sexual solicitation
55
+ vi. Any other criminal activity
56
+ b. Engage in, promote, incite, or facilitate the harassment, abuse, threatening, or bullying of individuals or groups of individuals
57
+ c. Engage in, promote, incite, or facilitate discrimination or other unlawful or harmful conduct in the provision of employment, employment benefits, credit, housing, other economic benefits, or other essential goods and services
58
+ d. Engage in the unauthorized or unlicensed practice of any profession including, but not limited to, financial, legal, medical/health, or related professional practices
59
+ e. Collect, process, disclose, generate, or infer health, demographic, or other sensitive personal or private information about individuals without rights and consents required by applicable laws
60
+ f. Engage in or facilitate any action or generate any content that infringes, misappropriates, or otherwise violates any third-party rights, including the outputs or results of any products or services using the Llama Materials
61
+ g. Create, generate, or facilitate the creation of malicious code, malware, computer viruses or do anything else that could disable, overburden, interfere with or impair the proper working, integrity, operation or appearance of a website or computer system
62
+
63
+ 2. Engage in, promote, incite, facilitate, or assist in the planning or development of activities that present a risk of death or bodily harm to individuals, including use of Meta Llama 3 related to the following:
64
+ a. Military, warfare, nuclear industries or applications, espionage, use for materials or activities that are subject to the International Traffic Arms Regulations (ITAR) maintained by the United States Department of State
65
+ b. Guns and illegal weapons (including weapon development)
66
+ c. Illegal drugs and regulated/controlled substances
67
+ d. Operation of critical infrastructure, transportation technologies, or heavy machinery
68
+ e. Self-harm or harm to others, including suicide, cutting, and eating disorders
69
+ f. Any content intended to incite or promote violence, abuse, or any infliction of bodily harm to an individual
70
+
71
+ 3. Intentionally deceive or mislead others, including use of Meta Llama 3 related to the following:
72
+ a. Generating, promoting, or furthering fraud or the creation or promotion of disinformation
73
+ b. Generating, promoting, or furthering defamatory content, including the creation of defamatory statements, images, or other content
74
+ c. Generating, promoting, or further distributing spam
75
+ d. Impersonating another individual without consent, authorization, or legal right
76
+ e. Representing that the use of Meta Llama 3 or outputs are human-generated
77
+ f. Generating or facilitating false online engagement, including fake reviews and other means of fake online engagement
78
+ g. Fail to appropriately disclose to end users any known dangers of your AI system
79
+
80
+ Please report any violation of this Policy, software “bug,” or other problems that could lead to a violation of this Policy through one of the following means:
81
+ * Reporting issues with the model: https://github.com/meta-llama/llama3
82
+ * Reporting risky content generated by the model: developers.facebook.com/llama_output_feedback
83
+ * Reporting bugs and security concerns: facebook.com/whitehat/info
84
+ * Reporting violations of the Acceptable Use Policy or unlicensed uses of Meta Llama 3: LlamaUseReport@meta.com
Llama3_Repo.jpeg ADDED
MODEL_CARD.md ADDED
@@ -0,0 +1,512 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Model Details
2
+
3
+ Meta developed and released the Meta Llama 3 family of large language models (LLMs), a collection of pretrained and instruction tuned generative text models in 8 and 70B sizes. The Llama 3 instruction tuned models are optimized for dialogue use cases and outperform many of the available open source chat models on common industry benchmarks. Further, in developing these models, we took great care to optimize helpfulness and safety.
4
+
5
+ **Model developers** Meta
6
+
7
+ **Variations** Llama 3 comes in two sizes — 8B and 70B parameters — in pre-trained and instruction tuned variants.
8
+
9
+ **Input** Models input text only.
10
+
11
+ **Output** Models generate text and code only.
12
+
13
+ **Model Architecture** Llama 3 is an auto-regressive language model that uses an optimized transformer architecture. The tuned versions use supervised fine-tuning (SFT) and reinforcement learning with human feedback (RLHF) to align with human preferences for helpfulness and safety.
14
+
15
+
16
+ <table>
17
+ <tr>
18
+ <td>
19
+ </td>
20
+ <td><strong>Training Data</strong>
21
+ </td>
22
+ <td><strong>Params</strong>
23
+ </td>
24
+ <td><strong>Context length</strong>
25
+ </td>
26
+ <td><strong>GQA</strong>
27
+ </td>
28
+ <td><strong>Token count</strong>
29
+ </td>
30
+ <td><strong>Knowledge cutoff</strong>
31
+ </td>
32
+ </tr>
33
+ <tr>
34
+ <td rowspan="2" >Llama 3
35
+ </td>
36
+ <td rowspan="2" >A new mix of publicly available online data.
37
+ </td>
38
+ <td>8B
39
+ </td>
40
+ <td>8k
41
+ </td>
42
+ <td>Yes
43
+ </td>
44
+ <td rowspan="2" >15T+
45
+ </td>
46
+ <td>March, 2023
47
+ </td>
48
+ </tr>
49
+ <tr>
50
+ <td>70B
51
+ </td>
52
+ <td>8k
53
+ </td>
54
+ <td>Yes
55
+ </td>
56
+ <td>December, 2023
57
+ </td>
58
+ </tr>
59
+ </table>
60
+
61
+
62
+ **Llama 3 family of models**. Token counts refer to pretraining data only. Both the 8 and 70B versions use Grouped-Query Attention (GQA) for improved inference scalability.
63
+
64
+ **Model Release Date** April 18, 2024.
65
+
66
+ **Status** This is a static model trained on an offline dataset. Future versions of the tuned models will be released as we improve model safety with community feedback.
67
+
68
+ **License** A custom commercial license is available at: [https://llama.meta.com/llama3/license](https://llama.meta.com/llama3/license)
69
+
70
+ Where to send questions or comments about the model Instructions on how to provide feedback or comments on the model can be found in the model [README](https://github.com/meta-llama/llama3). For more technical information about generation parameters and recipes for how to use Llama 3 in applications, please go [here](https://github.com/meta-llama/llama-recipes).
71
+
72
+
73
+ ## Intended Use
74
+
75
+ **Intended Use Cases** Llama 3 is intended for commercial and research use in English. Instruction tuned models are intended for assistant-like chat, whereas pretrained models can be adapted for a variety of natural language generation tasks.
76
+
77
+ **Out-of-scope** Use in any manner that violates applicable laws or regulations (including trade compliance laws). Use in any other way that is prohibited by the [Acceptable Use Policy](https://llama.meta.com/llama3/use-policy/) and [Llama 3 Community License](https://llama.meta.com/llama3/license/). Use in languages other than English**.
78
+
79
+ **Note: Developers may fine-tune Llama 3 models for languages beyond English provided they comply with the [Llama 3 Community License](https://llama.meta.com/llama3/license/) and the [Acceptable Use Policy](https://llama.meta.com/llama3/use-policy/).
80
+
81
+
82
+ ## Hardware and Software
83
+
84
+ **Training Factors** We used custom training libraries, Meta's Research SuperCluster, and production clusters for pretraining. Fine-tuning, annotation, and evaluation were also performed on third-party cloud compute.
85
+
86
+ **Carbon Footprint Pretraining utilized a cumulative** 7.7M GPU hours of computation on hardware of type H100-80GB (TDP of 700W). Estimated total emissions were 2290 tCO2eq, 100% of which were offset by Meta’s sustainability program.
87
+
88
+
89
+ <table>
90
+ <tr>
91
+ <td>
92
+ </td>
93
+ <td><strong>Time (GPU hours)</strong>
94
+ </td>
95
+ <td><strong>Power Consumption (W)</strong>
96
+ </td>
97
+ <td><strong>Carbon Emitted(tCO2eq)</strong>
98
+ </td>
99
+ </tr>
100
+ <tr>
101
+ <td>Llama 3 8B
102
+ </td>
103
+ <td>1.3M
104
+ </td>
105
+ <td>700
106
+ </td>
107
+ <td>390
108
+ </td>
109
+ </tr>
110
+ <tr>
111
+ <td>Llama 3 70B
112
+ </td>
113
+ <td>6.4M
114
+ </td>
115
+ <td>700
116
+ </td>
117
+ <td>1900
118
+ </td>
119
+ </tr>
120
+ <tr>
121
+ <td>Total
122
+ </td>
123
+ <td>7.7M
124
+ </td>
125
+ <td>
126
+ </td>
127
+ <td>2290
128
+ </td>
129
+ </tr>
130
+ </table>
131
+
132
+
133
+
134
+ **CO2 emissions during pre-training**. Time: total GPU time required for training each model. Power Consumption: peak power capacity per GPU device for the GPUs used adjusted for power usage efficiency. 100% of the emissions are directly offset by Meta's sustainability program, and because we are openly releasing these models, the pretraining costs do not need to be incurred by others.
135
+
136
+
137
+ ## Training Data
138
+
139
+ **Overview** Llama 3 was pretrained on over 15 trillion tokens of data from publicly available sources. The fine-tuning data includes publicly available instruction datasets, as well as over 10M human-annotated examples. Neither the pretraining nor the fine-tuning datasets include Meta user data.
140
+
141
+ **Data Freshness** The pretraining data has a cutoff of March 2023 for the 8B and December 2023 for the 70B models respectively.
142
+
143
+
144
+ ## Benchmarks
145
+
146
+ In this section, we report the results for Llama 3 models on standard automatic benchmarks. For all the evaluations, we use our internal evaluations library. For details on the methodology see [here](https://github.com/meta-llama/llama3/blob/main/eval_details.md).
147
+
148
+
149
+ ### Base pretrained models
150
+
151
+
152
+ <table>
153
+ <tr>
154
+ <td><strong>Category</strong>
155
+ </td>
156
+ <td><strong>Benchmark</strong>
157
+ </td>
158
+ <td><strong>Llama 3 8B</strong>
159
+ </td>
160
+ <td><strong>Llama2 7B</strong>
161
+ </td>
162
+ <td><strong>Llama2 13B</strong>
163
+ </td>
164
+ <td><strong>Llama 3 70B</strong>
165
+ </td>
166
+ <td><strong>Llama2 70B</strong>
167
+ </td>
168
+ </tr>
169
+ <tr>
170
+ <td rowspan="6" >General
171
+ </td>
172
+ <td>MMLU (5-shot)
173
+ </td>
174
+ <td>66.6
175
+ </td>
176
+ <td>45.7
177
+ </td>
178
+ <td>53.8
179
+ </td>
180
+ <td>79.5
181
+ </td>
182
+ <td>69.7
183
+ </td>
184
+ </tr>
185
+ <tr>
186
+ <td>AGIEval English (3-5 shot)
187
+ </td>
188
+ <td>45.9
189
+ </td>
190
+ <td>28.8
191
+ </td>
192
+ <td>38.7
193
+ </td>
194
+ <td>63.0
195
+ </td>
196
+ <td>54.8
197
+ </td>
198
+ </tr>
199
+ <tr>
200
+ <td>CommonSenseQA (7-shot)
201
+ </td>
202
+ <td>72.6
203
+ </td>
204
+ <td>57.6
205
+ </td>
206
+ <td>67.6
207
+ </td>
208
+ <td>83.8
209
+ </td>
210
+ <td>78.7
211
+ </td>
212
+ </tr>
213
+ <tr>
214
+ <td>Winogrande (5-shot)
215
+ </td>
216
+ <td>76.1
217
+ </td>
218
+ <td>73.3
219
+ </td>
220
+ <td>75.4
221
+ </td>
222
+ <td>83.1
223
+ </td>
224
+ <td>81.8
225
+ </td>
226
+ </tr>
227
+ <tr>
228
+ <td>BIG-Bench Hard (3-shot, CoT)
229
+ </td>
230
+ <td>61.1
231
+ </td>
232
+ <td>38.1
233
+ </td>
234
+ <td>47.0
235
+ </td>
236
+ <td>81.3
237
+ </td>
238
+ <td>65.7
239
+ </td>
240
+ </tr>
241
+ <tr>
242
+ <td>ARC-Challenge (25-shot)
243
+ </td>
244
+ <td>78.6
245
+ </td>
246
+ <td>53.7
247
+ </td>
248
+ <td>67.6
249
+ </td>
250
+ <td>93.0
251
+ </td>
252
+ <td>85.3
253
+ </td>
254
+ </tr>
255
+ <tr>
256
+ <td>Knowledge reasoning
257
+ </td>
258
+ <td>TriviaQA-Wiki (5-shot)
259
+ </td>
260
+ <td>78.5
261
+ </td>
262
+ <td>72.1
263
+ </td>
264
+ <td>79.6
265
+ </td>
266
+ <td>89.7
267
+ </td>
268
+ <td>87.5
269
+ </td>
270
+ </tr>
271
+ <tr>
272
+ <td rowspan="4" >Reading comprehension
273
+ </td>
274
+ <td>SQuAD (1-shot)
275
+ </td>
276
+ <td>76.4
277
+ </td>
278
+ <td>72.2
279
+ </td>
280
+ <td>72.1
281
+ </td>
282
+ <td>85.6
283
+ </td>
284
+ <td>82.6
285
+ </td>
286
+ </tr>
287
+ <tr>
288
+ <td>QuAC (1-shot, F1)
289
+ </td>
290
+ <td>44.4
291
+ </td>
292
+ <td>39.6
293
+ </td>
294
+ <td>44.9
295
+ </td>
296
+ <td>51.1
297
+ </td>
298
+ <td>49.4
299
+ </td>
300
+ </tr>
301
+ <tr>
302
+ <td>BoolQ (0-shot)
303
+ </td>
304
+ <td>75.7
305
+ </td>
306
+ <td>65.5
307
+ </td>
308
+ <td>66.9
309
+ </td>
310
+ <td>79.0
311
+ </td>
312
+ <td>73.1
313
+ </td>
314
+ </tr>
315
+ <tr>
316
+ <td>DROP (3-shot, F1)
317
+ </td>
318
+ <td>58.4
319
+ </td>
320
+ <td>37.9
321
+ </td>
322
+ <td>49.8
323
+ </td>
324
+ <td>79.7
325
+ </td>
326
+ <td>70.2
327
+ </td>
328
+ </tr>
329
+ </table>
330
+
331
+
332
+
333
+ ### Instruction tuned models
334
+
335
+
336
+ <table>
337
+ <tr>
338
+ <td><strong>Benchmark</strong>
339
+ </td>
340
+ <td><strong>Llama 3 8B</strong>
341
+ </td>
342
+ <td><strong>Llama 2 7B</strong>
343
+ </td>
344
+ <td><strong>Llama 2 13B</strong>
345
+ </td>
346
+ <td><strong>Llama 3 70B</strong>
347
+ </td>
348
+ <td><strong>Llama 2 70B</strong>
349
+ </td>
350
+ </tr>
351
+ <tr>
352
+ <td>MMLU (5-shot)
353
+ </td>
354
+ <td>68.4
355
+ </td>
356
+ <td>34.1
357
+ </td>
358
+ <td>47.8
359
+ </td>
360
+ <td>82.0
361
+ </td>
362
+ <td>52.9
363
+ </td>
364
+ </tr>
365
+ <tr>
366
+ <td>GPQA (0-shot)
367
+ </td>
368
+ <td>34.2
369
+ </td>
370
+ <td>21.7
371
+ </td>
372
+ <td>22.3
373
+ </td>
374
+ <td>39.5
375
+ </td>
376
+ <td>21.0
377
+ </td>
378
+ </tr>
379
+ <tr>
380
+ <td>HumanEval (0-shot)
381
+ </td>
382
+ <td>62.2
383
+ </td>
384
+ <td>7.9
385
+ </td>
386
+ <td>14.0
387
+ </td>
388
+ <td>81.7
389
+ </td>
390
+ <td>25.6
391
+ </td>
392
+ </tr>
393
+ <tr>
394
+ <td>GSM-8K (8-shot, CoT)
395
+ </td>
396
+ <td>79.6
397
+ </td>
398
+ <td>25.7
399
+ </td>
400
+ <td>77.4
401
+ </td>
402
+ <td>93.0
403
+ </td>
404
+ <td>57.5
405
+ </td>
406
+ </tr>
407
+ <tr>
408
+ <td>MATH (4-shot, CoT)
409
+ </td>
410
+ <td>30.0
411
+ </td>
412
+ <td>3.8
413
+ </td>
414
+ <td>6.7
415
+ </td>
416
+ <td>50.4
417
+ </td>
418
+ <td>11.6
419
+ </td>
420
+ </tr>
421
+ </table>
422
+
423
+
424
+
425
+ ### Responsibility & Safety
426
+
427
+ We believe that an open approach to AI leads to better, safer products, faster innovation, and a bigger overall market. We are committed to Responsible AI development and took a series of steps to limit misuse and harm and support the open source community.
428
+
429
+ Foundation models are widely capable technologies that are built to be used for a diverse range of applications. They are not designed to meet every developer preference on safety levels for all use cases, out-of-the-box, as those by their nature will differ across different applications.
430
+
431
+ Rather, responsible LLM-application deployment is achieved by implementing a series of safety best practices throughout the development of such applications, from the model pre-training, fine-tuning and the deployment of systems composed of safeguards to tailor the safety needs specifically to the use case and audience.
432
+
433
+
434
+ As part of the Llama 3 release, we updated our [Responsible Use Guide](https://llama.meta.com/responsible-use-guide/) to outline the steps and best practices for developers to implement model and system level safety for their application. We also provide a set of resources including [Meta Llama Guard 2](https://llama.meta.com/purple-llama/) and [Code Shield](https://llama.meta.com/purple-llama/) safeguards. These tools have proven to drastically reduce residual risks of LLM Systems, while maintaining a high level of helpfulness. We encourage developers to tune and deploy these safeguards according to their needs and we provide a [reference implementation](https://github.com/meta-llama/llama-recipes/tree/main/recipes/responsible_ai) to get you started.
435
+
436
+
437
+ #### Llama 3-Instruct
438
+
439
+ As outlined in the Responsible Use Guide, some trade-off between model helpfulness and model alignment is likely unavoidable. Developers should exercise discretion about how to weigh the benefits of alignment and helpfulness for their specific use case and audience. Developers should be mindful of residual risks when using Llama models and leverage additional safety tools as needed to reach the right safety bar for their use case.
440
+
441
+ <span style="text-decoration:underline;">Safety</span>
442
+
443
+ For our instruction tuned model, we conducted extensive red teaming exercises, performed adversarial evaluations and implemented safety mitigations techniques to lower residual risks. As with any Large Language Model, residual risks will likely remain and we recommend that developers assess these risks in the context of their use case. In parallel, we are working with the community to make AI safety benchmark standards transparent, rigorous and interpretable.
444
+
445
+ <span style="text-decoration:underline;">Refusals</span>
446
+
447
+ In addition to residual risks, we put a great emphasis on model refusals to benign prompts. Over-refusing not only can impact the user experience but could even be harmful in certain contexts as well. We’ve heard the feedback from the developer community and improved our fine tuning to ensure that Llama 3 is significantly less likely to falsely refuse to answer prompts than Llama 2.
448
+
449
+ We built internal benchmarks and developed mitigations to limit false refusals making Llama 3 our most helpful model to date.
450
+
451
+
452
+ #### Responsible release
453
+
454
+ In addition to responsible use considerations outlined above, we followed a rigorous process that requires us to take extra measures against misuse and critical risks before we make our release decision.
455
+
456
+ Misuse
457
+
458
+ If you access or use Llama 3, you agree to the Acceptable Use Policy. The most recent copy of this policy can be found at [https://llama.meta.com/llama3/use-policy/](https://llama.meta.com/llama3/use-policy/).
459
+
460
+
461
+ #### Critical risks
462
+
463
+ <span style="text-decoration:underline;">CBRNE</span> (Chemical, Biological, Radiological, Nuclear, and high yield Explosives)
464
+
465
+ We have conducted a two fold assessment of the safety of the model in this area:
466
+
467
+
468
+
469
+ * Iterative testing during model training to assess the safety of responses related to CBRNE threats and other adversarial risks.
470
+ * Involving external CBRNE experts to conduct an uplift test assessing the ability of the model to accurately provide expert knowledge and reduce barriers to potential CBRNE misuse, by reference to what can be achieved using web search (without the model).
471
+
472
+
473
+ ### <span style="text-decoration:underline;">Cyber Security </span>
474
+
475
+ We have evaluated Llama 3 with CyberSecEval, Meta’s cybersecurity safety eval suite, measuring Llama 3’s propensity to suggest insecure code when used as a coding assistant, and Llama 3’s propensity to comply with requests to help carry out cyber attacks, where attacks are defined by the industry standard MITRE ATT&CK cyber attack ontology. On our insecure coding and cyber attacker helpfulness tests, Llama 3 behaved in the same range or safer than models of [equivalent coding capability](https://huggingface.co/spaces/facebook/CyberSecEval).
476
+
477
+
478
+ ### <span style="text-decoration:underline;">Child Safety</span>
479
+
480
+ Child Safety risk assessments were conducted using a team of experts, to assess the model’s capability to produce outputs that could result in Child Safety risks and inform on any necessary and appropriate risk mitigations via fine tuning. We leveraged those expert red teaming sessions to expand the coverage of our evaluation benchmarks through Llama 3 model development. For Llama 3, we conducted new in-depth sessions using objective based methodologies to assess the model risks along multiple attack vectors. We also partnered with content specialists to perform red teaming exercises assessing potentially violating content while taking account of market specific nuances or experiences.
481
+
482
+
483
+ ### Community
484
+
485
+ Generative AI safety requires expertise and tooling, and we believe in the strength of the open community to accelerate its progress. We are active members of open consortiums, including the AI Alliance, Partnership in AI and MLCommons, actively contributing to safety standardization and transparency. We encourage the community to adopt taxonomies like the MLCommons Proof of Concept evaluation to facilitate collaboration and transparency on safety and content evaluations. Our Purple Llama tools are open sourced for the community to use and widely distributed across ecosystem partners including cloud service providers. We encourage community contributions to our [GitHub repository](https://github.com/meta-llama/PurpleLlama).
486
+
487
+ Finally, we put in place a set of resources including an [output reporting mechanism](https://developers.facebook.com/llama_output_feedback) and [bug bounty program](https://www.facebook.com/whitehat) to continuously improve the Llama technology with the help of the community.
488
+
489
+
490
+ ## Ethical Considerations and Limitations
491
+
492
+ The core values of Llama 3 are openness, inclusivity and helpfulness. It is meant to serve everyone, and to work for a wide range of use cases. It is thus designed to be accessible to people across many different backgrounds, experiences and perspectives. Llama 3 addresses users and their needs as they are, without insertion unnecessary judgment or normativity, while reflecting the understanding that even content that may appear problematic in some cases can serve valuable purposes in others. It respects the dignity and autonomy of all users, especially in terms of the values of free thought and expression that power innovation and progress.
493
+
494
+ But Llama 3 is a new technology, and like any new technology, there are risks associated with its use. Testing conducted to date has been in English, and has not covered, nor could it cover, all scenarios. For these reasons, as with all LLMs, Llama 3’s potential outputs cannot be predicted in advance, and the model may in some instances produce inaccurate, biased or other objectionable responses to user prompts. Therefore, before deploying any applications of Llama 3 models, developers should perform safety testing and tuning tailored to their specific applications of the model. As outlined in the Responsible Use Guide, we recommend incorporating [Purple Llama](https://github.com/facebookresearch/PurpleLlama) solutions into your workflows and specifically [Llama Guard](https://ai.meta.com/research/publications/llama-guard-llm-based-input-output-safeguard-for-human-ai-conversations/) which provides a base model to filter input and output prompts to layer system-level safety on top of model-level safety.
495
+
496
+ Please see the Responsible Use Guide available at [http://llama.meta.com/responsible-use-guide](http://llama.meta.com/responsible-use-guide)
497
+
498
+
499
+ ## Citation instructions
500
+
501
+ ```
502
+ @article{llama3modelcard,
503
+ title={Llama 3 Model Card},
504
+ author={AI@Meta},
505
+ year={2024},
506
+ url = {https://github.com/meta-llama/llama3/blob/main/MODEL_CARD.md}
507
+ }
508
+ ```
509
+
510
+ ## Contributors
511
+
512
+ Aaditya Singh; Aaron Grattafiori; Abhimanyu Dubey; Abhinav Jauhri; Abhinav Pandey; Abhishek Kadian; Adam Kelsey; Adi Gangidi; Ahmad Al-Dahle; Amit Sangani; Ahuva Goldstand; Aiesha Letman; Ajay Menon; Akhil Mathur; Alan Schelten; Alex Vaughan; Amy Yang; Andrei Lupu; Andres Alvarado; Andrew Gallagher; Andrew Gu; Andrew Ho; Andrew Poulton; Andrew Ryan; Angela Fan; Ankit Ramchandani; Anthony Hartshorn; Archi Mitra; Archie Sravankumar; Artem Korenev; Arun Rao; Ashley Gabriel; Ashwin Bharambe; Assaf Eisenman; Aston Zhang; Ash JJhaveri; Aurelien Rodriguez; Austen Gregerson; Ava Spataru; Baptiste Roziere; Ben Maurer; Benjamin Leonhardi; Bernie Huang; Bhargavi Paranjape; Bing Liu; Binh Tang; Bobbie Chern; Brani Stojkovic; Brian Fuller; Catalina Mejia Arenas; Chao Zhou; Charlotte Caucheteux; Chaya Nayak; Ching-Hsiang Chu; Chloe Bi; Chris Cai; Chris Cox; Chris Marra; Chris McConnell; Christian Keller; Christoph Feichtenhofer; Christophe Touret; Chunyang Wu; Corinne Wong; Cristian Canton Ferrer; Damien Allonsius; Daniel Kreymer; Daniel Haziza; Daniel Li; Danielle Pintz; Danny Livshits; Danny Wyatt; David Adkins; David Esiobu; David Xu; Davide Testuggine; Delia David; Devi Parikh; Dhruv Choudhary; Dhruv Mahajan; Diana Liskovich; Diego Garcia-Olano; Diego Perino; Dieuwke Hupkes; Dingkang Wang; Dustin Holland; Egor Lakomkin; Elina Lobanova; Xiaoqing Ellen Tan; Emily Dinan; Eric Smith; Erik Brinkman; Esteban Arcaute; Filip Radenovic; Firat Ozgenel; Francesco Caggioni; Frank Seide; Frank Zhang; Gabriel Synnaeve; Gabriella Schwarz; Gabrielle Lee; Gada Badeer; Georgia Anderson; Graeme Nail; Gregoire Mialon; Guan Pang; Guillem Cucurell; Hailey Nguyen; Hamid Shojanazeri; Hannah Korevaar; Hannah Wang; Haroun Habeeb; Harrison Rudolph; Henry Aspegren; Hu Xu; Hugo Touvron; Iga Kozlowska; Igor Molybog; Igor Tufanov; Iliyan Zarov; Imanol Arrieta Ibarra; Irina-Elena Veliche; Isabel Kloumann; Ishan Misra; Ivan Evtimov; Jade Copet; Jake Weissman; Jan Geffert; Jana Vranes; Japhet Asher; Jason Park; Jay Mahadeokar; Jean-Baptiste Gaya; Jeet Shah; Jelmer van der Linde; Jennifer Chan; Jenny Hong; Jenya Lee; Jeremy Fu; Jeremy Teboul; Jianfeng Chi; Jianyu Huang; Jie Wang; Jiecao Yu; Joanna Bitton; Joe Spisak; Joelle Pineau; Jon Carvill; Jongsoo Park; Joseph Rocca; Joshua Johnstun; Junteng Jia; Kalyan Vasuden Alwala; Kam Hou U; Kate Plawiak; Kartikeya Upasani; Kaushik Veeraraghavan; Ke Li; Kenneth Heafield; Kevin Stone; Khalid El-Arini; Krithika Iyer; Kshitiz Malik; Kuenley Chiu; Kunal Bhalla; Kyle Huang; Lakshya Garg; Lauren Rantala-Yeary; Laurens van der Maaten; Lawrence Chen; Leandro Silva; Lee Bell; Lei Zhang; Liang Tan; Louis Martin; Lovish Madaan; Luca Wehrstedt; Lukas Blecher; Luke de Oliveira; Madeline Muzzi; Madian Khabsa; Manav Avlani; Mannat Singh; Manohar Paluri; Mark Zuckerberg; Marcin Kardas; Martynas Mankus; Mathew Oldham; Mathieu Rita; Matthew Lennie; Maya Pavlova; Meghan Keneally; Melanie Kambadur; Mihir Patel; Mikayel Samvelyan; Mike Clark; Mike Lewis; Min Si; Mitesh Kumar Singh; Mo Metanat; Mona Hassan; Naman Goyal; Narjes Torabi; Nicolas Usunier; Nikolay Bashlykov; Nikolay Bogoychev; Niladri Chatterji; Ning Dong; Oliver Aobo Yang; Olivier Duchenne; Onur Celebi; Parth Parekh; Patrick Alrassy; Paul Saab; Pavan Balaji; Pedro Rittner; Pengchuan Zhang; Pengwei Li; Petar Vasic; Peter Weng; Polina Zvyagina; Prajjwal Bhargava; Pratik Dubal; Praveen Krishnan; Punit Singh Koura; Puxin Xu; Qing He; Rachel Rodriguez; Ragavan Srinivasan; Rahul Mitra; Ramon Calderer; Raymond Li; Robert Stojnic; Roberta Raileanu; Robin Battey; Rocky Wang; Rohit Girdhar; Rohit Patel; Romain Sauvestre; Ronnie Polidoro; Roshan Sumbaly; Ross Taylor; Ruan Silva; Rui Hou; Rui Wang; Russ Howes; Ruty Rinott; Saghar Hosseini; Sai Jayesh Bondu; Samyak Datta; Sanjay Singh; Sara Chugh; Sargun Dhillon; Satadru Pan; Sean Bell; Sergey Edunov; Shaoliang Nie; Sharan Narang; Sharath Raparthy; Shaun Lindsay; Sheng Feng; Sheng Shen; Shenghao Lin; Shiva Shankar; Shruti Bhosale; Shun Zhang; Simon Vandenhende; Sinong Wang; Seohyun Sonia Kim; Soumya Batra; Sten Sootla; Steve Kehoe; Suchin Gururangan; Sumit Gupta; Sunny Virk; Sydney Borodinsky; Tamar Glaser; Tamar Herman; Tamara Best; Tara Fowler; Thomas Georgiou; Thomas Scialom; Tianhe Li; Todor Mihaylov; Tong Xiao; Ujjwal Karn; Vedanuj Goswami; Vibhor Gupta; Vignesh Ramanathan; Viktor Kerkez; Vinay Satish Kumar; Vincent Gonguet; Vish Vogeti; Vlad Poenaru; Vlad Tiberiu Mihailescu; Vladan Petrovic; Vladimir Ivanov; Wei Li; Weiwei Chu; Wenhan Xiong; Wenyin Fu; Wes Bouaziz; Whitney Meers; Will Constable; Xavier Martinet; Xiaojian Wu; Xinbo Gao; Xinfeng Xie; Xuchao Jia; Yaelle Goldschlag; Yann LeCun; Yashesh Gaur; Yasmine Babaei; Ye Qi; Yenda Li; Yi Wen; Yiwen Song; Youngjin Nam; Yuchen Hao; Yuchen Zhang; Yun Wang; Yuning Mao; Yuzi He; Zacharie Delpierre Coudert; Zachary DeVito; Zahra Hankir; Zhaoduo Wen; Zheng Yan; Zhengxing Chen; Zhenyu Yang; Zoe Papakipos
README.md CHANGED
@@ -1,5 +1,151 @@
1
- ---
2
- license: apache-2.0
3
- language:
4
- - en
5
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p align="center">
2
+ <img src="https://github.com/meta-llama/llama3/blob/main/Llama3_Repo.jpeg" width="400"/>
3
+ </p>
4
+
5
+ <p align="center">
6
+ 🤗 <a href="https://huggingface.co/meta-Llama"> Models on Hugging Face</a>&nbsp | <a href="https://ai.meta.com/blog/"> Blog</a>&nbsp | <a href="https://llama.meta.com/">Website</a>&nbsp | <a href="https://llama.meta.com/get-started/">Get Started</a>&nbsp
7
+ <br>
8
+
9
+ ---
10
+
11
+
12
+ # Meta Llama 3
13
+
14
+ We are unlocking the power of large language models. Our latest version of Llama is now accessible to individuals, creators, researchers, and businesses of all sizes so that they can experiment, innovate, and scale their ideas responsibly.
15
+
16
+ This release includes model weights and starting code for pre-trained and instruction-tuned Llama 3 language models — including sizes of 8B to 70B parameters.
17
+
18
+ This repository is a minimal example of loading Llama 3 models and running inference. For more detailed examples, see [llama-recipes](https://github.com/facebookresearch/llama-recipes/).
19
+
20
+ ## Download
21
+
22
+ To download the model weights and tokenizer, please visit the [Meta Llama website](https://llama.meta.com/llama-downloads/) and accept our License.
23
+
24
+ Once your request is approved, you will receive a signed URL over email. Then, run the download.sh script, passing the URL provided when prompted to start the download.
25
+
26
+ Pre-requisites: Ensure you have `wget` and `md5sum` installed. Then run the script: `./download.sh`.
27
+
28
+ 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`.
29
+
30
+ ### Access to Hugging Face
31
+
32
+ We also provide downloads on [Hugging Face](https://huggingface.co/meta-llama), in both transformers and native `llama3` formats. To download the weights from Hugging Face, please follow these steps:
33
+
34
+ - Visit one of the repos, for example [meta-llama/Meta-Llama-3-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct).
35
+ - Read and accept the license. Once your request is approved, you'll be granted access to all the Llama 3 models. Note that requests used to take up to one hour to get processed.
36
+ - 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`:
37
+
38
+ ```bash
39
+ huggingface-cli download meta-llama/Meta-Llama-3-8B-Instruct --include "original/*" --local-dir meta-llama/Meta-Llama-3-8B-Instruct
40
+ ```
41
+
42
+ - To use with transformers, the following [pipeline](https://huggingface.co/docs/transformers/en/main_classes/pipelines) snippet will download and cache the weights:
43
+
44
+ ```python
45
+ import transformers
46
+ import torch
47
+
48
+ model_id = "meta-llama/Meta-Llama-3-8B-Instruct"
49
+
50
+ pipeline = transformers.pipeline(
51
+ "text-generation",
52
+ model="meta-llama/Meta-Llama-3-8B-Instruct",
53
+ model_kwargs={"torch_dtype": torch.bfloat16},
54
+ device="cuda",
55
+ )
56
+ ```
57
+
58
+ ## Quick Start
59
+
60
+ You can follow the steps below to get up and running with Llama 3 models quickly. These steps will let you run quick inference locally. For more examples, see the [Llama recipes repository](https://github.com/facebookresearch/llama-recipes).
61
+
62
+ 1. Clone and download this repository in a conda env with PyTorch / CUDA.
63
+
64
+ 2. In the top-level directory run:
65
+ ```bash
66
+ pip install -e .
67
+ ```
68
+ 3. Visit the [Meta Llama website](https://llama.meta.com/llama-downloads/) and register to download the model/s.
69
+
70
+ 4. Once registered, you will get an email with a URL to download the models. You will need this URL when you run the download.sh script.
71
+
72
+ 5. Once you get the email, navigate to your downloaded llama repository and run the download.sh script.
73
+ - Make sure to grant execution permissions to the download.sh script
74
+ - During this process, you will be prompted to enter the URL from the email.
75
+ - Do not use the “Copy Link” option; copy the link from the email manually.
76
+
77
+ 6. Once the model/s you want have been downloaded, you can run the model locally using the command below:
78
+ ```bash
79
+ torchrun --nproc_per_node 1 example_chat_completion.py \
80
+ --ckpt_dir Meta-Llama-3-8B-Instruct/ \
81
+ --tokenizer_path Meta-Llama-3-8B-Instruct/tokenizer.model \
82
+ --max_seq_len 512 --max_batch_size 6
83
+ ```
84
+ **Note**
85
+ - Replace `Meta-Llama-3-8B-Instruct/` with the path to your checkpoint directory and `Meta-Llama-3-8B-Instruct/tokenizer.model` with the path to your tokenizer model.
86
+ - The `–nproc_per_node` should be set to the [MP](#inference) value for the model you are using.
87
+ - Adjust the `max_seq_len` and `max_batch_size` parameters as needed.
88
+ - This example runs the [example_chat_completion.py](example_chat_completion.py) found in this repository, but you can change that to a different .py file.
89
+
90
+ ## Inference
91
+
92
+ Different models require different model-parallel (MP) values:
93
+
94
+ | Model | MP |
95
+ |--------|----|
96
+ | 8B | 1 |
97
+ | 70B | 8 |
98
+
99
+ All models support sequence length up to 8192 tokens, but we pre-allocate the cache according to `max_seq_len` and `max_batch_size` values. So set those according to your hardware.
100
+
101
+ ### Pretrained Models
102
+
103
+ These models are not finetuned for chat or Q&A. They should be prompted so that the expected answer is the natural continuation of the prompt.
104
+
105
+ See `example_text_completion.py` for some examples. To illustrate, see the command below to run it with the llama-3-8b model (`nproc_per_node` needs to be set to the `MP` value):
106
+
107
+ ```
108
+ torchrun --nproc_per_node 1 example_text_completion.py \
109
+ --ckpt_dir Meta-Llama-3-8B/ \
110
+ --tokenizer_path Meta-Llama-3-8B/tokenizer.model \
111
+ --max_seq_len 128 --max_batch_size 4
112
+ ```
113
+
114
+ ### Instruction-tuned Models
115
+
116
+ The fine-tuned models were trained for dialogue applications. To get the expected features and performance for them, specific formatting defined in [`ChatFormat`](https://github.com/meta-llama/llama3/blob/main/llama/tokenizer.py#L202)
117
+ needs to be followed: The prompt begins with a `<|begin_of_text|>` special token, after which one or more messages follow. Each message starts with the `<|start_header_id|>` tag, the role `system`, `user` or `assistant`, and the `<|end_header_id|>` tag. After a double newline `\n\n`, the message's contents follow. The end of each message is marked by the `<|eot_id|>` token.
118
+
119
+ You can also deploy additional classifiers to filter out inputs and outputs that are deemed unsafe. See the llama-recipes repo for [an example](https://github.com/meta-llama/llama-recipes/blob/main/recipes/inference/local_inference/inference.py) of how to add a safety checker to the inputs and outputs of your inference code.
120
+
121
+ Examples using llama-3-8b-chat:
122
+
123
+ ```
124
+ torchrun --nproc_per_node 1 example_chat_completion.py \
125
+ --ckpt_dir Meta-Llama-3-8B-Instruct/ \
126
+ --tokenizer_path Meta-Llama-3-8B-Instruct/tokenizer.model \
127
+ --max_seq_len 512 --max_batch_size 6
128
+ ```
129
+
130
+ Llama 3 is a new technology that carries potential risks with use. Testing conducted to date has not — and could not — cover all scenarios.
131
+ To help developers address these risks, we have created the [Responsible Use Guide](https://ai.meta.com/static-resource/responsible-use-guide/).
132
+
133
+ ## Issues
134
+
135
+ Please report any software “bug” or other problems with the models through one of the following means:
136
+ - Reporting issues with the model: [https://github.com/meta-llama/llama3/issues](https://github.com/meta-llama/llama3/issues)
137
+ - Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)
138
+ - Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)
139
+
140
+ ## Model Card
141
+ See [MODEL_CARD.md](MODEL_CARD.md).
142
+
143
+ ## License
144
+
145
+ Our model and weights are licensed for researchers and commercial entities, upholding the principles of openness. Our mission is to empower individuals and industry through this opportunity while fostering an environment of discovery and ethical AI advancements.
146
+
147
+ See the [LICENSE](LICENSE) file, as well as our accompanying [Acceptable Use Policy](USE_POLICY.md)
148
+
149
+ ## Questions
150
+
151
+ For common questions, the FAQ can be found [here](https://llama.meta.com/faq), which will be updated over time as new questions arise.
USE_POLICY ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Meta is committed to promoting safe and fair use of its tools and features, including Llama 2. If you access or use Llama 2, you agree to this Acceptable Use Policy (“Policy”). The most recent copy of this policy can be found at llama.meta.com/use-policy.
2
+
3
+ Prohibited Uses
4
+
5
+ We want everyone to use Llama 2 safely and responsibly. You agree you will not use, or allow others to use, Llama 2 to:
6
+
7
+ 1. Violate the law or others’ rights, including to:
8
+
9
+ a. Engage in, promote, generate, contribute to, encourage, plan, incite, or further illegal or unlawful activity or content, such as:
10
+ i. Violence or terrorism
11
+
12
+ ii. Exploitation or harm to children, including the solicitation, creation, acquisition, or dissemination of child exploitative content or failure to report Child Sexual Abuse Material
13
+
14
+ b. Human trafficking, exploitation, and sexual violence
15
+
16
+ iii. The illegal distribution of information or materials to minors, including obscene materials, or failure to employ legally required age-gating in connection with such information or materials.
17
+
18
+ iv. Sexual solicitation
19
+
20
+ vi. Any other criminal activity
21
+
22
+ c. Engage in, promote, incite, or facilitate the harassment, abuse, threatening, or bullying of individuals or groups of individuals
23
+
24
+ d. Engage in, promote, incite, or facilitate discrimination or other unlawful or harmful conduct in the provision of employment, employment benefits, credit, housing, other economic benefits, or other essential goods and services
25
+
26
+ e. Engage in the unauthorized or unlicensed practice of any profession including, but not limited to, financial, legal, medical/health, or related professional practices
27
+
28
+ f. Collect, process, disclose, generate, or infer health, demographic, or other sensitive personal or private information about individuals without rights and consents required by applicable laws
29
+
30
+ g. Engage in or facilitate any action or generate any content that infringes, misappropriates, or otherwise violates any third-party rights, including the outputs or results of any products or services using the Llama 2 Materials
31
+
32
+ h. Create, generate, or facilitate the creation of malicious code, malware, computer viruses or do anything else that could disable, overburden, interfere with or impair the proper working, integrity, operation or appearance of a website or computer system
33
+
34
+ 2. Engage in, promote, incite, facilitate, or assist in the planning or development of activities that present a risk of death or bodily harm to individuals, including use of Llama 2 related to the following:
35
+
36
+ a. Military, warfare, nuclear industries or applications, espionage, use for materials or activities that are subject to the International Traffic Arms Regulations (ITAR) maintained by the United States Department of State
37
+
38
+ b. Guns and illegal weapons (including weapon development)
39
+
40
+ c. Illegal drugs and regulated/controlled substances
41
+
42
+ d. Operation of critical infrastructure, transportation technologies, or heavy machinery
43
+
44
+ e. Self-harm or harm to others, including suicide, cutting, and eating disorders
45
+
46
+ f. Any content intended to incite or promote violence, abuse, or any infliction of bodily harm to an individual
47
+
48
+ 3. Intentionally deceive or mislead others, including use of Llama 2 related to the following:
49
+
50
+ a. Generating, promoting, or furthering fraud or the creation or promotion of disinformation
51
+
52
+ b. Generating, promoting, or furthering defamatory content, including the creation of defamatory statements, images, or other content
53
+
54
+ c. Generating, promoting, or further distributing spam
55
+
56
+ d. Impersonating another individual without consent, authorization, or legal right
57
+
58
+ e. Representing that the use of Llama 2 or outputs are human-generated
59
+
60
+ f. Generating or facilitating false online engagement, including fake reviews and other means of fake online engagement
61
+
62
+ 4. Fail to appropriately disclose to end users any known dangers of your AI system
63
+
64
+ Please report any violation of this Policy, software “bug,” or other problems that could lead to a violation of this Policy through one of the following means:
65
+
66
+ Reporting issues with the model: github.com/facebookresearch/llama
67
+ Reporting risky content generated by the model: developers.facebook.com/llama_output_feedback
68
+ Reporting bugs and security concerns: facebook.com/whitehat/info
69
+ Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama: LlamaUsMeta is committed to promoting safe and fair use of its tools and features, including Llama 2. If you access or use Llama 2, you agree to this Acceptable Use Policy (“Policy”). The most recent copy of this policy can be found at llama.meta.com/use-policy.
70
+
71
+ Prohibited Uses
72
+
73
+ We want everyone to use Llama 2 safely and responsibly. You agree you will not use, or allow others to use, Llama 2 to:
74
+
75
+ 1. Violate the law or others’ rights, including to:
76
+
77
+ a. Engage in, promote, generate, contribute to, encourage, plan, incite, or further illegal or unlawful activity or content, such as:
78
+ i. Violence or terrorism
79
+
80
+ ii. Exploitation or harm to children, including the solicitation, creation, acquisition, or dissemination of child exploitative content or failure to report Child Sexual Abuse Material
81
+
82
+ b. Human trafficking, exploitation, and sexual violence
83
+
84
+ iii. The illegal distribution of information or materials to minors, including obscene materials, or failure to employ legally required age-gating in connection with such information or materials.
85
+
86
+ iv. Sexual solicitation
87
+
88
+ vi. Any other criminal activity
89
+
90
+ c. Engage in, promote, incite, or facilitate the harassment, abuse, threatening, or bullying of individuals or groups of individuals
91
+
92
+ d. Engage in, promote, incite, or facilitate discrimination or other unlawful or harmful conduct in the provision of employment, employment benefits, credit, housing, other economic benefits, or other essential goods and services
93
+
94
+ e. Engage in the unauthorized or unlicensed practice of any profession including, but not limited to, financial, legal, medical/health, or related professional practices
95
+
96
+ f. Collect, process, disclose, generate, or infer health, demographic, or other sensitive personal or private information about individuals without rights and consents required by applicable laws
97
+
98
+ g. Engage in or facilitate any action or generate any content that infringes, misappropriates, or otherwise violates any third-party rights, including the outputs or results of any products or services using the Llama 2 Materials
99
+
100
+ h. Create, generate, or facilitate the creation of malicious code, malware, computer viruses or do anything else that could disable, overburden, interfere with or impair the proper working, integrity, operation or appearance of a website or computer system
101
+
102
+ 2. Engage in, promote, incite, facilitate, or assist in the planning or development of activities that present a risk of death or bodily harm to individuals, including use of Llama 2 related to the following:
103
+
104
+ a. Military, warfare, nuclear industries or applications, espionage, use for materials or activities that are subject to the International Traffic Arms Regulations (ITAR) maintained by the United States Department of State
105
+
106
+ b. Guns and illegal weapons (including weapon development)
107
+
108
+ c. Illegal drugs and regulated/controlled substances
109
+
110
+ d. Operation of critical infrastructure, transportation technologies, or heavy machinery
111
+
112
+ e. Self-harm or harm to others, including suicide, cutting, and eating disorders
113
+
114
+ f. Any content intended to incite or promote violence, abuse, or any infliction of bodily harm to an individual
115
+
116
+ 3. Intentionally deceive or mislead others, including use of Llama 2 related to the following:
117
+
118
+ a. Generating, promoting, or furthering fraud or the creation or promotion of disinformation
119
+
120
+ b. Generating, promoting, or furthering defamatory content, including the creation of defamatory statements, images, or other content
121
+
122
+ c. Generating, promoting, or further distributing spam
123
+
124
+ d. Impersonating another individual without consent, authorization, or legal right
125
+
126
+ e. Representing that the use of Llama 2 or outputs are human-generated
127
+
128
+ f. Generating or facilitating false online engagement, including fake reviews and other means of fake online engagement
129
+
130
+ 4. Fail to appropriately disclose to end users any known dangers of your AI system
131
+
132
+ Please report any violation of this Policy, software “bug,” or other problems that could lead to a violation of this Policy through one of the following means:
133
+
134
+ * Reporting issues with the model: github.com/facebookresearch/llama
135
+ * Reporting risky content generated by the model: developers.facebook.com/llama_output_feedback
136
+ * Reporting bugs and security concerns: facebook.com/whitehat/info
137
+ * Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama: LlamaUseReport@meta.come
USE_POLICY.md ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Meta Llama 3 Acceptable Use Policy
2
+
3
+ Meta is committed to promoting safe and fair use of its tools and features, including Llama 3. If you access or use Llama 3, you agree to this Acceptable Use Policy (“Policy”). The most recent copy of this policy can be found at [ai.meta.com/llama/use-policy](http://ai.meta.com/llama/use-policy).
4
+
5
+ ## Prohibited Uses
6
+ We want everyone to use Llama 3 safely and responsibly. You agree you will not use, or allow others to use, Llama 3 to:
7
+
8
+ 1. Violate the law or others’ rights, including to:
9
+ 1. Engage in, promote, generate, contribute to, encourage, plan, incite, or further illegal or unlawful activity or content, such as:
10
+ 1. Violence or terrorism
11
+ 2. Exploitation or harm to children, including the solicitation, creation, acquisition, or dissemination of child exploitative content or failure to report Child Sexual Abuse Material
12
+ 3. Human trafficking, exploitation, and sexual violence
13
+ 4. The illegal distribution of information or materials to minors, including obscene materials, or failure to employ legally required age-gating in connection with such information or materials.
14
+ 5. Sexual solicitation
15
+ 6. Any other criminal activity
16
+ 2. Engage in, promote, incite, or facilitate the harassment, abuse, threatening, or bullying of individuals or groups of individuals
17
+ 3. Engage in, promote, incite, or facilitate discrimination or other unlawful or harmful conduct in the provision of employment, employment benefits, credit, housing, other economic benefits, or other essential goods and services
18
+ 4. Engage in the unauthorized or unlicensed practice of any profession including, but not limited to, financial, legal, medical/health, or related professional practices
19
+ 5. Collect, process, disclose, generate, or infer health, demographic, or other sensitive personal or private information about individuals without rights and consents required by applicable laws
20
+ 6. Engage in or facilitate any action or generate any content that infringes, misappropriates, or otherwise violates any third-party rights, including the outputs or results of any products or services using the Llama 3 Materials
21
+ 7. Create, generate, or facilitate the creation of malicious code, malware, computer viruses or do anything else that could disable, overburden, interfere with or impair the proper working, integrity, operation or appearance of a website or computer system
22
+
23
+
24
+
25
+ 2. Engage in, promote, incite, facilitate, or assist in the planning or development of activities that present a risk of death or bodily harm to individuals, including use of Llama 3 related to the following:
26
+ 1. Military, warfare, nuclear industries or applications, espionage, use for materials or activities that are subject to the International Traffic Arms Regulations (ITAR) maintained by the United States Department of State
27
+ 2. Guns and illegal weapons (including weapon development)
28
+ 3. Illegal drugs and regulated/controlled substances
29
+ 4. Operation of critical infrastructure, transportation technologies, or heavy machinery
30
+ 5. Self-harm or harm to others, including suicide, cutting, and eating disorders
31
+ 6. Any content intended to incite or promote violence, abuse, or any infliction of bodily harm to an individual
32
+
33
+
34
+
35
+ 3. Intentionally deceive or mislead others, including use of Llama 3 related to the following:
36
+ 1. Generating, promoting, or furthering fraud or the creation or promotion of disinformation
37
+ 2. Generating, promoting, or furthering defamatory content, including the creation of defamatory statements, images, or other content
38
+ 3. Generating, promoting, or further distributing spam
39
+ 4. Impersonating another individual without consent, authorization, or legal right
40
+ 5. Representing that the use of Llama 3 or outputs are human-generated
41
+ 6. Generating or facilitating false online engagement, including fake reviews and other means of fake online engagement
42
+ 4. Fail to appropriately disclose to end users any known dangers of your AI system
43
+
44
+ Please report any violation of this Policy, software “bug,” or other problems that could lead to a violation of this Policy through one of the following means:
45
+
46
+ * Reporting issues with the model: [github.com/facebookresearch/llama](http://github.com/facebookresearch/llama)
47
+ * Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)
48
+ * Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)
49
+ * Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama: [LlamaUseReport@meta.com](mailto:LlamaUseReport@meta.com)
50
+
download.sh ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
4
+ # This software may be used and distributed according to the terms of the Llama 2 Community License Agreement.
5
+
6
+ set -e
7
+
8
+ read -p "Enter the URL from email: " PRESIGNED_URL
9
+ echo ""
10
+ read -p "Enter the list of models to download without spaces (8B,8B-instruct,70B,70B-instruct), or press Enter for all: " MODEL_SIZE
11
+ TARGET_FOLDER="." # where all files should end up
12
+ mkdir -p ${TARGET_FOLDER}
13
+
14
+ if [[ $MODEL_SIZE == "" ]]; then
15
+ MODEL_SIZE="8B,8B-instruct,70B,70B-instruct"
16
+ fi
17
+
18
+ echo "Downloading LICENSE and Acceptable Usage Policy"
19
+ wget --continue ${PRESIGNED_URL/'*'/"LICENSE"} -O ${TARGET_FOLDER}"/LICENSE"
20
+ wget --continue ${PRESIGNED_URL/'*'/"USE_POLICY"} -O ${TARGET_FOLDER}"/USE_POLICY"
21
+
22
+ for m in ${MODEL_SIZE//,/ }
23
+ do
24
+ if [[ $m == "8B" ]] || [[ $m == "8b" ]]; then
25
+ SHARD=0
26
+ MODEL_FOLDER_PATH="Meta-Llama-3-8B"
27
+ MODEL_PATH="8b_pre_trained"
28
+ elif [[ $m == "8B-instruct" ]] || [[ $m == "8b-instruct" ]] || [[ $m == "8b-Instruct" ]] || [[ $m == "8B-Instruct" ]]; then
29
+ SHARD=0
30
+ MODEL_FOLDER_PATH="Meta-Llama-3-8B-Instruct"
31
+ MODEL_PATH="8b_instruction_tuned"
32
+ elif [[ $m == "70B" ]] || [[ $m == "70b" ]]; then
33
+ SHARD=7
34
+ MODEL_FOLDER_PATH="Meta-Llama-3-70B"
35
+ MODEL_PATH="70b_pre_trained"
36
+ elif [[ $m == "70B-instruct" ]] || [[ $m == "70b-instruct" ]] || [[ $m == "70b-Instruct" ]] || [[ $m == "70B-Instruct" ]]; then
37
+ SHARD=7
38
+ MODEL_FOLDER_PATH="Meta-Llama-3-70B-Instruct"
39
+ MODEL_PATH="70b_instruction_tuned"
40
+ fi
41
+
42
+ echo "Downloading ${MODEL_PATH}"
43
+ mkdir -p ${TARGET_FOLDER}"/${MODEL_FOLDER_PATH}"
44
+
45
+ for s in $(seq -f "0%g" 0 ${SHARD})
46
+ do
47
+ wget --continue ${PRESIGNED_URL/'*'/"${MODEL_PATH}/consolidated.${s}.pth"} -O ${TARGET_FOLDER}"/${MODEL_FOLDER_PATH}/consolidated.${s}.pth"
48
+ done
49
+
50
+ wget --continue ${PRESIGNED_URL/'*'/"${MODEL_PATH}/params.json"} -O ${TARGET_FOLDER}"/${MODEL_FOLDER_PATH}/params.json"
51
+ wget --continue ${PRESIGNED_URL/'*'/"${MODEL_PATH}/tokenizer.model"} -O ${TARGET_FOLDER}"/${MODEL_FOLDER_PATH}/tokenizer.model"
52
+ wget --continue ${PRESIGNED_URL/'*'/"${MODEL_PATH}/checklist.chk"} -O ${TARGET_FOLDER}"/${MODEL_FOLDER_PATH}/checklist.chk"
53
+ echo "Checking checksums"
54
+ CPU_ARCH=$(uname -m)
55
+ if [[ "$CPU_ARCH" == "arm64" ]]; then
56
+ (cd ${TARGET_FOLDER}"/${MODEL_FOLDER_PATH}" && md5 checklist.chk)
57
+ else
58
+ (cd ${TARGET_FOLDER}"/${MODEL_FOLDER_PATH}" && md5sum -c checklist.chk)
59
+ fi
60
+ done
eval_details.md ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Llama 3 Evaluation Details
2
+ This document contains additional context on the settings and parameters for how we evaluated the Llama 3 pre-trained and instruct-aligned models.
3
+ ### Auto-eval benchmark notes
4
+ #### MMLU
5
+ - We are reporting macro averages for MMLU benchmarks. The micro average numbers for MMLU are: 65.4 and 67.4 for the 8B pre-trained and instruct-aligned models, 78.9 and 82.0 for the 70B pre-trained and instruct-aligned models
6
+ - The pre-trained models are evaluated in the standard way by calualting the likelihood of each choice character. For the instruct-aligned models, we use a dialogue prompt (*user/assistant*) for the shots and ask the model to generate the best choice character as answer.
7
+ #### AGI English
8
+ - We use the default few-shot and prompt settings as specified [here](https://github.com/ruixiangcui/AGIEval). The score is averaged over the english subtasks.
9
+ #### CommonSenseQA
10
+ - We use the same 7-shot chain-of-thought prompt as in [Wei et al. (2022)](https://arxiv.org/pdf/2201.11903.pdf).
11
+ #### Winogrande
12
+ - We use a choice based setup for evaluation where we fill in the missing blank with the two possible choices and then compute log-likelihood over the suffix. We use 5 shots for evaluation.
13
+ #### BIG-Bench Hard
14
+ - We use a 3-shot chain of thought style prompting and compute the average exact match over the subsets in this task.
15
+ #### ARC-Challenge
16
+ - We use the arc-challenge subset from the arc benchmark. We use 25 shots and use the MMLU setup for evaluation where we provide all the choices in the prompt and calculate likelihood over choice characters
17
+ #### TriviaQA-WIKI
18
+ - We evaluate on the Wiki validation set and use 5 few-shot examples.
19
+ #### SQuAD
20
+ - We are using SQuAD v2 and compute exact match in a 1-shot setting.
21
+ #### QuAC
22
+ - Same setting as Llama 2 (1-shot, f1).
23
+ #### BoolQ
24
+ - Same setting as Llama 1 and Llama 2 (0-shot, accuracy).
25
+ #### DROP
26
+ - For each validation example, we draw 3 random few-shot examples from the train split.
27
+ #### GPQA
28
+ - We report 0-shot exact match scores over the possible options using the Main subset for our models and other open-source models (Mistral, Gemma).
29
+ #### HumanEval
30
+ - Same setting as Llama 1 and Llama 2 (pass@1).
31
+ #### GSM8K
32
+ - We use the same 8-shot chain-of-thought prompt as in [Wei et al. (2022)](https://arxiv.org/pdf/2201.11903.pdf) (maj@1).
33
+ - Max generation length is 512 tokens.
34
+ #### MATH
35
+ - We use the 4-shot problem available in [Lewkowycz et al. (2022)](https://arxiv.org/pdf/2206.14858.pdf) (maj@1).
36
+ ### Human evaluation notes
37
+ This evaluation set contains 1,800 prompts that cover 12 key use cases: asking for advice, brainstorming, classification, closed question answering, coding, creative writing, extraction, inhabiting a character/persona, open question answering, reasoning, rewriting, and summarization.
38
+ |Category|Count|
39
+ |--------|-----|
40
+ |Coding|150|
41
+ |Mathematical reasoning|150|
42
+ |Asking for Advice|150|
43
+ |Brainstorming|150|
44
+ |Classification|150|
45
+ |Closed Question Answering|150|
46
+ |Creative Writing|150|
47
+ |Extraction|150|
48
+ |Inhabiting a Character/Persona|150|
49
+ |Open Question Answering|150|
50
+ |Rewriting|150|
51
+ |Summarization|150|
example_chat_completion.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ # This software may be used and distributed in accordance with the terms of the Llama 3 Community License Agreement.
3
+
4
+ from typing import List, Optional
5
+
6
+ import fire
7
+
8
+ from llama import Dialog, Llama
9
+
10
+
11
+ def main(
12
+ ckpt_dir: str,
13
+ tokenizer_path: str,
14
+ temperature: float = 0.6,
15
+ top_p: float = 0.9,
16
+ max_seq_len: int = 512,
17
+ max_batch_size: int = 4,
18
+ max_gen_len: Optional[int] = None,
19
+ ):
20
+ """
21
+ Examples to run with the models finetuned for chat. Prompts correspond of chat
22
+ turns between the user and assistant with the final one always being the user.
23
+
24
+ An optional system prompt at the beginning to control how the model should respond
25
+ is also supported.
26
+
27
+ The context window of llama3 models is 8192 tokens, so `max_seq_len` needs to be <= 8192.
28
+
29
+ `max_gen_len` is optional because finetuned models are able to stop generations naturally.
30
+ """
31
+ generator = Llama.build(
32
+ ckpt_dir=ckpt_dir,
33
+ tokenizer_path=tokenizer_path,
34
+ max_seq_len=max_seq_len,
35
+ max_batch_size=max_batch_size,
36
+ )
37
+
38
+ dialogs: List[Dialog] = [
39
+ [{"role": "user", "content": "what is the recipe of mayonnaise?"}],
40
+ [
41
+ {"role": "user", "content": "I am going to Paris, what should I see?"},
42
+ {
43
+ "role": "assistant",
44
+ "content": """\
45
+ Paris, the capital of France, is known for its stunning architecture, art museums, historical landmarks, and romantic atmosphere. Here are some of the top attractions to see in Paris:
46
+
47
+ 1. The Eiffel Tower: The iconic Eiffel Tower is one of the most recognizable landmarks in the world and offers breathtaking views of the city.
48
+ 2. The Louvre Museum: The Louvre is one of the world's largest and most famous museums, housing an impressive collection of art and artifacts, including the Mona Lisa.
49
+ 3. Notre-Dame Cathedral: This beautiful cathedral is one of the most famous landmarks in Paris and is known for its Gothic architecture and stunning stained glass windows.
50
+
51
+ These are just a few of the many attractions that Paris has to offer. With so much to see and do, it's no wonder that Paris is one of the most popular tourist destinations in the world.""",
52
+ },
53
+ {"role": "user", "content": "What is so great about #1?"},
54
+ ],
55
+ [
56
+ {"role": "system", "content": "Always answer with Haiku"},
57
+ {"role": "user", "content": "I am going to Paris, what should I see?"},
58
+ ],
59
+ [
60
+ {
61
+ "role": "system",
62
+ "content": "Always answer with emojis",
63
+ },
64
+ {"role": "user", "content": "How to go from Beijing to NY?"},
65
+ ],
66
+ ]
67
+ results = generator.chat_completion(
68
+ dialogs,
69
+ max_gen_len=max_gen_len,
70
+ temperature=temperature,
71
+ top_p=top_p,
72
+ )
73
+
74
+ for dialog, result in zip(dialogs, results):
75
+ for msg in dialog:
76
+ print(f"{msg['role'].capitalize()}: {msg['content']}\n")
77
+ print(
78
+ f"> {result['generation']['role'].capitalize()}: {result['generation']['content']}"
79
+ )
80
+ print("\n==================================\n")
81
+
82
+
83
+ if __name__ == "__main__":
84
+ fire.Fire(main)
example_text_completion.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ # This software may be used and distributed in accordance with the terms of the Llama 3 Community License Agreement.
3
+
4
+ from typing import List
5
+
6
+ import fire
7
+
8
+ from llama import Llama
9
+
10
+
11
+ def main(
12
+ ckpt_dir: str,
13
+ tokenizer_path: str,
14
+ temperature: float = 0.6,
15
+ top_p: float = 0.9,
16
+ max_seq_len: int = 128,
17
+ max_gen_len: int = 64,
18
+ max_batch_size: int = 4,
19
+ ):
20
+ """
21
+ Examples to run with the pre-trained models (no fine-tuning). Prompts are
22
+ usually in the form of an incomplete text prefix that the model can then try to complete.
23
+
24
+ The context window of llama3 models is 8192 tokens, so `max_seq_len` needs to be <= 8192.
25
+ `max_gen_len` is needed because pre-trained models usually do not stop completions naturally.
26
+ """
27
+ generator = Llama.build(
28
+ ckpt_dir=ckpt_dir,
29
+ tokenizer_path=tokenizer_path,
30
+ max_seq_len=max_seq_len,
31
+ max_batch_size=max_batch_size,
32
+ )
33
+
34
+ prompts: List[str] = [
35
+ # For these prompts, the expected answer is the natural continuation of the prompt
36
+ "I believe the meaning of life is",
37
+ "Simply put, the theory of relativity states that ",
38
+ """A brief message congratulating the team on the launch:
39
+
40
+ Hi everyone,
41
+
42
+ I just """,
43
+ # Few shot prompt (providing a few examples before asking model to complete more);
44
+ """Translate English to French:
45
+
46
+ sea otter => loutre de mer
47
+ peppermint => menthe poivrée
48
+ plush girafe => girafe peluche
49
+ cheese =>""",
50
+ ]
51
+ results = generator.text_completion(
52
+ prompts,
53
+ max_gen_len=max_gen_len,
54
+ temperature=temperature,
55
+ top_p=top_p,
56
+ )
57
+ for prompt, result in zip(prompts, results):
58
+ print(prompt)
59
+ print(f"> {result['generation']}")
60
+ print("\n==================================\n")
61
+
62
+
63
+ if __name__ == "__main__":
64
+ fire.Fire(main)
params.json ADDED
File without changes
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ torch
2
+ fairscale
3
+ fire
4
+ tiktoken==0.4.0
5
+ blobfile
setup.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ # This software may be used and distributed in accordance with the terms of the Llama 3 Community License Agreement.
3
+
4
+ from setuptools import find_packages, setup
5
+
6
+
7
+ def get_requirements(path: str):
8
+ return [l.strip() for l in open(path)]
9
+
10
+
11
+ setup(
12
+ name="llama3",
13
+ version="0.0.1",
14
+ packages=find_packages(),
15
+ install_requires=get_requirements("requirements.txt"),
16
+ )