TheBloke commited on
Commit
e00418f
1 Parent(s): 348ad3d

Initial GPTQ model commit

Browse files
Files changed (1) hide show
  1. README.md +330 -0
README.md ADDED
@@ -0,0 +1,330 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - bigcode/starcoderdata
4
+ inference: false
5
+ language:
6
+ - code
7
+ license: apache-2.0
8
+ model-index:
9
+ - name: stabilityai/stablecode-completion-alpha-3b-4k
10
+ results:
11
+ - dataset:
12
+ name: HumanEval
13
+ type: openai_humaneval
14
+ metrics:
15
+ - name: pass@1
16
+ type: pass@1
17
+ value: 0.1768
18
+ verified: false
19
+ - name: pass@10
20
+ type: pass@10
21
+ value: 0.2701
22
+ verified: false
23
+ task:
24
+ type: text-generation
25
+ model_creator: StabilityAI
26
+ model_link: https://huggingface.co/stabilityai/stablecode-completion-alpha-3b-4k
27
+ model_name: Stablecode Completion Alpha 3B 4K
28
+ model_type: gptneox
29
+ quantized_by: TheBloke
30
+ tags:
31
+ - causal-lm
32
+ ---
33
+
34
+ <!-- header start -->
35
+ <div style="width: 100%;">
36
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
37
+ </div>
38
+ <div style="display: flex; justify-content: space-between; width: 100%;">
39
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
40
+ <p><a href="https://discord.gg/theblokeai">Chat & support: my new Discord server</a></p>
41
+ </div>
42
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
43
+ <p><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
44
+ </div>
45
+ </div>
46
+ <!-- header end -->
47
+
48
+ # Stablecode Completion Alpha 3B 4K - GPTQ
49
+ - Model creator: [StabilityAI](https://huggingface.co/StabilityAI)
50
+ - Original model: [Stablecode Completion Alpha 3B 4K](https://huggingface.co/stabilityai/stablecode-completion-alpha-3b-4k)
51
+
52
+ ## Description
53
+
54
+ This repo contains GPTQ model files for [StabilityAI's Stablecode Completion Alpha 3B 4K](https://huggingface.co/stabilityai/stablecode-completion-alpha-3b-4k).
55
+
56
+ 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.
57
+
58
+ ## Repositories available
59
+
60
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/stablecode-completion-alpha-3b-4k-GPTQ)
61
+ * [2, 3, 4, 5, 6 and 8-bit GGML models for CPU+GPU inference](https://huggingface.co/TheBloke/stablecode-completion-alpha-3b-4k-GGML)
62
+ * [StabilityAI's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/stabilityai/stablecode-completion-alpha-3b-4k)
63
+
64
+ ## Prompt template: Custom
65
+
66
+ Just enter code to complete:
67
+ ```
68
+ import torch
69
+ import torch.nn as nn
70
+ ```
71
+
72
+
73
+ ## Provided files and GPTQ parameters
74
+
75
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
76
+
77
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
78
+
79
+ All GPTQ files are made with AutoGPTQ.
80
+
81
+ <details>
82
+ <summary>Explanation of GPTQ parameters</summary>
83
+
84
+ - Bits: The bit size of the quantised model.
85
+ - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
86
+ - 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.
87
+ - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
88
+ - 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).
89
+ - 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.
90
+ - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama models in 4-bit.
91
+
92
+ </details>
93
+
94
+ | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
95
+ | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
96
+ | [main](https://huggingface.co/TheBloke/stablecode-completion-alpha-3b-4k-GPTQ/tree/main) | 4 | 128 | No | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | 1.82 GB | No | Most compatible option. Good inference speed in AutoGPTQ and GPTQ-for-LLaMa. Lower inference quality than other options. |
97
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/stablecode-completion-alpha-3b-4k-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 | 1.96 GB | No | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. Poor AutoGPTQ CUDA speed. |
98
+ | [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/stablecode-completion-alpha-3b-4k-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 | 1.86 GB | No | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. Poor AutoGPTQ CUDA speed. |
99
+ | [gptq-4bit-128g-actorder_True](https://huggingface.co/TheBloke/stablecode-completion-alpha-3b-4k-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 | Processing, coming soon | No | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. Poor AutoGPTQ CUDA speed. |
100
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/stablecode-completion-alpha-3b-4k-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 | Processing, coming soon | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. Poor AutoGPTQ CUDA speed. |
101
+ | [gptq-8bit-64g-actorder_True](https://huggingface.co/TheBloke/stablecode-completion-alpha-3b-4k-GPTQ/tree/gptq-8bit-64g-actorder_True) | 8 | 64 | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 4096 | Processing, coming soon | No | 8-bit, with group size 64g and Act Order for maximum inference quality. 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/stablecode-completion-alpha-3b-4k-GPTQ:gptq-4bit-32g-actorder_True`
106
+ - With Git, you can clone a branch with:
107
+ ```
108
+ git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/stablecode-completion-alpha-3b-4k-GPTQ
109
+ ```
110
+ - In Python Transformers code, the branch is the `revision` parameter; see below.
111
+
112
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
113
+
114
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
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
+ 1. Click the **Model tab**.
119
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/stablecode-completion-alpha-3b-4k-GPTQ`.
120
+ - To download from a specific branch, enter for example `TheBloke/stablecode-completion-alpha-3b-4k-GPTQ:gptq-4bit-32g-actorder_True`
121
+ - see Provided Files above for the list of branches for each option.
122
+ 3. Click **Download**.
123
+ 4. The model will start downloading. Once it's finished it will say "Done"
124
+ 5. In the top left, click the refresh icon next to **Model**.
125
+ 6. In the **Model** dropdown, choose the model you just downloaded: `stablecode-completion-alpha-3b-4k-GPTQ`
126
+ 7. The model will automatically load, and is now ready for use!
127
+ 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.
128
+ * Note that you do not need to set GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
129
+ 9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
130
+
131
+ ## How to use this GPTQ model from Python code
132
+
133
+ First make sure you have [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ) 0.3.1 or later installed:
134
+
135
+ ```
136
+ pip3 install auto-gptq
137
+ ```
138
+
139
+ If you have problems installing AutoGPTQ, please build from source instead:
140
+ ```
141
+ pip3 uninstall -y auto-gptq
142
+ git clone https://github.com/PanQiWei/AutoGPTQ
143
+ cd AutoGPTQ
144
+ pip3 install .
145
+ ```
146
+
147
+ Then try the following example code:
148
+
149
+ ```python
150
+ from transformers import AutoTokenizer, pipeline, logging
151
+ from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
152
+
153
+ model_name_or_path = "TheBloke/stablecode-completion-alpha-3b-4k-GPTQ"
154
+
155
+ use_triton = False
156
+
157
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
158
+
159
+ model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
160
+ use_safetensors=True,
161
+ trust_remote_code=False,
162
+ device="cuda:0",
163
+ use_triton=use_triton,
164
+ quantize_config=None)
165
+
166
+ """
167
+ # To download from a specific branch, use the revision parameter, as in this example:
168
+ # Note that `revision` requires AutoGPTQ 0.3.1 or later!
169
+
170
+ model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
171
+ revision="gptq-4bit-32g-actorder_True",
172
+ use_safetensors=True,
173
+ trust_remote_code=False,
174
+ device="cuda:0",
175
+ quantize_config=None)
176
+ """
177
+
178
+ prompt = "Tell me about AI"
179
+ prompt_template=f'''Just enter code to complete:
180
+ ```
181
+ import torch
182
+ import torch.nn as nn
183
+ ```
184
+
185
+ '''
186
+
187
+ print("\n\n*** Generate:")
188
+
189
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
190
+ output = model.generate(inputs=input_ids, temperature=0.7, max_new_tokens=512)
191
+ print(tokenizer.decode(output[0]))
192
+
193
+ # Inference can also be done using transformers' pipeline
194
+
195
+ # Prevent printing spurious transformers error when using pipeline with AutoGPTQ
196
+ logging.set_verbosity(logging.CRITICAL)
197
+
198
+ print("*** Pipeline:")
199
+ pipe = pipeline(
200
+ "text-generation",
201
+ model=model,
202
+ tokenizer=tokenizer,
203
+ max_new_tokens=512,
204
+ temperature=0.7,
205
+ top_p=0.95,
206
+ repetition_penalty=1.15
207
+ )
208
+
209
+ print(pipe(prompt_template)[0]['generated_text'])
210
+ ```
211
+
212
+ ## Compatibility
213
+
214
+ 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.
215
+
216
+ ExLlama works with Llama models in 4-bit. Please see the Provided Files table above for per-file compatibility.
217
+
218
+ <!-- footer start -->
219
+ ## Discord
220
+
221
+ For further support, and discussions on these models and AI in general, join us at:
222
+
223
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
224
+
225
+ ## Thanks, and how to contribute.
226
+
227
+ Thanks to the [chirper.ai](https://chirper.ai) team!
228
+
229
+ I've had a lot of people ask if they can contribute. I enjoy providing models and helping people, and would love to be able to spend even more time doing it, as well as expanding into new projects like fine tuning/training.
230
+
231
+ If you're able and willing to contribute it will be most gratefully received and will help me to keep providing more models, and to start work on new AI projects.
232
+
233
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
234
+
235
+ * Patreon: https://patreon.com/TheBlokeAI
236
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
237
+
238
+ **Special thanks to**: Luke from CarbonQuill, Aemon Algiz.
239
+
240
+ **Patreon special mentions**: Willem Michiel, Ajan Kanaga, Cory Kujawski, Alps Aficionado, Nikolai Manek, Jonathan Leane, Stanislav Ovsiannikov, Michael Levine, Luke Pendergrass, Sid, K, Gabriel Tamborski, Clay Pascal, Kalila, William Sang, Will Dee, Pieter, Nathan LeClaire, ya boyyy, David Flickinger, vamX, Derek Yates, Fen Risland, Jeffrey Morgan, webtim, Daniel P. Andersen, Chadd, Edmond Seymore, Pyrater, Olusegun Samson, Lone Striker, biorpg, alfie_i, Mano Prime, Chris Smitley, Dave, zynix, Trenton Dambrowitz, Johann-Peter Hartmann, Magnesian, Spencer Kim, John Detwiler, Iucharbius, Gabriel Puliatti, LangChain4j, Luke @flexchar, Vadim, Rishabh Srivastava, Preetika Verma, Ai Maven, Femi Adebogun, WelcomeToTheClub, Leonard Tan, Imad Khwaja, Steven Wood, Stefan Sabev, Sebastain Graf, usrbinkat, Dan Guido, Sam, Eugene Pentland, Mandus, transmissions 11, Slarti, Karl Bernard, Spiking Neurons AB, Artur Olbinski, Joseph William Delisle, ReadyPlayerEmma, Olakabola, Asp the Wyvern, Space Cruiser, Matthew Berman, Randy H, subjectnull, danny, John Villwock, Illia Dulskyi, Rainer Wilmers, theTransient, Pierre Kircher, Alexandros Triantafyllidis, Viktor Bowallius, terasurfer, Deep Realms, SuperWojo, senxiiz, Oscar Rangel, Alex, Stephen Murray, Talal Aujan, Raven Klaugh, Sean Connelly, Raymond Fosdick, Fred von Graf, chris gileta, Junyu Yang, Elle
241
+
242
+
243
+ Thank you to all my generous patrons and donaters!
244
+
245
+ <!-- footer end -->
246
+
247
+ # Original model card: StabilityAI's Stablecode Completion Alpha 3B 4K
248
+
249
+ # `StableCode-Completion-Alpha-3B-4K`
250
+
251
+ ## Model Description
252
+
253
+ `StableCode-Completion-Alpha-3B-4K` is a 3 billion parameter decoder-only code completion model pre-trained on diverse set of programming languages that topped the stackoverflow developer survey.
254
+
255
+ ## Usage
256
+ The model is intended to do single/multiline code completion from a long context window upto 4k tokens.
257
+ Get started generating code with `StableCode-Completion-Alpha-3B-4k` by using the following code snippet:
258
+
259
+ ```python
260
+ from transformers import AutoModelForCausalLM, AutoTokenizer
261
+ tokenizer = AutoTokenizer.from_pretrained("stabilityai/stablecode-completion-alpha-3b-4k")
262
+ model = AutoModelForCausalLM.from_pretrained(
263
+ "stabilityai/stablecode-completion-alpha-3b-4k",
264
+ trust_remote_code=True,
265
+ torch_dtype="auto",
266
+ )
267
+ model.cuda()
268
+ inputs = tokenizer("import torch\nimport torch.nn as nn", return_tensors="pt").to("cuda")
269
+ tokens = model.generate(
270
+ **inputs,
271
+ max_new_tokens=48,
272
+ temperature=0.2,
273
+ do_sample=True,
274
+ )
275
+ print(tokenizer.decode(tokens[0], skip_special_tokens=True))
276
+ ```
277
+
278
+ ## Model Details
279
+
280
+ * **Developed by**: [Stability AI](https://stability.ai/)
281
+ * **Model type**: `StableCode-Completion-Alpha-3B-4k` models are auto-regressive language models based on the transformer decoder architecture.
282
+ * **Language(s)**: Code
283
+ * **Library**: [GPT-NeoX](https://github.com/EleutherAI/gpt-neox)
284
+ * **License**: Model checkpoints are licensed under the [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) license.
285
+ * **Contact**: For questions and comments about the model, please email `lm@stability.ai`
286
+
287
+ ### Model Architecture
288
+
289
+ | Parameters | Hidden Size | Layers | Heads | Sequence Length |
290
+ |----------------|-------------|--------|-------|-----------------|
291
+ | 2,796,431,360 | 2560 | 32 | 32 | 4096 |
292
+
293
+
294
+ * **Decoder Layer**: Parallel Attention and MLP residuals with a single input LayerNorm ([Wang & Komatsuzaki, 2021](https://github.com/kingoflolz/mesh-transformer-jax/tree/master))
295
+ * **Position Embeddings**: Rotary Position Embeddings ([Su et al., 2021](https://arxiv.org/abs/2104.09864))
296
+ * **Bias**: LayerNorm bias terms only
297
+
298
+ ## Training
299
+
300
+ `StableCode-Completion-Alpha-3B-4k` is pre-trained at a context length of 4096 for 300 billion tokens on the `bigcode/starcoder-data`.
301
+
302
+ ### Training Dataset
303
+
304
+ The first pre-training stage relies on 300B tokens sourced from various top programming languages occuring in the stackoverflow developer survey present in the `starcoder-data` dataset.
305
+
306
+ ### Training Procedure
307
+
308
+ The model is pre-trained on the dataset mixes mentioned above in mixed-precision BF16), optimized with AdamW, and trained using the [StarCoder](https://huggingface.co/bigcode/starcoder) tokenizer with a vocabulary size of 49k.
309
+
310
+ * **Software**: We use a fork of gpt-neox ([EleutherAI, 2021](https://github.com/EleutherAI/gpt-neox)) and train under 2D parallelism (Data and Tensor Parallel) with ZeRO-1 ([Rajbhandari et al., 2019](https://arxiv.org/abs/1910.02054v3)) and rely on flash-attention as well as rotary embedding kernels from FlashAttention-2 ([Dao et al., 2023](https://tridao.me/publications/flash2/flash2.pdf))
311
+
312
+ ## Use and Limitations
313
+
314
+ ### Intended Use
315
+
316
+ StableCode-Completion-Alpha-3B-4K independently generates new code completions, but we recommend that you use StableCode-Completion-Alpha-3B-4K together with the tool developed by BigCode and HuggingFace [(huggingface/huggingface-vscode: Code completion VSCode extension for OSS models (github.com))](https://github.com/huggingface/huggingface-vscode), to identify and, if necessary, attribute any outputs that match training code.
317
+
318
+ ### Limitations and bias
319
+
320
+ This model is intended to be used responsibly. It is not intended to be used to create unlawful content of any kind, to further any unlawful activity, or to engage in activities with a high risk of physical or economic harm.
321
+
322
+ ## How to cite
323
+
324
+ ```bibtex
325
+ @misc{StableCodeCompleteAlpha4K,
326
+ url={[https://huggingface.co/stabilityai/stablecode-complete-alpha-3b-4k](https://huggingface.co/stabilityai/stablecode-complete-alpha-3b-4k)},
327
+ title={Stable Code Complete Alpha},
328
+ author={Adithyan, Reshinth and Phung, Duy and Cooper, Nathan and Pinnaparaju, Nikhil and Laforte, Christian}
329
+ }
330
+ ```