TheBloke commited on
Commit
8da738d
1 Parent(s): 06fdaf4

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +103 -67
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,129 +34,157 @@ tags:
30
  <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
31
  <!-- header end -->
32
 
33
- # Meta's Llama 2 13B-chat GPTQ
 
 
34
 
35
- These files are GPTQ model files for [Meta's Llama 2 13B-chat](https://huggingface.co/meta-llama/Llama-2-13b-chat-hf).
 
 
 
36
 
37
  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.
38
 
 
 
39
  ## Repositories available
40
 
41
  * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Llama-2-13B-chat-GPTQ)
42
- * [2, 3, 4, 5, 6 and 8-bit GGML models for CPU+GPU inference](https://huggingface.co/TheBloke/Llama-2-13B-chat-GGML)
43
- * [Original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/meta-llama/Llama-2-13B-chat-hf)
 
 
44
 
 
45
  ## Prompt template: Llama-2-Chat
46
 
47
  ```
48
  [INST] <<SYS>>
49
  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.
50
  <</SYS>>
51
-
52
- {prompt} [/INST]
53
- ```
54
-
55
- To continue a conversation:
56
 
57
  ```
58
- [INST] <<SYS>>
59
- 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.
60
- <</SYS>>
61
 
62
- {prompt} [/INST] {model_reply} [INST] {prompt} [/INST]
63
- ```
64
 
65
- ## Provided files
 
66
 
67
  Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
68
 
69
  Each separate quant is in a different branch. See below for instructions on fetching from different branches.
70
 
71
- | Branch | Bits | Group Size | Act Order (desc_act) | File Size | ExLlama Compatible? | Made With | Description |
72
- | ------ | ---- | ---------- | -------------------- | --------- | ------------------- | --------- | ----------- |
73
- | main | 4 | 128 | False | 7.26 GB | True | AutoGPTQ | Most compatible option. Good inference speed in AutoGPTQ and GPTQ-for-LLaMa. Lower inference quality than other options. |
74
- | gptq-4bit-32g-actorder_True | 4 | 32 | True | 8.00 GB | True | AutoGPTQ | 4-bit, with Act Order and group size. 32g gives highest possible inference quality, with maximum VRAM usage. Poor AutoGPTQ CUDA speed. |
75
- | gptq-4bit-64g-actorder_True | 4 | 64 | True | 7.51 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. |
76
- | gptq-4bit-128g-actorder_True | 4 | 128 | True | 7.26 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. |
77
- | gptq-8bit-128g-actorder_True | 8 | 128 | True | 13.65 GB | False | AutoGPTQ | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. Poor AutoGPTQ CUDA speed. |
78
- | gptq-8bit-64g-actorder_True | 8 | 64 | True | 13.95 GB | False | AutoGPTQ | 8-bit, with group size 64g and Act Order for maximum inference quality. Poor AutoGPTQ CUDA speed. |
79
- | gptq-8bit-128g-actorder_False | 8 | 128 | False | 13.65 GB | False | AutoGPTQ | 8-bit, with group size 128g for higher inference quality and without Act Order to improve AutoGPTQ speed. |
80
- | gptq-8bit--1g-actorder_True | 8 | None | True | 13.36 GB | False | AutoGPTQ | 8-bit, with Act Order. No group size, to lower VRAM requirements and to improve AutoGPTQ speed. |
 
 
 
 
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  ## How to download from branches
83
 
84
  - In text-generation-webui, you can add `:branch` to the end of the download name, eg `TheBloke/Llama-2-13B-chat-GPTQ:gptq-4bit-32g-actorder_True`
85
  - With Git, you can clone a branch with:
86
  ```
87
- git clone --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/Llama-2-13B-chat-GPTQ`
88
  ```
89
  - In Python Transformers code, the branch is the `revision` parameter; see below.
90
-
 
91
  ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
92
 
93
  Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
94
 
95
- It is strongly recommended to use the text-generation-webui one-click-installers unless you know how to make a manual install.
96
 
97
  1. Click the **Model tab**.
98
  2. Under **Download custom model or LoRA**, enter `TheBloke/Llama-2-13B-chat-GPTQ`.
99
  - To download from a specific branch, enter for example `TheBloke/Llama-2-13B-chat-GPTQ:gptq-4bit-32g-actorder_True`
100
  - see Provided Files above for the list of branches for each option.
101
  3. Click **Download**.
102
- 4. The model will start downloading. Once it's finished it will say "Done"
103
  5. In the top left, click the refresh icon next to **Model**.
104
  6. In the **Model** dropdown, choose the model you just downloaded: `Llama-2-13B-chat-GPTQ`
105
  7. The model will automatically load, and is now ready for use!
106
  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.
107
- * Note that you do not need to set GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
108
  9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
 
109
 
 
110
  ## How to use this GPTQ model from Python code
111
 
112
- First make sure you have [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ) installed:
113
 
114
- `GITHUB_ACTIONS=true pip install auto-gptq`
115
 
116
- Then try the following example code:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
 
118
  ```python
119
- from transformers import AutoTokenizer, pipeline, logging
120
- from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
121
 
122
  model_name_or_path = "TheBloke/Llama-2-13B-chat-GPTQ"
123
- model_basename = "model"
124
-
125
- use_triton = False
 
 
 
126
 
127
  tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
128
 
129
- model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
130
- model_basename=model_basename,
131
- use_safetensors=True,
132
- trust_remote_code=True,
133
- device="cuda:0",
134
- use_triton=use_triton,
135
- quantize_config=None)
136
-
137
- """
138
- To download from a specific branch, use the revision parameter, as in this example:
139
-
140
- model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
141
- revision="gptq-4bit-32g-actorder_True",
142
- model_basename=model_basename,
143
- use_safetensors=True,
144
- trust_remote_code=True,
145
- device="cuda:0",
146
- quantize_config=None)
147
- """
148
-
149
  prompt = "Tell me about AI"
