alokabhishek commited on
Commit
dcfe507
1 Parent(s): b07bfd4

Updated Readme

Browse files
Files changed (1) hide show
  1. README.md +141 -203
README.md CHANGED
@@ -1,212 +1,150 @@
1
  ---
2
- extra_gated_heading: You need to share contact information with Meta to access this model
3
- extra_gated_prompt: >-
4
- ### LLAMA 2 COMMUNITY LICENSE AGREEMENT
5
-
6
- "Agreement" means the terms and conditions for use, reproduction, distribution
7
- and modification of the Llama Materials set forth herein.
8
-
9
- "Documentation" means the specifications, manuals and documentation
10
- accompanying Llama 2 distributed by Meta at
11
- https://ai.meta.com/resources/models-and-libraries/llama-downloads/.
12
-
13
- "Licensee" or "you" means you, or your employer or any other person or entity
14
- (if you are entering into this Agreement on such person or entity's behalf),
15
- of the age required under applicable laws, rules or regulations to provide
16
- legal consent and that has legal authority to bind your employer or such other
17
- person or entity if you are entering in this Agreement on their behalf.
18
-
19
- "Llama 2" means the foundational large language models and software and
20
- algorithms, including machine-learning model code, trained model weights,
21
- inference-enabling code, training-enabling code, fine-tuning enabling code and
22
- other elements of the foregoing distributed by Meta at
23
- ai.meta.com/resources/models-and-libraries/llama-downloads/.
24
-
25
- "Llama Materials" means, collectively, Meta's proprietary Llama 2 and
26
- documentation (and any portion thereof) made available under this Agreement.
27
-
28
- "Meta" or "we" means Meta Platforms Ireland Limited (if you are located in or,
29
- if you are an entity, your principal place of business is in the EEA or
30
- Switzerland) and Meta Platforms, Inc. (if you are located outside of the EEA
31
- or Switzerland).
32
-
33
-
34
- By clicking "I Accept" below or by using or distributing any portion or
35
- element of the Llama Materials, you agree to be bound by this Agreement.
36
-
37
- 1. License Rights and Redistribution.
38
-
39
- a. Grant of Rights. You are granted a non-exclusive, worldwide, non-
40
- transferable and royalty-free limited license under Meta's intellectual
41
- property or other rights owned by Meta embodied in the Llama Materials to
42
- use, reproduce, distribute, copy, create derivative works of, and make
43
- modifications to the Llama Materials.
44
-
45
- b. Redistribution and Use.
46
-
47
- i. If you distribute or make the Llama Materials, or any derivative works
48
- thereof, available to a third party, you shall provide a copy of this
49
- Agreement to such third party.
50
-
51
- ii. If you receive Llama Materials, or any derivative works thereof, from a
52
- Licensee as part of an integrated end user product, then Section 2 of this
53
- Agreement will not apply to you.
54
-
55
- iii. You must retain in all copies of the Llama Materials that you distribute
56
- the following attribution notice within a "Notice" text file distributed as a
57
- part of such copies: "Llama 2 is licensed under the LLAMA 2 Community
58
- License, Copyright (c) Meta Platforms, Inc. All Rights Reserved."
59
-
60
- iv. Your use of the Llama Materials must comply with applicable laws and
61
- regulations (including trade compliance laws and regulations) and adhere to
62
- the Acceptable Use Policy for the Llama Materials (available at
63
- https://ai.meta.com/llama/use-policy), which is hereby incorporated by
64
- reference into this Agreement.
65
-
66
- v. You will not use the Llama Materials or any output or results of the Llama
67
- Materials to improve any other large language model (excluding Llama 2 or
68
- derivative works thereof).
69
-
70
-
71
- 2. Additional Commercial Terms. If, on the Llama 2 version release date, the
72
- monthly active users of the products or services made available by or for
73
- Licensee, or Licensee's affiliates, is greater than 700 million monthly
74
- active users in the preceding calendar month, you must request a license from
75
- Meta, which Meta may grant to you in its sole discretion, and you are not
76
- authorized to exercise any of the rights under this Agreement unless or until
77
- Meta otherwise expressly grants you such rights.
78
-
79
- 3. Disclaimer of Warranty. UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA
80
- MATERIALS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN "AS IS"
81
- BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
82
- WITHOUT LIMITATION, ANY WARRANTIES OF TITLE, NON-INFRINGEMENT,
83
- MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY
84
- RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING
85
- THE LLAMA MATERIALS AND ASSUME ANY RISKS ASSOCIATED WITH YOUR USE OF THE
86
- LLAMA MATERIALS AND ANY OUTPUT AND RESULTS.
87
-
88
- 4. Limitation of Liability. IN NO EVENT WILL META OR ITS AFFILIATES BE LIABLE
89
- UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE,
90
- PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, FOR ANY LOST
91
- PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY OR
92
- PUNITIVE DAMAGES, EVEN IF META OR ITS AFFILIATES HAVE BEEN ADVISED OF THE
93
- POSSIBILITY OF ANY OF THE FOREGOING.
94
-
95
-
96
- 5. Intellectual Property.
97
-
98
- a. No trademark licenses are granted under this Agreement, and in connection
99
- with the Llama Materials, neither Meta nor Licensee may use any name or mark
100
- owned by or associated with the other or any of its affiliates, except as
101
- required for reasonable and customary use in describing and redistributing
102
- the Llama Materials.
103
-
104
- b. Subject to Meta's ownership of Llama Materials and derivatives made by or
105
- for Meta, with respect to any derivative works and modifications of the Llama
106
- Materials that are made by you, as between you and Meta, you are and will be
107
- the owner of such derivative works and modifications.
108
-
109
- c. If you institute litigation or other proceedings against Meta or any
110
- entity (including a cross-claim or counterclaim in a lawsuit) alleging that
111
- the Llama Materials or Llama 2 outputs or results, or any portion of any of
112
- the foregoing, constitutes infringement of intellectual property or other
113
- rights owned or licensable by you, then any licenses granted to you under
114
- this Agreement shall terminate as of the date such litigation or claim is
115
- filed or instituted. You will indemnify and hold harmless Meta from and
116
- against any claim by any third party arising out of or related to your use or
117
- distribution of the Llama Materials.
118
-
119
- 6. Term and Termination. The term of this Agreement will commence upon your
120
- acceptance of this Agreement or access to the Llama Materials and will
121
- continue in full force and effect until terminated in accordance with the
122
- terms and conditions herein. Meta may terminate this Agreement if you are in
123
- breach of any term or condition of this Agreement. Upon termination of this
124
- Agreement, you shall delete and cease use of the Llama Materials. Sections 3,
125
- 4 and 7 shall survive the termination of this Agreement.
126
-
127
- 7. Governing Law and Jurisdiction. This Agreement will be governed and
128
- construed under the laws of the State of California without regard to choice
129
- of law principles, and the UN Convention on Contracts for the International
130
- Sale of Goods does not apply to this Agreement. The courts of California
131
- shall have exclusive jurisdiction of any dispute arising out of this
132
- Agreement.
133
-
134
- ### Llama 2 Acceptable Use Policy
135
-
136
- Meta is committed to promoting safe and fair use of its tools and features,
137
- including Llama 2. If you access or use Llama 2, you agree to this Acceptable
138
- Use Policy (“Policy”). The most recent copy of this policy can be found at
139
- [ai.meta.com/llama/use-policy](http://ai.meta.com/llama/use-policy).
140
-
141
- #### Prohibited Uses
142
-
143
- We want everyone to use Llama 2 safely and responsibly. You agree you will not
144
- use, or allow others to use, Llama 2 to:
145
-
146
- 1. Violate the law or others’ rights, including to:
147
- 1. Engage in, promote, generate, contribute to, encourage, plan, incite, or further illegal or unlawful activity or content, such as:
148
- 1. Violence or terrorism
149
- 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
150
- 3. Human trafficking, exploitation, and sexual violence
151
- 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.
152
- 5. Sexual solicitation
153
- 6. Any other criminal activity
154
- 2. Engage in, promote, incite, or facilitate the harassment, abuse, threatening, or bullying of individuals or groups of individuals
155
- 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
156
- 4. Engage in the unauthorized or unlicensed practice of any profession including, but not limited to, financial, legal, medical/health, or related professional practices
157
- 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
158
- 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 2 Materials
159
- 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
160
- 2. Engage in, promote, incite, facilitate, or assist in the planning or
161
- development of activities that present a risk of death or bodily harm to
162
- individuals, including use of Llama 2 related to the following:
163
- 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
164
- 2. Guns and illegal weapons (including weapon development)
165
- 3. Illegal drugs and regulated/controlled substances
166
- 4. Operation of critical infrastructure, transportation technologies, or heavy machinery
167
- 5. Self-harm or harm to others, including suicide, cutting, and eating disorders
168
- 6. Any content intended to incite or promote violence, abuse, or any infliction of bodily harm to an individual
169
- 3. Intentionally deceive or mislead others, including use of Llama 2 related
170
- to the following:
171
- 1. Generating, promoting, or furthering fraud or the creation or promotion of disinformation
172
- 2. Generating, promoting, or furthering defamatory content, including the creation of defamatory statements, images, or other content
173
- 3. Generating, promoting, or further distributing spam
174
- 4. Impersonating another individual without consent, authorization, or legal right
175
- 5. Representing that the use of Llama 2 or outputs are human-generated
176
- 6. Generating or facilitating false online engagement, including fake reviews and other means of fake online engagement
177
- 4. Fail to appropriately disclose to end users any known dangers of your AI system
178
- Please report any violation of this Policy, software “bug,” or other problems
179
- that could lead to a violation of this Policy through one of the following
180
- means:
181
- * Reporting issues with the model: [github.com/facebookresearch/llama](http://github.com/facebookresearch/llama)
182
- * Reporting risky content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)
183
- * Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)
184
- * Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama: [LlamaUseReport@meta.com](mailto:LlamaUseReport@meta.com)
185
- extra_gated_fields:
186
- First Name: text
187
- Last Name: text
188
- Date of birth: date_picker
189
- Country: country
190
- Affiliation: text
191
- geo: ip_location
192
- By clicking Submit below I accept the terms of the license and acknowledge that the information I provide will be collected stored processed and shared in accordance with the Meta Privacy Policy: checkbox
193
- extra_gated_description: >-
194
- The information you provide will be collected, stored, processed and shared in
195
- accordance with the [Meta Privacy
196
- Policy](https://www.facebook.com/privacy/policy/).
197
- extra_gated_button_content: Submit
198
- language:
199
- - en
200
- pipeline_tag: text-generation
201
  tags:
202
- - facebook
203
- - meta
204
- - pytorch
205
  - llama
206
  - llama-2
 
 
 
 
 
 
 
 
207
  license: llama2
 
208
  ---
209
- # **Llama 2**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  Llama 2 is a collection of pretrained and fine-tuned generative text models ranging in scale from 7 billion to 70 billion parameters. This is the repository for the 7B fine-tuned model, optimized for dialogue use cases and converted for the Hugging Face Transformers format. Links to other models can be found in the index at the bottom.
211
 
212
  ## Model Details
 
1
  ---
2
+ library_name: transformers
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  tags:
4
+ - 6bit
 
 
5
  - llama
6
  - llama-2
7
+ - facebook
8
+ - meta
9
+ - 7b
10
+ - quantized
11
+ - ExLlamaV2
12
+ - quantized
13
+ - exl2
14
+ - 6.0-bpw
15
  license: llama2
16
+ pipeline_tag: text-generation
17
  ---
18
+
19
+ # Model Card for alokabhishek/Llama-2-7b-chat-hf-6.0-bpw-exl2
20
+
21
+ <!-- Provide a quick summary of what the model is/does. -->
22
+
23
+ This repo contains 6-bit quantized (using ExLlamaV2) model of Meta's meta-llama/Llama-2-7b-chat-hf
24
+
25
+ ## Model Details
26
+
27
+ - Model creator: [Meta](https://huggingface.co/meta-llama)
28
+ - Original model: [Llama-2-7b-chat-hf](https://huggingface.co/meta-llama/Llama-2-7b-chat-hf)
29
+
30
+
31
+ ### About quantization using ExLlamaV2
32
+
33
+
34
+ - ExLlamaV2 github repo: [ExLlamaV2 github repo](https://github.com/turboderp/exllamav2)
35
+
36
+
37
+ # How to Get Started with the Model
38
+
39
+ Use the code below to get started with the model.
40
+
41
+
42
+ ## How to run from Python code
43
+
44
+ #### First install the package
45
+ ```shell
46
+ # Install ExLLamaV2
47
+ !git clone https://github.com/turboderp/exllamav2
48
+ !pip install -e exllamav2
49
+ ```
50
+
51
+ #### Import
52
+
53
+ ```python
54
+ from huggingface_hub import login, HfApi, create_repo
55
+ from torch import bfloat16
56
+ import locale
57
+ import torch
58
+ import os
59
+ ```
60
+
61
+ #### set up variables
62
+
63
+ ```python
64
+ # Define the model ID for the desired model
65
+ model_id = "alokabhishek/Llama-2-7b-chat-hf-6.0-bpw-exl2"
66
+ BPW = 6.0
67
+
68
+ # define variables
69
+ model_name = model_id.split("/")[-1]
70
+
71
+
72
+ ```
73
+
74
+ #### Download the quantized model
75
+ ```shell
76
+ !git-lfs install
77
+ # download the model to loacl directory
78
+ !git clone https://{username}:{HF_TOKEN}@huggingface.co/{model_id} {model_name}
79
+ ```
80
+
81
+ #### Run Inference on quantized model using
82
+ ```shell
83
+ # Run model
84
+ !python exllamav2/test_inference.py -m {model_name}/ -p "Tell me a funny joke about Large Language Models meeting a Blackhole in an intergalactic Bar."
85
+ ```
86
+
87
+
88
+ ```python
89
+
90
+ import sys, os
91
+
92
+ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
93
+
94
+ from exllamav2 import (
95
+ ExLlamaV2,
96
+ ExLlamaV2Config,
97
+ ExLlamaV2Cache,
98
+ ExLlamaV2Tokenizer,
99
+ )
100
+
101
+ from exllamav2.generator import ExLlamaV2BaseGenerator, ExLlamaV2Sampler
102
+
103
+ import time
104
+
105
+ # Initialize model and cache
106
+
107
+ model_directory = "/model_path/Llama-2-7b-chat-hf-6.0-bpw-exl2/"
108
+ print("Loading model: " + model_directory)
109
+
110
+ config = ExLlamaV2Config(model_directory)
111
+ model = ExLlamaV2(config)
112
+ cache = ExLlamaV2Cache(model, lazy=True)
113
+ model.load_autosplit(cache)
114
+ tokenizer = ExLlamaV2Tokenizer(config)
115
+
116
+ # Initialize generator
117
+
118
+ generator = ExLlamaV2BaseGenerator(model, cache, tokenizer)
119
+
120
+ # Generate some text
121
+
122
+ settings = ExLlamaV2Sampler.Settings()
123
+ settings.temperature = 0.85
124
+ settings.top_k = 50
125
+ settings.top_p = 0.8
126
+ settings.token_repetition_penalty = 1.01
127
+ settings.disallow_tokens(tokenizer, [tokenizer.eos_token_id])
128
+
129
+ prompt = "Tell me a funny joke about Large Language Models meeting a Blackhole in an intergalactic Bar."
130
+
131
+ max_new_tokens = 512
132
+
133
+ generator.warmup()
134
+ time_begin = time.time()
135
+
136
+ output = generator.generate_simple(prompt, settings, max_new_tokens, seed=1234)
137
+
138
+ time_end = time.time()
139
+ time_total = time_end - time_begin
140
+
141
+ print(output)
142
+
143
+
144
+ ```
145
+
146
+
147
+ # ** Origial Model Card - Llama 2**
148
  Llama 2 is a collection of pretrained and fine-tuned generative text models ranging in scale from 7 billion to 70 billion parameters. This is the repository for the 7B fine-tuned model, optimized for dialogue use cases and converted for the Hugging Face Transformers format. Links to other models can be found in the index at the bottom.
149
 
150
  ## Model Details