TheBloke commited on
Commit
74b7ef4
·
1 Parent(s): 43e87fd

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +72 -57
README.md CHANGED
@@ -2,7 +2,7 @@
2
  inference: false
3
  language:
4
  - en
5
- license: other
6
  model_creator: DeepSE
7
  model_link: https://huggingface.co/deepse/CodeUp-Llama-2-13b-chat-hf
8
  model_name: CodeUp Llama 2 13B Chat HF
@@ -34,18 +34,24 @@ tags:
34
  - Model creator: [DeepSE](https://huggingface.co/deepse)
35
  - Original model: [CodeUp Llama 2 13B Chat HF](https://huggingface.co/deepse/CodeUp-Llama-2-13b-chat-hf)
36
 
 
37
  ## Description
38
 
39
  This repo contains GPTQ model files for [DeepSE's CodeUp Llama 2 13B Chat HF](https://huggingface.co/deepse/CodeUp-Llama-2-13b-chat-hf).
40
 
41
  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.
42
 
 
 
43
  ## Repositories available
44
 
45
  * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ)
46
- * [2, 3, 4, 5, 6 and 8-bit GGML models for CPU+GPU inference](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GGML)
 
47
  * [DeepSE's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/deepse/CodeUp-Llama-2-13b-chat-hf)
 
48
 
 
49
  ## Prompt template: Alpaca
50
 
51
  ```
@@ -55,38 +61,45 @@ Below is an instruction that describes a task. Write a response that appropriate
55
  {prompt}
56
 
57
  ### Response:
 
58
  ```
59
 
 
 
 
60
  ## Provided files and GPTQ parameters
61
 
62
  Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
63
 
64
  Each separate quant is in a different branch. See below for instructions on fetching from different branches.
65
 
66
- All GPTQ files are made with AutoGPTQ.
67
 
68
  <details>
69
  <summary>Explanation of GPTQ parameters</summary>
70
 
71
  - Bits: The bit size of the quantised model.
72
  - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
73
- - Act Order: True or False. Also known as `desc_act`. True results in better quantisation accuracy. Some GPTQ clients have issues with models that use Act Order plus Group Size.
74
  - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
75
- - GPTQ dataset: The dataset used for quantisation. The dataset used for quantisation can affect the quantisation accuracy. The dataset used for quantisation is not the same as the dataset used to train the model.
76
- - 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 affects the quantisation accuracy on longer inference sequences.
77
  - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama models in 4-bit.
78
 
79
  </details>
80
 
81
  | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
82
  | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
83
- | [main](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ/tree/main) | 4 | 128 | No | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | 7.26 GB | Yes | Most compatible option. Good inference speed in AutoGPTQ and GPTQ-for-LLaMa. Lower inference quality than other options. |
84
- | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | 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. |
85
- | [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | 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. |
86
- | [gptq-4bit-128g-actorder_True](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ/tree/gptq-4bit-128g-actorder_True) | 4 | 128 | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | 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. |
87
- | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | 13.36 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements and to improve AutoGPTQ speed. |
88
  | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | 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. |
89
 
 
 
 
90
  ## How to download from branches
91
 
92
  - In text-generation-webui, you can add `:branch` to the end of the download name, eg `TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ:gptq-4bit-32g-actorder_True`
@@ -95,73 +108,72 @@ All GPTQ files are made with AutoGPTQ.
95
  git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ
96
  ```
97
  - In Python Transformers code, the branch is the `revision` parameter; see below.
98
-
 
99
  ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
100
 
101
  Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
102
 
103
- It is strongly recommended to use the text-generation-webui one-click-installers unless you know how to make a manual install.
104
 
105
  1. Click the **Model tab**.
106
  2. Under **Download custom model or LoRA**, enter `TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ`.
107
  - To download from a specific branch, enter for example `TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ:gptq-4bit-32g-actorder_True`
108
  - see Provided Files above for the list of branches for each option.
109
  3. Click **Download**.
110
- 4. The model will start downloading. Once it's finished it will say "Done"
111
  5. In the top left, click the refresh icon next to **Model**.
112
  6. In the **Model** dropdown, choose the model you just downloaded: `CodeUp-Llama-2-13B-Chat-HF-GPTQ`
113
  7. The model will automatically load, and is now ready for use!
114
  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.
115
- * Note that you do not need to set GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
116
  9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
 
117
 
 
118
  ## How to use this GPTQ model from Python code
119
 
120
- First make sure you have [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ) 0.3.1 or later installed:
121
 
122
- ```
123
- pip3 install auto-gptq
124
- ```
125
 
126
- If you have problems installing AutoGPTQ, please build from source instead:
 
 
127
  ```
 
 
 
 
128
  pip3 uninstall -y auto-gptq
129
  git clone https://github.com/PanQiWei/AutoGPTQ
130
  cd AutoGPTQ
131
  pip3 install .
132
  ```
133
 
134
- Then try the following example code:
 
 
 
 
 
 
 
 
135
 
136
  ```python
137
- from transformers import AutoTokenizer, pipeline, logging
138
- from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
139
 
140
  model_name_or_path = "TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ"
141
-
142
- use_triton = False
 
 
 
 
143
 
144
  tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
145
 
146
- model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
147
- use_safetensors=True,
148
- trust_remote_code=False,
149
- device="cuda:0",
150
- use_triton=use_triton,
151
- quantize_config=None)
152
-
153
- """
154
- # To download from a specific branch, use the revision parameter, as in this example:
155
- # Note that `revision` requires AutoGPTQ 0.3.1 or later!
156
-
157
- model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
158
- revision="gptq-4bit-32g-actorder_True",
159
- use_safetensors=True,
160
- trust_remote_code=False,
161
- device="cuda:0",
162
- quantize_config=None)
163
- """
164
-
165
  prompt = "Tell me about AI"
166
  prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
167
 
@@ -169,6 +181,7 @@ prompt_template=f'''Below is an instruction that describes a task. Write a respo
169
  {prompt}
170
 
171
  ### Response:
 
172
  '''
173
 
174
  print("\n\n*** Generate:")
@@ -179,9 +192,6 @@ print(tokenizer.decode(output[0]))
179
 
180
  # Inference can also be done using transformers' pipeline
181
 
182
- # Prevent printing spurious transformers error when using pipeline with AutoGPTQ
183
- logging.set_verbosity(logging.CRITICAL)
184
-
185
  print("*** Pipeline:")
186
  pipe = pipeline(
187
  "text-generation",
@@ -195,12 +205,17 @@ pipe = pipeline(
195
 
196
  print(pipe(prompt_template)[0]['generated_text'])
197
  ```
 
198
 
 
199
  ## Compatibility
200
 
201
- 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.
 
 
202
 
203
- ExLlama works with Llama models in 4-bit. Please see the Provided Files table above for per-file compatibility.
 
204
 
205
  <!-- footer start -->
206
  <!-- 200823 -->
@@ -225,7 +240,7 @@ Donaters will get priority support on any and all AI/LLM/model questions and req
225
 
226
  **Special thanks to**: Aemon Algiz.
227
 
228
- **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
229
 
230
 
231
  Thank you to all my generous patrons and donaters!
@@ -244,10 +259,10 @@ And thank you again to a16z for their generous grant.
244
  # CodeUp: A Multilingual Code Generation Llama2 Model with Parameter-Efficient Instruction-Tuning on a Single RTX 3090
245
 
246
  ## Description
247
- In recent years, large language models (LLMs) have shown exceptional capabilities in a wide range of applications due to their fantastic emergence ability. To align with human preference, instruction-tuning and reinforcement learning from human feedback (RLHF) are proposed for Chat-based LLMs (e.g., ChatGPT, GPT-4). However, these LLMs (except for Codex) primarily focus on the general domain and are not specifically designed for the code domain. Although Codex provides an alternative choice, it is a closed-source model developed by OpenAI. Hence, it is imperative to develop open-source instruction-following LLMs for the code domain.
248
- However, the large-scale number of LLMs' parameters ($\ge$7B) and training datasets require a vast amount of computational resources, which significantly impedes the development of training and inference on consumer hardware.
249
 
250
- To handle these challenges, in this project, we adopt the latest powerful foundation model `Llama 2` and construct high-quality instruction-following data for code generation tasks, and propose an instruction-following multilingual code generation Llama2 model. Meanwhile, to make it fit an academic budget and consumer hardware (e.g., a single RTX 3090) based on `Alpaca-LoRA`, we equip `CodeUp` with the advanced parameter-efficient fine-tuning (PEFT) methods (e.g., [LoRA](https://arxiv.org/abs/2106.09685)) which enable efficient adaptation of pre-trained language models (PLMs, also known as foundation model) to various downstream applications without fine-tuning the entire model's parameters. The overall training recipe is as follows.
251
 
252
  ![Training Framework](assets/Framework.jpg)
253
 
@@ -260,15 +275,15 @@ Recently, it has attracted significant attention to exploiting much larger and m
260
  - `output`: `str`, the answer to the instruction as generated by `text-davinci-003`.
261
 
262
  ### High-quality Data Filter
263
- However, after carefully checking the LLMs-self-generated data, we observe three critical problems that may hinder LLMs' instruction learning due to ambiguous and irrelevant noise. That is
264
 
265
  1. When `instruction` doesn't specify the programming language (PL) of implementation, the `output` appears with diverse options, e.g., Python, C++, and JavaScript.
266
  2. It is ambiguous to identify which programming language `output` is implemented by.
267
- 3. Both `instruction` and `output` are irrelevant to the code-specific domain.
268
 
269
- Hence, we filter the ambiguous and irrelevant data by rigorous design to obtain high-quality instruction data. Specifically, to solve 1) we set Python as the default PL of implementation and use [Guesslang](https://guesslang.readthedocs.io/en/latest/) package to detect the PL of a given source code in `output`. If the Python is detected, this prompt is retained. Otherwise, it will be filtered. 2) and 3) In these cases, we delete these prompts. After that, about 5K low-quality instruction data is filtered. To supplement the high-quality instruction data, we further integrate the `data/new_codealpaca.json` data (about 4.5K) under the above filter rules.
270
 
271
- This way, we gain the 19K high-quality instruction data of code generation. The following is the instruction number distribution of each PL with Radar visualization before and after filtering.
272
 
273
  <!-- | Raw Data (20K + 4K)| Filtered Data (19K) |
274
  | -- | -- |
 
2
  inference: false
3
  language:
4
  - en
5
+ license: llama2
6
  model_creator: DeepSE
7
  model_link: https://huggingface.co/deepse/CodeUp-Llama-2-13b-chat-hf
8
  model_name: CodeUp Llama 2 13B Chat HF
 
34
  - Model creator: [DeepSE](https://huggingface.co/deepse)
35
  - Original model: [CodeUp Llama 2 13B Chat HF](https://huggingface.co/deepse/CodeUp-Llama-2-13b-chat-hf)
36
 
37
+ <!-- description start -->
38
  ## Description
39
 
40
  This repo contains GPTQ model files for [DeepSE's CodeUp Llama 2 13B Chat HF](https://huggingface.co/deepse/CodeUp-Llama-2-13b-chat-hf).
41
 
42
  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.
43
 
44
+ <!-- description end -->
45
+ <!-- repositories-available start -->
46
  ## Repositories available
47
 
48
  * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ)
49
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GGUF)
50
+ * [2, 3, 4, 5, 6 and 8-bit GGML models for CPU+GPU inference (deprecated)](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GGML)
51
  * [DeepSE's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/deepse/CodeUp-Llama-2-13b-chat-hf)
52
+ <!-- repositories-available end -->
53
 
54
+ <!-- prompt-template start -->
55
  ## Prompt template: Alpaca
56
 
57
  ```
 
61
  {prompt}
62
 
63
  ### Response:
64
+
65
  ```
66
 
67
+ <!-- prompt-template end -->
68
+
69
+ <!-- README_GPTQ.md-provided-files start -->
70
  ## Provided files and GPTQ parameters
71
 
72
  Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
73
 
74
  Each separate quant is in a different branch. See below for instructions on fetching from different branches.
75
 
76
+ 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.
77
 
78
  <details>
79
  <summary>Explanation of GPTQ parameters</summary>
80
 
81
  - Bits: The bit size of the quantised model.
82
  - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
83
+ - 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.
84
  - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
85
+ - 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).
86
+ - 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.
87
  - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama models in 4-bit.
88
 
89
  </details>
90
 
91
  | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
92
  | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
93
+ | [main](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ/tree/main) | 4 | 128 | No | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | 7.26 GB | Yes | Most compatible option. Good inference speed in AutoGPTQ and GPTQ-for-LLaMa. Lower inference quality than other options. |
94
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | 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. |
95
+ | [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | 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. |
96
+ | [gptq-4bit-128g-actorder_True](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ/tree/gptq-4bit-128g-actorder_True) | 4 | 128 | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | 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. |
97
+ | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | 13.36 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements and to improve AutoGPTQ speed. |
98
  | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | 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. |
99
 
100
+ <!-- README_GPTQ.md-provided-files end -->
101
+
102
+ <!-- README_GPTQ.md-download-from-branches start -->
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/CodeUp-Llama-2-13B-Chat-HF-GPTQ:gptq-4bit-32g-actorder_True`
 
108
  git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ
109
  ```
110
  - In Python Transformers code, the branch is the `revision` parameter; see below.
111
+ <!-- README_GPTQ.md-download-from-branches end -->
112
+ <!-- README_GPTQ.md-text-generation-webui start -->
113
  ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
114
 
115
  Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
116
 
117
+ 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.
118
 
119
  1. Click the **Model tab**.
120
  2. Under **Download custom model or LoRA**, enter `TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ`.
121
  - To download from a specific branch, enter for example `TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ:gptq-4bit-32g-actorder_True`
122
  - see Provided Files above for the list of branches for each option.
123
  3. Click **Download**.
124
+ 4. The model will start downloading. Once it's finished it will say "Done".
125
  5. In the top left, click the refresh icon next to **Model**.
126
  6. In the **Model** dropdown, choose the model you just downloaded: `CodeUp-Llama-2-13B-Chat-HF-GPTQ`
127
  7. The model will automatically load, and is now ready for use!
128
  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.
129
+ * 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`.
130
  9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
131
+ <!-- README_GPTQ.md-text-generation-webui end -->
132
 
133
+ <!-- README_GPTQ.md-use-from-python start -->
134
  ## How to use this GPTQ model from Python code
135
 
136
+ ### Install the necessary packages
137
 
138
+ Requires: Transformers 4.32.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
 
 
139
 
140
+ ```shell
141
+ pip3 install transformers>=4.32.0 optimum>=1.12.0
142
+ pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
143
  ```
144
+
145
+ If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
146
+
147
+ ```shell
148
  pip3 uninstall -y auto-gptq
149
  git clone https://github.com/PanQiWei/AutoGPTQ
150
  cd AutoGPTQ
151
  pip3 install .
152
  ```
153
 
154
+ ### For CodeLlama models only: you must use Transformers 4.33.0 or later.
155
+
156
+ If 4.33.0 is not yet released when you read this, you will need to install Transformers from source:
157
+ ```shell
158
+ pip3 uninstall -y transformers
159
+ pip3 install git+https://github.com/huggingface/transformers.git
160
+ ```
161
+
162
+ ### You can then use the following code
163
 
164
  ```python
165
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
 
166
 
167
  model_name_or_path = "TheBloke/CodeUp-Llama-2-13B-Chat-HF-GPTQ"
168
+ # To use a different branch, change revision
169
+ # For example: revision="gptq-4bit-32g-actorder_True"
170
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
171
+ torch_dtype=torch.float16,
172
+ device_map="auto",
173
+ revision="main")
174
 
175
  tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  prompt = "Tell me about AI"
178
  prompt_template=f'''Below is an instruction that describes a task. Write a response that appropriately completes the request.
179
 
 
181
  {prompt}
182
 
183
  ### Response:
184
+
185
  '''
186
 
187
  print("\n\n*** Generate:")
 
192
 
193
  # Inference can also be done using transformers' pipeline
194
 
 
 
 
195
  print("*** Pipeline:")
196
  pipe = pipeline(
197
  "text-generation",
 
205
 
206
  print(pipe(prompt_template)[0]['generated_text'])
207
  ```
208
+ <!-- README_GPTQ.md-use-from-python end -->
209
 
210
+ <!-- README_GPTQ.md-compatibility start -->
211
  ## Compatibility
212
 
213
+ 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).
214
+
215
+ [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.
216
 
217
+ [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) is compatible with all GPTQ models.
218
+ <!-- README_GPTQ.md-compatibility end -->
219
 
220
  <!-- footer start -->
221
  <!-- 200823 -->
 
240
 
241
  **Special thanks to**: Aemon Algiz.
242
 
243
+ **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
244
 
245
 
246
  Thank you to all my generous patrons and donaters!
 
259
  # CodeUp: A Multilingual Code Generation Llama2 Model with Parameter-Efficient Instruction-Tuning on a Single RTX 3090
260
 
261
  ## Description
262
+ In recent years, large language models (LLMs) have shown exceptional capabilities in a wide range of applications due to their fantastic emergence ability. To align with human preference, instruction-tuning and reinforcement learning from human feedback (RLHF) are proposed for Chat-based LLMs (e.g., ChatGPT, GPT-4). However, these LLMs (except for Codex) primarily focus on the general domain and are not specifically designed for the code domain. Although Codex provides an alternative choice, it is a closed-source model developed by OpenAI. Hence, it is imperative to develop open-source instruction-following LLMs for the code domain.
263
+ However, the large-scale number of LLMs' parameters ($\ge$7B) and training datasets require a vast amount of computational resources, which significantly impedes the development of training and inference on consumer hardware.
264
 
265
+ To handle these challenges, in this project, we adopt the latest powerful foundation model `Llama 2` and construct high-quality instruction-following data for code generation tasks, and propose an instruction-following multilingual code generation Llama2 model. Meanwhile, to make it fit an academic budget and consumer hardware (e.g., a single RTX 3090) based on `Alpaca-LoRA`, we equip `CodeUp` with the advanced parameter-efficient fine-tuning (PEFT) methods (e.g., [LoRA](https://arxiv.org/abs/2106.09685)) which enable efficient adaptation of pre-trained language models (PLMs, also known as foundation model) to various downstream applications without fine-tuning the entire model's parameters. The overall training recipe is as follows.
266
 
267
  ![Training Framework](assets/Framework.jpg)
268
 
 
275
  - `output`: `str`, the answer to the instruction as generated by `text-davinci-003`.
276
 
277
  ### High-quality Data Filter
278
+ However, after carefully checking the LLMs-self-generated data, we observe three critical problems that may hinder LLMs' instruction learning due to ambiguous and irrelevant noise. That is
279
 
280
  1. When `instruction` doesn't specify the programming language (PL) of implementation, the `output` appears with diverse options, e.g., Python, C++, and JavaScript.
281
  2. It is ambiguous to identify which programming language `output` is implemented by.
282
+ 3. Both `instruction` and `output` are irrelevant to the code-specific domain.
283
 
284
+ Hence, we filter the ambiguous and irrelevant data by rigorous design to obtain high-quality instruction data. Specifically, to solve 1) we set Python as the default PL of implementation and use [Guesslang](https://guesslang.readthedocs.io/en/latest/) package to detect the PL of a given source code in `output`. If the Python is detected, this prompt is retained. Otherwise, it will be filtered. 2) and 3) In these cases, we delete these prompts. After that, about 5K low-quality instruction data is filtered. To supplement the high-quality instruction data, we further integrate the `data/new_codealpaca.json` data (about 4.5K) under the above filter rules.
285
 
286
+ This way, we gain the 19K high-quality instruction data of code generation. The following is the instruction number distribution of each PL with Radar visualization before and after filtering.
287
 
288
  <!-- | Raw Data (20K + 4K)| Filtered Data (19K) |
289
  | -- | -- |