150
- 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."
151
  prompt_template=f'''[INST] <<SYS>>
152
- {system_message}
153
  <</SYS>>
 
154
 
155
- {prompt} [/INST]'''
156
 
157
  print("\n\n*** Generate:")
158
 
@@ -162,9 +194,6 @@ print(tokenizer.decode(output[0]))
162
 
163
  # Inference can also be done using transformers' pipeline
164
 
165
- # Prevent printing spurious transformers error when using pipeline with AutoGPTQ
166
- logging.set_verbosity(logging.CRITICAL)
167
-
168
  print("*** Pipeline:")
169
  pipe = pipeline(
170
  "text-generation",
@@ -178,12 +207,17 @@ pipe = pipeline(
178
 
179
  print(pipe(prompt_template)[0]['generated_text'])
180
  ```
 
181
 
 
182
  ## Compatibility
183
 
184
- The files provided will work with AutoGPTQ (CUDA and Triton modes), GPTQ-for-LLaMa (only CUDA has been tested), and Occ4m's GPTQ-for-LLaMa fork.
 
 
185
 
186
- ExLlama works with Llama models in 4-bit. Please see the Provided Files table above for per-file compatibility.
 
187
 
188
  <!-- footer start -->
189
  <!-- 200823 -->
@@ -208,7 +242,7 @@ Donaters will get priority support on any and all AI/LLM/model questions and req
208
 
209
  **Special thanks to**: Aemon Algiz.
210
 
211
- **Patreon special mentions**: Sam, theTransient, Jonathan Leane, Steven Wood, webtim, Johann-Peter Hartmann, Geoffrey Montalvo, Gabriel Tamborski, Willem Michiel, John Villwock, Derek Yates, Mesiah Bishop, Eugene Pentland, Pieter, Chadd, Stephen Murray, Daniel P. Andersen, terasurfer, Brandon Frisco, Thomas Belote, Sid, Nathan LeClaire, Magnesian, Alps Aficionado, Stanislav Ovsiannikov, Alex, Joseph William Delisle, Nikolai Manek, Michael Davis, Junyu Yang, K, J, Spencer Kim, Stefan Sabev, Olusegun Samson, transmissions 11, Michael Levine, Cory Kujawski, Rainer Wilmers, zynix, Kalila, Luke @flexchar, Ajan Kanaga, Mandus, vamX, Ai Maven, Mano Prime, Matthew Berman, subjectnull, Vitor Caleffi, Clay Pascal, biorpg, alfie_i, 阿明, Jeffrey Morgan, ya boyyy, Raymond Fosdick, knownsqashed, Olakabola, Leonard Tan, ReadyPlayerEmma, Enrico Ros, Dave, Talal Aujan, Illia Dulskyi, Sean Connelly, senxiiz, Artur Olbinski, Elle, Raven Klaugh, Fen Risland, Deep Realms, Imad Khwaja, Fred von Graf, Will Dee, usrbinkat, SuperWojo, Alexandros Triantafyllidis, Swaroop Kallakuri, Dan Guido, John Detwiler, Pedro Madruga, Iucharbius, Viktor Bowallius, Asp the Wyvern, Edmond Seymore, Trenton Dambrowitz, Space Cruiser, Spiking Neurons AB, Pyrater, LangChain4j, Tony Hughes, Kacper Wikieł, Rishabh Srivastava, David Ziegler, Luke Pendergrass, Andrey, Gabriel Puliatti, Lone Striker, Sebastain Graf, Pierre Kircher, Randy H, NimbleBox.ai, Vadim, danny, Deo Leter
212
 
213
 
214
  Thank you to all my generous patrons and donaters!
@@ -252,6 +286,8 @@ Meta developed and publicly released the Llama 2 family of large language models
252
 
253
  **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/)
254
 
 
 
255
  ## Intended Use
256
  **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.
257
 
 
3
  language:
4
  - en
5
  license: other
6
+ model_creator: Meta Llama 2
7
+ model_link: https://huggingface.co/meta-llama/Llama-2-13b-chat-hf
8
+ model_name: Llama 2 13B 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 13B Chat - GPTQ
38
+ - Model creator: [Meta Llama 2](https://huggingface.co/meta-llama)
39
+ - Original model: [Llama 2 13B Chat](https://huggingface.co/meta-llama/Llama-2-13b-chat-hf)
40
 
41
+ <!-- description start -->
42
+ ## Description
43
+
44
+ This repo contains GPTQ model files for [Meta's Llama 2 13B-chat](https://huggingface.co/meta-llama/Llama-2-13b-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-13B-chat-GPTQ)
53
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Llama-2-13B-chat-GGUF)
54
+ * [2, 3, 4, 5, 6 and 8-bit GGML models for CPU+GPU inference (deprecated)](https://huggingface.co/TheBloke/Llama-2-13B-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-13B-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-13B-chat-GPTQ/tree/main) | 4 | 128 | No | 0.01 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 7.26 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-13B-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 | 8.00 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-64g-actorder_True](https://huggingface.co/TheBloke/Llama-2-13B-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 | 7.51 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. |
98
+ | [gptq-4bit-128g-actorder_True](https://huggingface.co/TheBloke/Llama-2-13B-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 | 7.26 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. |
99
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/Llama-2-13B-chat-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.01 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 13.65 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. Poor AutoGPTQ CUDA speed. |
100
+ | [gptq-8bit-64g-actorder_True](https://huggingface.co/TheBloke/Llama-2-13B-chat-GPTQ/tree/gptq-8bit-64g-actorder_True) | 8 | 64 | Yes | 0.01 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 13.95 GB | No | 8-bit, with group size 64g and Act Order for even higher inference quality. Poor AutoGPTQ CUDA speed. |
101
+ | [gptq-8bit-128g-actorder_False](https://huggingface.co/TheBloke/Llama-2-13B-chat-GPTQ/tree/gptq-8bit-128g-actorder_False) | 8 | 128 | No | 0.01 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 13.65 GB | No | 8-bit, with group size 128g for higher inference quality and without Act Order to improve AutoGPTQ speed. |
102
+ | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/Llama-2-13B-chat-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.01 | [wikitext](https://huggingface.co/datasets/wikitext/viewer/wikitext-2-v1/test) | 2048 | 13.36 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements and to improve AutoGPTQ 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-13B-chat-GPTQ:gptq-4bit-32g-actorder_True`
110
  - With Git, you can clone a branch with:
111
  ```
112
+ git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/Llama-2-13B-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-13B-chat-GPTQ`.
125
  - To download from a specific branch, enter for example `TheBloke/Llama-2-13B-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-13B-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-13B-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:")
190
 
 
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!
 
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