Skip to content

Commit 1f0feb7

Browse files
jspisakAshwin Bharambe
authored and
Ashwin Bharambe
committed
Initial commit
0 parents  commit 1f0feb7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+132333
-0
lines changed

.flake8

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[flake8]
2+
# Suggested config from pytorch that we can adapt
3+
select = B,C,E,F,N,P,T4,W,B9,TOR0,TOR1,TOR2
4+
max-line-length = 120
5+
# C408 ignored because we like the dict keyword argument syntax
6+
# E501 is not flexible enough, we're using B950 instead
7+
# N812 ignored because import torch.nn.functional as F is PyTorch convention
8+
# N817 ignored because importing using acronyms is convention (DistributedDataParallel as DDP)
9+
# E731 allow usage of assigning lambda expressions
10+
# E701 let black auto-format statements on one line
11+
# E704 let black auto-format statements on one line
12+
ignore =
13+
E203,E305,E402,E501,E721,E741,F405,F821,F841,F999,W503,W504,C408,E302,W291,E303,N812,N817,E731,E701,E704
14+
# shebang has extra meaning in fbcode lints, so I think it's not worth trying
15+
# to line this up with executable bit
16+
EXE001,
17+
# these ignores are from flake8-bugbear; please fix!
18+
B007,B008,B950
19+
optional-ascii-coding = True
20+
exclude =
21+
./.git,
22+
./docs
23+
./build
24+
./scripts,
25+
./venv,
26+
*.pyi
27+
.pre-commit-config.yaml
28+
*.md
29+
.flake8

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
__pycache__
2+
dist
3+
*.egg-info

.pre-commit-config.yaml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
exclude: 'build'
2+
3+
default_language_version:
4+
python: python3
5+
6+
repos:
7+
- repo: https://github.com/pre-commit/pre-commit-hooks
8+
rev: 6306a48f7dae5861702d573c9c247e4e9498e867
9+
hooks:
10+
- id: trailing-whitespace
11+
- id: check-ast
12+
- id: check-merge-conflict
13+
- id: check-added-large-files
14+
args: ['--maxkb=1000']
15+
- id: end-of-file-fixer
16+
exclude: '^(.*\.svg)$'
17+
18+
# Temporarily disabling this
19+
# - id: no-commit-to-branch
20+
# args: ['--branch=main']
21+
22+
- repo: https://github.com/Lucas-C/pre-commit-hooks
23+
rev: v1.5.4
24+
hooks:
25+
- id: insert-license
26+
files: \.py$|\.sh$
27+
args:
28+
- --license-filepath
29+
- docs/license_header.txt
30+
31+
- repo: https://github.com/pycqa/flake8
32+
rev: 34cbf8ef3950f43d09b85e2e45c15ae5717dc37b
33+
hooks:
34+
- id: flake8
35+
additional_dependencies:
36+
- flake8-bugbear == 22.4.25
37+
- pep8-naming == 0.12.1
38+
- torchfix
39+
args: ['--config=.flake8']
40+
41+
- repo: https://github.com/omnilib/ufmt
42+
rev: v2.7.0
43+
hooks:
44+
- id: ufmt
45+
additional_dependencies:
46+
- black == 24.4.2
47+
- usort == 1.0.8
48+
49+
# - repo: https://github.com/jsh9/pydoclint
50+
# rev: d88180a8632bb1602a4d81344085cf320f288c5a
51+
# hooks:
52+
# - id: pydoclint
53+
# args: [--config=pyproject.toml]

CODE_OF_CONDUCT.md

