alokabhishek commited on
Commit
30db7a5
1 Parent(s): af0888c

Updated Readme

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