Upload README.md
Browse files
README.md
CHANGED
@@ -3,8 +3,12 @@ inference: false
|
|
3 |
language:
|
4 |
- en
|
5 |
license: other
|
|
|
|
|
|
|
6 |
model_type: llama
|
7 |
pipeline_tag: text-generation
|
|
|
8 |
tags:
|
9 |
- facebook
|
10 |
- meta
|
@@ -30,76 +34,76 @@ tags:
|
|
30 |
<hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
|
31 |
<!-- header end -->
|
32 |
|
33 |
-
#
|
|
|
|
|
34 |
|
35 |
-
|
|
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
Many thanks to William Beauchamp from [Chai](https://chai-research.com/) for providing the hardware for these quantisations!
|
40 |
-
|
41 |
-
## ExLlama support for 70B is here!
|
42 |
-
|
43 |
-
As of [this commit](https://github.com/turboderp/exllama/commit/b3aea521859b83cfd889c4c00c05a323313b7fee), ExLlama has support for Llama 2 70B models.
|
44 |
-
|
45 |
-
Please make sure you update ExLlama to the latest version. If you are a text-generation-webui one-click user, you must first uninstall the ExLlama wheel, then clone ExLlama into `text-generation-webui/repositories`; full instructions are below.
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
Reminder: ExLlama does not support 3-bit models, so if you wish to try those quants, you will need to use AutoGPTQ or GPTQ-for-LLaMa.
|
50 |
-
|
51 |
-
## AutoGPTQ and GPTQ-for-LLaMa compatibility
|
52 |
-
|
53 |
-
Please update AutoGPTQ to version 0.3.1 or later. This will also update Transformers to 4.31.0, which is required for Llama 70B compatibility.
|
54 |
-
|
55 |
-
If you're using GPTQ-for-LLaMa, please update Transformers manually with:
|
56 |
-
```
|
57 |
-
pip3 install "transformers>=4.31.0"
|
58 |
-
```
|
59 |
|
|
|
|
|
60 |
## Repositories available
|
61 |
|
62 |
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Llama-2-70B-chat-GPTQ)
|
63 |
-
* [2, 3, 4, 5, 6 and 8-bit
|
64 |
-
* [
|
|
|
|
|
65 |
|
|
|
66 |
## Prompt template: Llama-2-Chat
|
67 |
|
68 |
```
|
69 |
[INST] <<SYS>>
|
70 |
You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
|
71 |
<</SYS>>
|
72 |
-
|
73 |
-
{prompt} [/INST]
|
74 |
-
```
|
75 |
-
|
76 |
-
To continue a conversation:
|
77 |
|
78 |
```
|
79 |
-
[INST] <<SYS>>
|
80 |
-
You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
|
81 |
-
<</SYS>>
|
82 |
|
83 |
-
|
84 |
-
```
|
85 |
|
86 |
-
|
|
|
87 |
|
88 |
Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
|
89 |
|
90 |
Each separate quant is in a different branch. See below for instructions on fetching from different branches.
|
91 |
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
| gptq-4bit-64g-actorder_True | 4 | 64 | True | 37.99 GB | True | AutoGPTQ | 4-bit, with Act Order and group size. 64g uses less VRAM than 32g, but with slightly lower accuracy. Poor AutoGPTQ CUDA speed. |
|
97 |
-
| gptq-4bit-128g-actorder_True | 4 | 128 | True | 36.65 GB | True | AutoGPTQ | 4-bit, with Act Order and group size. 128g uses even less VRAM, but with slightly lower accuracy. Poor AutoGPTQ CUDA speed. |
|
98 |
-
| gptq-3bit--1g-actorder_True | 3 | None | True | 26.78 GB | False | AutoGPTQ | 3-bit, with Act Order and no group size. Lowest possible VRAM requirements. May be lower quality than 3-bit 128g. |
|
99 |
-
| gptq-3bit-128g-actorder_False | 3 | 128 | False | 28.03 GB | False | AutoGPTQ | 3-bit, with group size 128g but no act-order. Slightly higher VRAM requirements than 3-bit None. |
|
100 |
-
| gptq-3bit-128g-actorder_True | 3 | 128 | True | 28.03 GB | False | AutoGPTQ | 3-bit, with group size 128g and act-order. Higher quality than 128g-False but poor AutoGPTQ CUDA speed. |
|
101 |
-
| gptq-3bit-64g-actorder_True | 3 | 64 | True | 29.30 GB | False | AutoGPTQ | 3-bit, with group size 64g and act-order. Highest quality 3-bit option. Poor AutoGPTQ CUDA speed. |
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
## How to download from branches
|
104 |
|
105 |
- In text-generation-webui, you can add `:branch` to the end of the download name, eg `TheBloke/Llama-2-70B-chat-GPTQ:gptq-4bit-32g-actorder_True`
|
@@ -108,91 +112,78 @@ Each separate quant is in a different branch. See below for instructions on fet
|
|
108 |
git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/Llama-2-70B-chat-GPTQ
|
109 |
```
|
110 |
- In Python Transformers code, the branch is the `revision` parameter; see below.
|
|
|
|
|
|
|
111 |
|
112 |
-
|
113 |
-
|
114 |
-
Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui), which includes support for Llama 2 models.
|
115 |
|
116 |
-
It is strongly recommended to use the text-generation-webui one-click-installers unless you know how to make a manual install.
|
117 |
-
|
118 |
-
### Use ExLlama (4-bit models only) - recommended option if you have enough VRAM for 4-bit
|
119 |
-
|
120 |
-
ExLlama has now been updated to support Llama 2 70B. Make sure you're using the latest version of ExLlama, and text-generation-webui if you're using that.
|
121 |
-
|
122 |
-
### Downloading and running the model in text-generation-webui
|
123 |
|
124 |
1. Click the **Model tab**.
|
125 |
2. Under **Download custom model or LoRA**, enter `TheBloke/Llama-2-70B-chat-GPTQ`.
|
126 |
- To download from a specific branch, enter for example `TheBloke/Llama-2-70B-chat-GPTQ:gptq-4bit-32g-actorder_True`
|
127 |
- see Provided Files above for the list of branches for each option.
|
128 |
3. Click **Download**.
|
129 |
-
4. The model will start downloading. Once it's finished it will say "Done"
|
130 |
-
5.
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
9.
|
136 |
-
|
137 |
-
|
|
|
138 |
## How to use this GPTQ model from Python code
|
139 |
|
140 |
-
|
141 |
|
142 |
-
|
143 |
-
|
|
|
|
|
|
|
144 |
```
|
145 |
|
146 |
-
|
147 |
|
148 |
-
```
|
149 |
-
pip3
|
|
|
|
|
|
|
150 |
```
|
151 |
|
152 |
-
|
153 |
|
154 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
155 |
|
156 |
```python
|
157 |
-
from transformers import AutoTokenizer, pipeline
|
158 |
-
from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
|
159 |
|
160 |
model_name_or_path = "TheBloke/Llama-2-70B-chat-GPTQ"
|
161 |
-
|
162 |
-
|
163 |
-
|
|
|
|
|
|
|
164 |
|
165 |
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
|
166 |
|
167 |
-
model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
|
168 |
-
model_basename=model_basename,
|
169 |
-
inject_fused_attention=False, # Required for Llama 2 70B model at this time.
|
170 |
-
use_safetensors=True,
|
171 |
-
trust_remote_code=False,
|
172 |
-
device="cuda:0",
|
173 |
-
use_triton=use_triton,
|
174 |
-
quantize_config=None)
|
175 |
-
|
176 |
-
"""
|
177 |
-
To download from a specific branch, use the revision parameter, as in this example:
|
178 |
-
|
179 |
-
model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
|
180 |
-
revision="gptq-4bit-32g-actorder_True",
|
181 |
-
model_basename=model_basename,
|
182 |
-
inject_fused_attention=False, # Required for Llama 2 70B model at this time.
|
183 |
-
use_safetensors=True,
|
184 |
-
trust_remote_code=False,
|
185 |
-
device="cuda:0",
|
186 |
-
quantize_config=None)
|
187 |
-
"""
|
188 |
-
|
189 |
prompt = "Tell me about AI"
|
190 |
-
system_message = "You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information."
|
191 |
prompt_template=f'''[INST] <<SYS>>
|
192 |
-
|
193 |
<</SYS>>
|
|
|
194 |
|
195 |
-
{prompt} [/INST]
|
196 |
'''
|
197 |
|
198 |
print("\n\n*** Generate:")
|
@@ -203,9 +194,6 @@ print(tokenizer.decode(output[0]))
|
|
203 |
|
204 |
# Inference can also be done using transformers' pipeline
|
205 |
|
206 |
-
# Prevent printing spurious transformers error when using pipeline with AutoGPTQ
|
207 |
-
logging.set_verbosity(logging.CRITICAL)
|
208 |
-
|
209 |
print("*** Pipeline:")
|
210 |
pipe = pipeline(
|
211 |
"text-generation",
|
@@ -219,14 +207,17 @@ pipe = pipeline(
|
|
219 |
|
220 |
print(pipe(prompt_template)[0]['generated_text'])
|
221 |
```
|
|
|
222 |
|
|
|
223 |
## Compatibility
|
224 |
|
225 |
-
The files provided
|
226 |
|
227 |
-
ExLlama is
|
228 |
|
229 |
-
|
|
|
230 |
|
231 |
<!-- footer start -->
|
232 |
<!-- 200823 -->
|
@@ -251,7 +242,7 @@ Donaters will get priority support on any and all AI/LLM/model questions and req
|
|
251 |
|
252 |
**Special thanks to**: Aemon Algiz.
|
253 |
|
254 |
-
**Patreon special mentions**:
|
255 |
|
256 |
|
257 |
Thank you to all my generous patrons and donaters!
|
@@ -260,7 +251,7 @@ And thank you again to a16z for their generous grant.
|
|
260 |
|
261 |
<!-- footer end -->
|
262 |
|
263 |
-
# Original model card: Meta's Llama 2 70B Chat
|
264 |
|
265 |
# **Llama 2**
|
266 |
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 70B 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.
|
@@ -295,6 +286,8 @@ Meta developed and publicly released the Llama 2 family of large language models
|
|
295 |
|
296 |
**License** A custom commercial license is available at: [https://ai.meta.com/resources/models-and-libraries/llama-downloads/](https://ai.meta.com/resources/models-and-libraries/llama-downloads/)
|
297 |
|
|
|
|
|
298 |
## Intended Use
|
299 |
**Intended Use Cases** Llama 2 is intended for commercial and research use in English. Tuned models are intended for assistant-like chat, whereas pretrained models can be adapted for a variety of natural language generation tasks.
|
300 |
|
|
|
3 |
language:
|
4 |
- en
|
5 |
license: other
|
6 |
+
model_creator: Meta Llama 2
|
7 |
+
model_link: https://huggingface.co/meta-llama/Llama-2-70b-chat-hf
|
8 |
+
model_name: Llama 2 70B Chat
|
9 |
model_type: llama
|
10 |
pipeline_tag: text-generation
|
11 |
+
quantized_by: TheBloke
|
12 |
tags:
|
13 |
- facebook
|
14 |
- meta
|
|
|
34 |
<hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
|
35 |
<!-- header end -->
|
36 |
|
37 |
+
# Llama 2 70B Chat - GPTQ
|
38 |
+
- Model creator: [Meta Llama 2](https://huggingface.co/meta-llama)
|
39 |
+
- Original model: [Llama 2 70B Chat](https://huggingface.co/meta-llama/Llama-2-70b-chat-hf)
|
40 |
|
41 |
+
<!-- description start -->
|
42 |
+
## Description
|
43 |
|
44 |
+
This repo contains GPTQ model files for [Meta Llama 2's Llama 2 70B Chat](https://huggingface.co/meta-llama/Llama-2-70b-chat-hf).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
+
Multiple GPTQ parameter permutations are provided; see Provided Files below for details of the options provided, their parameters, and the software used to create them.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
+
<!-- description end -->
|
49 |
+
<!-- repositories-available start -->
|
50 |
## Repositories available
|
51 |
|
52 |
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Llama-2-70B-chat-GPTQ)
|
53 |
+
* [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Llama-2-70B-chat-GGUF)
|
54 |
+
* [2, 3, 4, 5, 6 and 8-bit GGML models for CPU+GPU inference (deprecated)](https://huggingface.co/TheBloke/Llama-2-70B-chat-GGML)
|
55 |
+
* [Meta Llama 2's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/meta-llama/Llama-2-70b-chat-hf)
|
56 |
+
<!-- repositories-available end -->
|
57 |
|
58 |
+
<!-- prompt-template start -->
|
59 |
## Prompt template: Llama-2-Chat
|
60 |
|
61 |
```
|
62 |
[INST] <<SYS>>
|
63 |
You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
|
64 |
<</SYS>>
|
65 |
+
{prompt}[/INST]
|
|
|
|
|
|
|
|
|
66 |
|
67 |
```
|
|
|
|
|
|
|
68 |
|
69 |
+
<!-- prompt-template end -->
|
|
|
70 |
|
71 |
+
<!-- README_GPTQ.md-provided-files start -->
|
72 |
+
## Provided files and GPTQ parameters
|
73 |
|
74 |
Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
|
75 |
|
76 |
Each separate quant is in a different branch. See below for instructions on fetching from different branches.
|
77 |
|
78 |
+
All recent GPTQ files are made with AutoGPTQ, and all files in non-main branches are made with AutoGPTQ. Files in the `main` branch which were uploaded before August 2023 were made with GPTQ-for-LLaMa.
|
79 |
+
|
80 |
+
<details>
|
81 |
+
<summary>Explanation of GPTQ parameters</summary>
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
+
- Bits: The bit size of the quantised model.
|
84 |
+
- GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
|
85 |
+
- Act Order: True or False. Also known as `desc_act`. True results in better quantisation accuracy. Some GPTQ clients have had issues with models that use Act Order plus Group Size, but this is generally resolved now.
|
86 |
+
- Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
|
87 |
+
- GPTQ dataset: The dataset used for quantisation. Using a dataset more appropriate to the model's training can improve quantisation accuracy. Note that the GPTQ dataset is not the same as the dataset used to train the model - please refer to the original model repo for details of the training dataset(s).
|
88 |
+
- Sequence Length: The length of the dataset sequences used for quantisation. Ideally this is the same as the model sequence length. For some very long sequence models (16+K), a lower sequence length may have to be used. Note that a lower sequence length does not limit the sequence length of the quantised model. It only impacts the quantisation accuracy on longer inference sequences.
|
89 |
+
- ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama models in 4-bit.
|
90 |
+
|
91 |
+
</details>
|
92 |
+
|
93 |
+
| Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
|
94 |
+
| ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
|
95 |
+
| [main](https://huggingface.co/TheBloke/Llama-2-70B-chat-GPTQ/tree/main) | 4 | None | Yes | 0.01 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 35.33 GB | Yes | Most compatible option. Good inference speed in AutoGPTQ and GPTQ-for-LLaMa. Lower inference quality than other options. |
|
96 |
+
| [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/Llama-2-70B-chat-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.01 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 40.66 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. Poor AutoGPTQ CUDA speed. |
|
97 |
+
| [gptq-4bit-128g-actorder_True](https://huggingface.co/TheBloke/Llama-2-70B-chat-GPTQ/tree/gptq-4bit-128g-actorder_True) | 4 | 128 | Yes | 0.01 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 36.65 GB | Yes | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. Poor AutoGPTQ CUDA speed. |
|
98 |
+
| [gptq-3bit-64g-actorder_True](https://huggingface.co/TheBloke/Llama-2-70B-chat-GPTQ/tree/gptq-3bit-64g-actorder_True) | 3 | 64 | Yes | 0.01 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 29.30 GB | No | 3-bit, with group size 64g and act-order. Poor AutoGPTQ CUDA speed. |
|
99 |
+
| [gptq-3bit-128g-actorder_True](https://huggingface.co/TheBloke/Llama-2-70B-chat-GPTQ/tree/gptq-3bit-128g-actorder_True) | 3 | 128 | Yes | 0.01 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 28.03 GB | No | 3-bit, with group size 128g and act-order. Higher quality than 128g-False but poor AutoGPTQ CUDA speed. |
|
100 |
+
| [gptq-3bit-128g-actorder_False](https://huggingface.co/TheBloke/Llama-2-70B-chat-GPTQ/tree/gptq-3bit-128g-actorder_False) | 3 | 128 | No | 0.01 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 28.03 GB | No | 3-bit, with group size 128g but no act-order. Slightly higher VRAM requirements than 3-bit None. |
|
101 |
+
| [gptq-3bit--1g-actorder_True](https://huggingface.co/TheBloke/Llama-2-70B-chat-GPTQ/tree/gptq-3bit--1g-actorder_True) | 3 | None | Yes | 0.01 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 26.78 GB | No | 3-bit, with Act Order and no group size. Lowest possible VRAM requirements. May be lower quality than 3-bit 128g. |
|
102 |
+
| [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/Llama-2-70B-chat-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | Yes | 0.01 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 37.99 GB | Yes | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. Poor AutoGPTQ CUDA speed. |
|
103 |
+
|
104 |
+
<!-- README_GPTQ.md-provided-files end -->
|
105 |
+
|
106 |
+
<!-- README_GPTQ.md-download-from-branches start -->
|
107 |
## How to download from branches
|
108 |
|
109 |
- In text-generation-webui, you can add `:branch` to the end of the download name, eg `TheBloke/Llama-2-70B-chat-GPTQ:gptq-4bit-32g-actorder_True`
|
|
|
112 |
git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/Llama-2-70B-chat-GPTQ
|
113 |
```
|
114 |
- In Python Transformers code, the branch is the `revision` parameter; see below.
|
115 |
+
<!-- README_GPTQ.md-download-from-branches end -->
|
116 |
+
<!-- README_GPTQ.md-text-generation-webui start -->
|
117 |
+
## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
118 |
|
119 |
+
Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
|
|
|
|
|
120 |
|
121 |
+
It is strongly recommended to use the text-generation-webui one-click-installers unless you're sure you know how to make a manual install.
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
1. Click the **Model tab**.
|
124 |
2. Under **Download custom model or LoRA**, enter `TheBloke/Llama-2-70B-chat-GPTQ`.
|
125 |
- To download from a specific branch, enter for example `TheBloke/Llama-2-70B-chat-GPTQ:gptq-4bit-32g-actorder_True`
|
126 |
- see Provided Files above for the list of branches for each option.
|
127 |
3. Click **Download**.
|
128 |
+
4. The model will start downloading. Once it's finished it will say "Done".
|
129 |
+
5. In the top left, click the refresh icon next to **Model**.
|
130 |
+
6. In the **Model** dropdown, choose the model you just downloaded: `Llama-2-70B-chat-GPTQ`
|
131 |
+
7. The model will automatically load, and is now ready for use!
|
132 |
+
8. If you want any custom settings, set them and then click **Save settings for this model** followed by **Reload the Model** in the top right.
|
133 |
+
* Note that you do not need to and should not set manual GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
|
134 |
+
9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
|
135 |
+
<!-- README_GPTQ.md-text-generation-webui end -->
|
136 |
+
|
137 |
+
<!-- README_GPTQ.md-use-from-python start -->
|
138 |
## How to use this GPTQ model from Python code
|
139 |
|
140 |
+
### Install the necessary packages
|
141 |
|
142 |
+
Requires: Transformers 4.32.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
|
143 |
+
|
144 |
+
```shell
|
145 |
+
pip3 install transformers>=4.32.0 optimum>=1.12.0
|
146 |
+
pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
|
147 |
```
|
148 |
|
149 |
+
If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
|
150 |
|
151 |
+
```shell
|
152 |
+
pip3 uninstall -y auto-gptq
|
153 |
+
git clone https://github.com/PanQiWei/AutoGPTQ
|
154 |
+
cd AutoGPTQ
|
155 |
+
pip3 install .
|
156 |
```
|
157 |
|
158 |
+
### For CodeLlama models only: you must use Transformers 4.33.0 or later.
|
159 |
|
160 |
+
If 4.33.0 is not yet released when you read this, you will need to install Transformers from source:
|
161 |
+
```shell
|
162 |
+
pip3 uninstall -y transformers
|
163 |
+
pip3 install git+https://github.com/huggingface/transformers.git
|
164 |
+
```
|
165 |
+
|
166 |
+
### You can then use the following code
|
167 |
|
168 |
```python
|
169 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
|
|
170 |
|
171 |
model_name_or_path = "TheBloke/Llama-2-70B-chat-GPTQ"
|
172 |
+
# To use a different branch, change revision
|
173 |
+
# For example: revision="gptq-4bit-32g-actorder_True"
|
174 |
+
model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
|
175 |
+
torch_dtype=torch.float16,
|
176 |
+
device_map="auto",
|
177 |
+
revision="main")
|
178 |
|
179 |
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
|
180 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
181 |
prompt = "Tell me about AI"
|
|
|
182 |
prompt_template=f'''[INST] <<SYS>>
|
183 |
+
You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
|
184 |
<</SYS>>
|
185 |
+
{prompt}[/INST]
|
186 |
|
|
|
187 |
'''
|
188 |
|
189 |
print("\n\n*** Generate:")
|
|
|
194 |
|
195 |
# Inference can also be done using transformers' pipeline
|
196 |
|
|
|
|
|
|
|
197 |
print("*** Pipeline:")
|
198 |
pipe = pipeline(
|
199 |
"text-generation",
|
|
|
207 |
|
208 |
print(pipe(prompt_template)[0]['generated_text'])
|
209 |
```
|
210 |
+
<!-- README_GPTQ.md-use-from-python end -->
|
211 |
|
212 |
+
<!-- README_GPTQ.md-compatibility start -->
|
213 |
## Compatibility
|
214 |
|
215 |
+
The files provided are tested to work with AutoGPTQ, both via Transformers and using AutoGPTQ directly. They should also work with [Occ4m's GPTQ-for-LLaMa fork](https://github.com/0cc4m/KoboldAI).
|
216 |
|
217 |
+
[ExLlama](https://github.com/turboderp/exllama) is compatible with Llama models in 4-bit. Please see the Provided Files table above for per-file compatibility.
|
218 |
|
219 |
+
[Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) is compatible with all GPTQ models.
|
220 |
+
<!-- README_GPTQ.md-compatibility end -->
|
221 |
|
222 |
<!-- footer start -->
|
223 |
<!-- 200823 -->
|
|
|
242 |
|
243 |
**Special thanks to**: Aemon Algiz.
|
244 |
|
245 |
+
**Patreon special mentions**: Russ Johnson, J, alfie_i, Alex, NimbleBox.ai, Chadd, Mandus, Nikolai Manek, Ken Nordquist, ya boyyy, Illia Dulskyi, Viktor Bowallius, vamX, Iucharbius, zynix, Magnesian, Clay Pascal, Pierre Kircher, Enrico Ros, Tony Hughes, Elle, Andrey, knownsqashed, Deep Realms, Jerry Meng, Lone Striker, Derek Yates, Pyrater, Mesiah Bishop, James Bentley, Femi Adebogun, Brandon Frisco, SuperWojo, Alps Aficionado, Michael Dempsey, Vitor Caleffi, Will Dee, Edmond Seymore, usrbinkat, LangChain4j, Kacper Wikieł, Luke Pendergrass, John Detwiler, theTransient, Nathan LeClaire, Tiffany J. Kim, biorpg, Eugene Pentland, Stanislav Ovsiannikov, Fred von Graf, terasurfer, Kalila, Dan Guido, Nitin Borwankar, 阿明, Ai Maven, John Villwock, Gabriel Puliatti, Stephen Murray, Asp the Wyvern, danny, Chris Smitley, ReadyPlayerEmma, S_X, Daniel P. Andersen, Olakabola, Jeffrey Morgan, Imad Khwaja, Caitlyn Gatomon, webtim, Alicia Loh, Trenton Dambrowitz, Swaroop Kallakuri, Erik Bjäreholt, Leonard Tan, Spiking Neurons AB, Luke @flexchar, Ajan Kanaga, Thomas Belote, Deo Leter, RoA, Willem Michiel, transmissions 11, subjectnull, Matthew Berman, Joseph William Delisle, David Ziegler, Michael Davis, Johann-Peter Hartmann, Talal Aujan, senxiiz, Artur Olbinski, Rainer Wilmers, Spencer Kim, Fen Risland, Cap'n Zoog, Rishabh Srivastava, Michael Levine, Geoffrey Montalvo, Sean Connelly, Alexandros Triantafyllidis, Pieter, Gabriel Tamborski, Sam, Subspace Studios, Junyu Yang, Pedro Madruga, Vadim, Cory Kujawski, K, Raven Klaugh, Randy H, Mano Prime, Sebastain Graf, Space Cruiser
|
246 |
|
247 |
|
248 |
Thank you to all my generous patrons and donaters!
|
|
|
251 |
|
252 |
<!-- footer end -->
|
253 |
|
254 |
+
# Original model card: Meta Llama 2's Llama 2 70B Chat
|
255 |
|
256 |
# **Llama 2**
|
257 |
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 70B 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.
|
|
|
286 |
|
287 |
**License** A custom commercial license is available at: [https://ai.meta.com/resources/models-and-libraries/llama-downloads/](https://ai.meta.com/resources/models-and-libraries/llama-downloads/)
|
288 |
|
289 |
+
**Research Paper** ["Llama-2: Open Foundation and Fine-tuned Chat Models"](arxiv.org/abs/2307.09288)
|
290 |
+
|
291 |
## Intended Use
|
292 |
**Intended Use Cases** Llama 2 is intended for commercial and research use in English. Tuned models are intended for assistant-like chat, whereas pretrained models can be adapted for a variety of natural language generation tasks.
|
293 |
|