SweatyCrayfish commited on
Commit
7ce5934
1 Parent(s): 3f46ead

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +261 -0
README.md ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - facebook
7
+ - meta
8
+ - pytorch
9
+ - llama
10
+ - llama-3
11
+ - qlora
12
+ - quantization
13
+ - 4-bit
14
+ - lora
15
+ license: other
16
+ license_name: llama3
17
+ license_link: LICENSE
18
+ extra_gated_prompt: >-
19
+ ### META LLAMA 3 COMMUNITY LICENSE AGREEMENT
20
+
21
+ Meta Llama 3 Version Release Date: April 18, 2024
22
+
23
+ "Agreement" means the terms and conditions for use, reproduction, distribution
24
+ and modification of the Llama Materials set forth herein.
25
+
26
+ "Documentation" means the specifications, manuals and documentation
27
+ accompanying Meta Llama 3 distributed by Meta at
28
+ https://llama.meta.com/get-started/.
29
+
30
+ "Licensee" or "you" means you, or your employer or any other person or entity
31
+ (if you are entering into this Agreement on such person or entity’s behalf),
32
+ of the age required under applicable laws, rules or regulations to provide
33
+ legal consent and that has legal authority to bind your employer or such other
34
+ person or entity if you are entering in this Agreement on their behalf.
35
+
36
+ "Meta Llama 3" means the foundational large language models and software and
37
+ algorithms, including machine-learning model code, trained model weights,
38
+ inference-enabling code, training-enabling code, fine-tuning enabling code and
39
+ other elements of the foregoing distributed by Meta at
40
+ https://llama.meta.com/llama-downloads.
41
+
42
+ "Llama Materials" means, collectively, Meta’s proprietary Meta Llama 3 and
43
+ Documentation (and any portion thereof) made available under this Agreement.
44
+
45
+ "Meta" or "we" means Meta Platforms Ireland Limited (if you are located in or,
46
+ if you are an entity, your principal place of business is in the EEA or
47
+ Switzerland) and Meta Platforms, Inc. (if you are located outside of the EEA
48
+ or Switzerland).
49
+
50
+ 1. License Rights and Redistribution.
51
+
52
+ a. Grant of Rights. You are granted a non-exclusive, worldwide,
53
+ non-transferable and royalty-free limited license under Meta’s intellectual
54
+ property or other rights owned by Meta embodied in the Llama Materials to use,
55
+ reproduce, distribute, copy, create derivative works of, and make
56
+ modifications to the Llama Materials.
57
+
58
+ b. Redistribution and Use.
59
+
60
+ i. If you distribute or make available the Llama Materials (or any derivative
61
+ works thereof), or a product or service that uses any of them, including
62
+ another AI model, you shall (A) provide a copy of this Agreement with any such
63
+ Llama Materials; and (B) prominently display “Built with Meta Llama 3” on a
64
+ related website, user interface, blogpost, about page, or product
65
+ documentation. If you use the Llama Materials to create, train, fine tune, or
66
+ otherwise improve an AI model, which is distributed or made available, you
67
+ shall also include “Llama 3” at the beginning of any such AI model name.
68
+
69
+ ii. If you receive Llama Materials, or any derivative works thereof, from a
70
+ Licensee as part of an integrated end user product, then Section 2 of this
71
+ Agreement will not apply to you.
72
+
73
+ iii. You must retain in all copies of the Llama Materials that you distribute
74
+ the following attribution notice within a “Notice” text file distributed as a
75
+ part of such copies: “Meta Llama 3 is licensed under the Meta Llama 3
76
+ Community License, Copyright © Meta Platforms, Inc. All Rights Reserved.”
77
+
78
+ iv. Your use of the Llama Materials must comply with applicable laws and
79
+ regulations (including trade compliance laws and regulations) and adhere to
80
+ the Acceptable Use Policy for the Llama Materials (available at
81
+ https://llama.meta.com/llama3/use-policy), which is hereby incorporated by
82
+ reference into this Agreement.
83
+
84
+ v. You will not use the Llama Materials or any output or results of the Llama
85
+ Materials to improve any other large language model (excluding Meta Llama 3 or
86
+ derivative works thereof).
87
+
88
+ 2. Additional Commercial Terms. If, on the Meta Llama 3 version release date,
89
+ the monthly active users of the products or services made available by or for
90
+ Licensee, or Licensee’s affiliates, is greater than 700 million monthly active
91
+ users in the preceding calendar month, you must request a license from Meta,
92
+ which Meta may grant to you in its sole discretion, and you are not authorized
93
+ to exercise any of the rights under this Agreement unless or until Meta
94
+ otherwise expressly grants you such rights.
95
+
96
+ 3. Disclaimer of Warranty. UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA
97
+ MATERIALS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN “AS IS”
98
+ BASIS, WITHOUT WARRANTIES OF ANY KIND, AND META DISCLAIMS ALL WARRANTIES OF
99
+ ANY KIND, BOTH EXPRESS AND IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY
100
+ WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A
101
+ PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE
102
+ APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS AND ASSUME ANY
103
+ RISKS ASSOCIATED WITH YOUR USE OF THE LLAMA MATERIALS AND ANY OUTPUT AND
104
+ RESULTS.
105
+
106
+ 4. Limitation of Liability. IN NO EVENT WILL META OR ITS AFFILIATES BE LIABLE
107
+ UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS
108
+ LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, FOR ANY LOST PROFITS
109
+ OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY OR PUNITIVE
110
+ DAMAGES, EVEN IF META OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY
111
+ OF ANY OF THE FOREGOING.
112
+
113
+ 5. Intellectual Property.
114
+
115
+ a. No trademark licenses are granted under this Agreement, and in connection
116
+ with the Llama Materials, neither Meta nor Licensee may use any name or mark
117
+ owned by or associated with the other or any of its affiliates, except as
118
+ required for reasonable and customary use in describing and redistributing the
119
+ Llama Materials or as set forth in this Section 5(a). Meta hereby grants you a
120
+ license to use “Llama 3” (the “Mark”) solely as required to comply with the
121
+ last sentence of Section 1.b.i. You will comply with Meta’s brand guidelines
122
+ (currently accessible at
123
+ https://about.meta.com/brand/resources/meta/company-brand/ ). All goodwill
124
+ arising out of your use of the Mark will inure to the benefit of Meta.
125
+
126
+ b. Subject to Meta’s ownership of Llama Materials and derivatives made by or
127
+ for Meta, with respect to any derivative works and modifications of the Llama
128
+ Materials that are made by you, as between you and Meta, you are and will be
129
+ the owner of such derivative works and modifications.
130
+
131
+ c. If you institute litigation or other proceedings against Meta or any entity
132
+ (including a cross-claim or counterclaim in a lawsuit) alleging that the Llama
133
+ Materials or Meta Llama 3 outputs or results, or any portion of any of the
134
+ foregoing, constitutes infringement of intellectual property or other rights
135
+ owned or licensable by you, then any licenses granted to you under this
136
+ Agreement shall terminate as of the date such litigation or claim is filed or
137
+ instituted. You will indemnify and hold harmless Meta from and against any
138
+ claim by any third party arising out of or related to your use or distribution
139
+ of the Llama Materials.
140
+
141
+ 6. Term and Termination. The term of this Agreement will commence upon your
142
+ acceptance of this Agreement or access to the Llama Materials and will
143
+ continue in full force and effect until terminated in accordance with the
144
+ terms and conditions herein. Meta may terminate this Agreement if you are in
145
+ breach of any term or condition of this Agreement. Upon termination of this
146
+ Agreement, you shall delete and cease use of the Llama Materials. Sections 3,
147
+ 4 and 7 shall survive the termination of this Agreement.
148
+
149
+ 7. Governing Law and Jurisdiction. This Agreement will be governed and
150
+ construed under the laws of the State of California without regard to choice
151
+ of law principles, and the UN Convention on Contracts for the International
152
+ Sale of Goods does not apply to this Agreement. The courts of California shall
153
+ have exclusive jurisdiction of any dispute arising out of this Agreement.
154
+
155
+ ### Meta Llama 3 Acceptable Use Policy
156
+
157
+ Meta is committed to promoting safe and fair use of its tools and features,
158
+ including Meta Llama 3. If you access or use Meta Llama 3, you agree to this
159
+ Acceptable Use Policy (“Policy”). The most recent copy of this policy can be
160
+ found at
161
+ [https://llama.meta.com/llama3/use-policy](https://llama.meta.com/llama3/use-policy)
162
+
163
+ #### Prohibited Uses
164
+
165
+ We want everyone to use Meta Llama 3 safely and responsibly. You agree you
166
+ will not use, or allow others to use, Meta Llama 3 to: 1. Violate the law or
167
+ others’ rights, including to:
168
+ 1. Engage in, promote, generate, contribute to, encourage, plan, incite, or further illegal or unlawful activity or content, such as:
169
+ 1. Violence or terrorism
170
+ 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
171
+ 3. Human trafficking, exploitation, and sexual violence
172
+ 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.
173
+ 5. Sexual solicitation
174
+ 6. Any other criminal activity
175
+ 2. Engage in, promote, incite, or facilitate the harassment, abuse, threatening, or bullying of individuals or groups of individuals
176
+ 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
177
+ 4. Engage in the unauthorized or unlicensed practice of any profession including, but not limited to, financial, legal, medical/health, or related professional practices
178
+ 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
179
+ 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 Materials
180
+ 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
181
+ 2. Engage in, promote, incite, facilitate, or assist in the planning or
182
+ development of activities that present a risk of death or bodily harm to
183
+ individuals, including use of Meta Llama 3 related to the following:
184
+ 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
185
+ 2. Guns and illegal weapons (including weapon development)
186
+ 3. Illegal drugs and regulated/controlled substances
187
+ 4. Operation of critical infrastructure, transportation technologies, or heavy machinery
188
+ 5. Self-harm or harm to others, including suicide, cutting, and eating disorders
189
+ 6. Any content intended to incite or promote violence, abuse, or any infliction of bodily harm to an individual
190
+ 3. Intentionally deceive or mislead others, including use of Meta Llama 3
191
+ related to the following:
192
+ 1. Generating, promoting, or furthering fraud or the creation or promotion of disinformation
193
+ 2. Generating, promoting, or furthering defamatory content, including the creation of defamatory statements, images, or other content
194
+ 3. Generating, promoting, or further distributing spam
195
+ 4. Impersonating another individual without consent, authorization, or legal right
196
+ 5. Representing that the use of Meta Llama 3 or outputs are human-generated
197
+ 6. Generating or facilitating false online engagement, including fake reviews and other means of fake online engagement
198
+ 4. Fail to appropriately disclose to end users any known dangers of your AI
199
+ system
200
+
201
+ Please report any violation of this Policy, software “bug,” or other problems
202
+ that could lead to a violation of this Policy through one of the following
203
+ means:
204
+ * Reporting issues with the model: [https://github.com/meta-llama/llama3](https://github.com/meta-llama/llama3)
205
+ * Reporting risky content generated by the model:
206
+ developers.facebook.com/llama_output_feedback
207
+ * Reporting bugs and security concerns: facebook.com/whitehat/info
208
+ * Reporting violations of the Acceptable Use Policy or unlicensed uses of Meta Llama 3: LlamaUseReport@meta.com
209
+ extra_gated_fields:
210
+ First Name: text
211
+ Last Name: text
212
+ Date of birth: date_picker
213
+ Country: country
214
+ Affiliation: text
215
+ geo: ip_location
216
+ 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
217
+ extra_gated_description: >-
218
+ The information you provide will be collected, stored, processed and shared in
219
+ accordance with the [Meta Privacy
220
+ Policy](https://www.facebook.com/privacy/policy/).
221
+ extra_gated_button_content: Submit
222
+ ---
223
+ # 4-bit Quantized Llama 3 Model For Chat Bots
224
+
225
+ ## Description
226
+ This repository hosts the 4-bit quantized version of the Llama 3 model. Optimized for reduced memory usage and faster inference, this model is suitable for deployment in environments where computational resources are limited.
227
+
228
+ ## Model Details
229
+ - **Model Type**: Transformer-based language model.
230
+ - **Quantization**: 4-bit precision.
231
+ - **Advantages**:
232
+ - **Memory Efficiency**: Reduces memory usage significantly, allowing deployment on devices with limited RAM.
233
+ - **Inference Speed**: Accelerates inference times, depending on the hardware's ability to process low-bit computations.
234
+
235
+ ## How to Use
236
+ To utilize this model efficiently, follow the steps below:
237
+
238
+ ### Loading the Quantized Model
239
+ Load the model with specific parameters to ensure it utilizes 4-bit precision:
240
+ ```python
241
+ from transformers import AutoModelForCausalLM
242
+
243
+ model_4bit = AutoModelForCausalLM.from_pretrained("SweatyCrayfish/Llama-3-8B-Instruct-Quantized", device_map="auto", load_in_4bit=True)
244
+ ```
245
+ ## Adjusting Precision of Components
246
+ Adjust the precision of other components, which are by default converted to torch.float16:
247
+ ```python
248
+ import torch
249
+ from transformers import AutoModelForCausalLM
250
+
251
+ model_4bit = AutoModelForCausalLM.from_pretrained("SweatyCrayfish/Llama-3-8B-Instruct-Quantized", load_in_4bit=True, torch_dtype=torch.float32)
252
+ print(model_4bit.model.decoder.layers[-1].final_layer_norm.weight.dtype)
253
+ ```
254
+ ## Citation
255
+ Original repository and citations:
256
+ @article{llama3modelcard,
257
+ title={Llama 3 Model Card},
258
+ author={AI@Meta},
259
+ year={2024},
260
+ url = {https://github.com/meta-llama/llama3/blob/main/MODEL_CARD.md}
261
+ }