+80
Original file line numberDiff line numberDiff line change
@@ -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 <[email protected]>. 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

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Contributing to Llama-Models
2+
We want to make contributing to this project as easy and transparent as
3+
possible.
4+
5+
## Pull Requests
6+
We actively welcome your pull requests.
7+
8+
1. Fork the repo and create your branch from `main`.
9+
2. If you've added code that should be tested, add tests.
10+
3. If you've changed APIs, update the documentation.
11+
4. Ensure the test suite passes.
12+
5. Make sure your code lints.
13+
6. If you haven't already, complete the Contributor License Agreement ("CLA").
14+
15+
## Contributor License Agreement ("CLA")
16+
In order to accept your pull request, we need you to submit a CLA. You only need
17+
to do this once to work on any of Meta's open source projects.
18+
19+
Complete your CLA here: <https://code.facebook.com/cla>
20+
21+
## Issues
22+
We use GitHub issues to track public bugs. Please ensure your description is
23+
clear and has sufficient instructions to be able to reproduce the issue.
24+
25+
Meta has a [bounty program](http://facebook.com/whitehat/info) for the safe
26+
disclosure of security bugs. In those cases, please go through the process
27+
outlined on that page and do not file a public issue.
28+
29+
## Coding Style
30+
* 2 spaces for indentation rather than tabs
31+
* 80 character line length
32+
* ...
33+
34+
## License
35+
By contributing to Llama, you agree that your contributions will be licensed
36+
under the LICENSE file in the root directory of this source tree.

Llama_Repo.jpeg

276 KB
Loading

MANIFEST.in

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
include models/llama3_1/api/templates
2+
include models/llama3_1/api/templates/assistant_message.jinja
3+
include models/llama3_1/api/templates/user_message.jinja
4+
include models/llama3_1/api/templates/assistant_message.builtin_tool_call.yaml
5+
include models/llama3_1/api/templates/assistant_message.custom_tool_call.yaml
6+
include models/llama3_1/api/templates/assistant_message.default.yaml
7+
include models/llama3_1/api/templates/system_message.builtin_and_custom_tools.yaml
8+
include models/llama3_1/api/templates/system_message.builtin_tools_only.yaml
9+
include models/llama3_1/api/templates/system_message.custom_tools_only.yaml
10+
include models/llama3_1/api/templates/system_message.default.yaml
11+
include models/llama3_1/api/templates/system_message.jinja
12+
include models/llama3_1/api/templates/tool_message.failure.yaml
13+
include models/llama3_1/api/templates/tool_message.jinja
14+
include models/llama3_1/api/templates/tool_message.success.yaml
15+
include models/llama3_1/api/templates/user_message.default.yaml
16+
include models/llama3_1/api/tokenizer.model

README.md

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<p align="center">
2+
<img src="Llama_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+
# Llama Models
12+
Llama is an accessible, open large language model (LLM) designed for developers, researchers, and businesses to build, experiment, and responsibly scale their generative AI ideas. Part of a foundational system, it serves as a bedrock for innovation in the global community. A few key aspects:
13+
1. **Open access**: Easy accessibility to cutting-edge large language models, fostering collaboration and advancements among developers, researchers, and organizations
14+
2. **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!
15+
3. **Trust & 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
16+
17+
Our mission is to empower individuals and industry through this opportunity while fostering an environment of discovery and ethical AI advancements. The model weights are licensed for researchers and commercial entities, upholding the principles of openness.
18+
19+
## Llama Models
20+
21+
| **Model** | **Launch date** | **Model sizes** | **Context Length** | **Tokenizer** | **Acceptable use policy** | **License** | **Model Card** |
22+
| :----: | :----: | :----: | :----:|:----:|:----:|:----:|:----:|
23+
| Llama 2 | 7/18/2023 | 7B, 13B, 70B | 4K | Sentencepiece | [Use Policy](models/llama2/MODEL_CARD.md) | [License](models/llama2/LICENSE) | [Model Card](models/llama2/MODEL_CARD.md) |
24+
| Llama 3 | 4/18/2024 | 8B, 70B | 8K | TikToken-based | [Use Policy](models/llama3/MODEL_CARD.md) | [License](models/llama3/LICENSE) | [Model Card](models/llama3/MODEL_CARD.md) |
25+
| Llama 3.1 | 7/23/2024 | 8B, 70B, 405B | 128K | TikToken-based | [Use Policy](models/llama3_1/MODEL_CARD.md) | [License](models/llama3_1/LICENSE) | [Model Card](models/llama3_1/MODEL_CARD.md) |
26+
27+
## Download
28+
29+
To download the model weights and tokenizer, please visit the [Meta Llama website](https://llama.meta.com/llama-downloads/) and accept our License.
30+
31+
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.
32+
33+
Pre-requisites: Ensure you have `wget` and `md5sum` installed. Then run the script: `./download.sh`.
34+
35+
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`.
36+
37+
### Access to Hugging Face
38+
39+
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:
40+
41+
- Visit one of the repos, for example [meta-llama/Meta-Llama-3.1-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3.1-8B-Instruct).
42+
- 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.
43+
- 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`:
44+
45+
```bash
46+
huggingface-cli download meta-llama/Meta-Llama-3.1-8B-Instruct --include "original/*" --local-dir meta-llama/Meta-Llama-3.1-8B-Instruct
47+
```
48+
49+
**NOTE** The original native weights of meta-llama/Meta-Llama-3.1-405B would not be available through this HugginFace repo.
50+
51+
52+
- To use with transformers, the following [pipeline](https://huggingface.co/docs/transformers/en/main_classes/pipelines) snippet will download and cache the weights:
53+
54+
```python
55+
import transformers
56+
import torch
57+
58+
model_id = "meta-llama/Meta-Llama-3.1-8B-Instruct"
59+
60+
pipeline = transformers.pipeline(
61+
"text-generation",
62+
model="meta-llama/Meta-Llama-3.1-8B-Instruct",
63+
model_kwargs={"torch_dtype": torch.bfloat16},
64+
device="cuda",
65+
)
66+
```
67+
68+
## Responsible Use
69+
70+
Llama models are a new technology that carries potential risks with use. Testing conducted to date has not — and could not — cover all scenarios.
71+
To help developers address these risks, we have created the [Responsible Use Guide](https://ai.meta.com/static-resource/responsible-use-guide/).
72+
73+
## Issues
74+
75+
Please report any software “bug” or other problems with the models through one of the following means:
76+
- Reporting issues with the model: [https://github.com/issues](https://github.com/issues)
77+
- Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)
78+
- Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)
79+
80+
81+
## Questions
82+
83+
For common questions, the FAQ can be found [here](https://llama.meta.com/faq), which will be updated over time as new questions arise.

docs/license_header.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Copyright (c) Meta Platforms, Inc. and affiliates.
2+
All rights reserved.
3+
4+
This source code is licensed under the terms described in the LICENSE file in
5+
top-level folder for each specific model found within the models/ directory at
6+
the top-level of this source tree.

0 commit comments

Comments
 (0)