TheBloke commited on
Commit
59ae5b2
1 Parent(s): 467290f

Initial GPTQ model commit

Browse files
Files changed (1) hide show
  1. README.md +549 -0
README.md ADDED
@@ -0,0 +1,549 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - bigcode/commitpackft
4
+ - bigcode/oasst-octopack
5
+ inference: false
6
+ library_name: transformers
7
+ license: bigcode-openrail-m
8
+ metrics:
9
+ - code_eval
10
+ model-index:
11
+ - name: OctoCoder
12
+ results:
13
+ - dataset:
14
+ name: HumanEvalSynthesize Python
15
+ type: bigcode/humanevalpack
16
+ metrics:
17
+ - name: pass@1
18
+ type: pass@1
19
+ value: 46.2
20
+ verified: false
21
+ task:
22
+ type: text-generation
23
+ - dataset:
24
+ name: HumanEvalSynthesize JavaScript
25
+ type: bigcode/humanevalpack
26
+ metrics:
27
+ - name: pass@1
28
+ type: pass@1
29
+ value: 39.2
30
+ verified: false
31
+ task:
32
+ type: text-generation
33
+ - dataset:
34
+ name: HumanEvalSynthesize Java
35
+ type: bigcode/humanevalpack
36
+ metrics:
37
+ - name: pass@1
38
+ type: pass@1
39
+ value: 38.2
40
+ verified: false
41
+ task:
42
+ type: text-generation
43
+ - dataset:
44
+ name: HumanEvalSynthesize Go
45
+ type: bigcode/humanevalpack
46
+ metrics:
47
+ - name: pass@1
48
+ type: pass@1
49
+ value: 30.4
50
+ verified: false
51
+ task:
52
+ type: text-generation
53
+ - dataset:
54
+ name: HumanEvalSynthesize C++
55
+ type: bigcode/humanevalpack
56
+ metrics:
57
+ - name: pass@1
58
+ type: pass@1
59
+ value: 35.6
60
+ verified: false
61
+ task:
62
+ type: text-generation
63
+ - dataset:
64
+ name: HumanEvalSynthesize Rust
65
+ type: bigcode/humanevalpack
66
+ metrics:
67
+ - name: pass@1
68
+ type: pass@1
69
+ value: 23.4
70
+ verified: false
71
+ task:
72
+ type: text-generation
73
+ - dataset:
74
+ name: HumanEvalSynthesize Average
75
+ type: bigcode/humanevalpack
76
+ metrics:
77
+ - name: pass@1
78
+ type: pass@1
79
+ value: 35.5
80
+ verified: false
81
+ task:
82
+ type: text-generation
83
+ - dataset:
84
+ name: HumanEvalFix Python
85
+ type: bigcode/humanevalpack
86
+ metrics:
87
+ - name: pass@1
88
+ type: pass@1
89
+ value: 30.4
90
+ verified: false
91
+ task:
92
+ type: text-generation
93
+ - dataset:
94
+ name: HumanEvalFix JavaScript
95
+ type: bigcode/humanevalpack
96
+ metrics:
97
+ - name: pass@1
98
+ type: pass@1
99
+ value: 28.4
100
+ verified: false
101
+ task:
102
+ type: text-generation
103
+ - dataset:
104
+ name: HumanEvalFix Java
105
+ type: bigcode/humanevalpack
106
+ metrics:
107
+ - name: pass@1
108
+ type: pass@1
109
+ value: 30.6
110
+ verified: false
111
+ task:
112
+ type: text-generation
113
+ - dataset:
114
+ name: HumanEvalFix Go
115
+ type: bigcode/humanevalpack
116
+ metrics:
117
+ - name: pass@1
118
+ type: pass@1
119
+ value: 30.2
120
+ verified: false
121
+ task:
122
+ type: text-generation
123
+ - dataset:
124
+ name: HumanEvalFix C++
125
+ type: bigcode/humanevalpack
126
+ metrics:
127
+ - name: pass@1
128
+ type: pass@1
129
+ value: 26.1
130
+ verified: false
131
+ task:
132
+ type: text-generation
133
+ - dataset:
134
+ name: HumanEvalFix Rust
135
+ type: bigcode/humanevalpack
136
+ metrics:
137
+ - name: pass@1
138
+ type: pass@1
139
+ value: 16.5
140
+ verified: false
141
+ task:
142
+ type: text-generation
143
+ - dataset:
144
+ name: HumanEvalFix Average
145
+ type: bigcode/humanevalpack
146
+ metrics:
147
+ - name: pass@1
148
+ type: pass@1
149
+ value: 27.0
150
+ verified: false
151
+ task:
152
+ type: text-generation
153
+ - dataset:
154
+ name: HumanEvalExplain Python
155
+ type: bigcode/humanevalpack
156
+ metrics:
157
+ - name: pass@1
158
+ type: pass@1
159
+ value: 35.1
160
+ verified: false
161
+ task:
162
+ type: text-generation
163
+ - dataset:
164
+ name: HumanEvalExplain JavaScript
165
+ type: bigcode/humanevalpack
166
+ metrics:
167
+ - name: pass@1
168
+ type: pass@1
169
+ value: 24.5
170
+ verified: false
171
+ task:
172
+ type: text-generation
173
+ - dataset:
174
+ name: HumanEvalExplain Java
175
+ type: bigcode/humanevalpack
176
+ metrics:
177
+ - name: pass@1
178
+ type: pass@1
179
+ value: 27.3
180
+ verified: false
181
+ task:
182
+ type: text-generation
183
+ - dataset:
184
+ name: HumanEvalExplain Go
185
+ type: bigcode/humanevalpack
186
+ metrics:
187
+ - name: pass@1
188
+ type: pass@1
189
+ value: 21.1
190
+ verified: false
191
+ task:
192
+ type: text-generation
193
+ - dataset:
194
+ name: HumanEvalExplain C++
195
+ type: bigcode/humanevalpack
196
+ metrics:
197
+ - name: pass@1
198
+ type: pass@1
199
+ value: 24.1
200
+ verified: false
201
+ task:
202
+ type: text-generation
203
+ - dataset:
204
+ name: HumanEvalExplain Rust
205
+ type: bigcode/humanevalpack
206
+ metrics:
207
+ - name: pass@1
208
+ type: pass@1
209
+ value: 14.8
210
+ verified: false
211
+ task:
212
+ type: text-generation
213
+ - dataset:
214
+ name: HumanEvalExplain Average
215
+ type: bigcode/humanevalpack
216
+ metrics:
217
+ - name: pass@1
218
+ type: pass@1
219
+ value: 24.5
220
+ verified: false
221
+ task:
222
+ type: text-generation
223
+ model_creator: BigCode
224
+ model_link: https://huggingface.co/bigcode/octocoder
225
+ model_name: Octocoder
226
+ model_type: starcoder
227
+ pipeline_tag: text-generation
228
+ quantized_by: TheBloke
229
+ tags:
230
+ - code
231
+ widget:
232
+ - example_title: Bubble sort
233
+ group: Python
234
+ text: 'Question: Please write a function in Python that performs bubble sort.\n\nAnswer:'
235
+ ---
236
+
237
+ <!-- header start -->
238
+ <div style="width: 100%;">
239
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
240
+ </div>
241
+ <div style="display: flex; justify-content: space-between; width: 100%;">
242
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
243
+ <p><a href="https://discord.gg/theblokeai">Chat & support: my new Discord server</a></p>
244
+ </div>
245
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
246
+ <p><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
247
+ </div>
248
+ </div>
249
+ <!-- header end -->
250
+
251
+ # Octocoder - GPTQ
252
+ - Model creator: [BigCode](https://huggingface.co/bigcode)
253
+ - Original model: [Octocoder](https://huggingface.co/bigcode/octocoder)
254
+
255
+ ## Description
256
+
257
+ This repo contains GPTQ model files for [BigCode's Octocoder](https://huggingface.co/bigcode/octocoder).
258
+
259
+ 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.
260
+
261
+ ## Repositories available
262
+
263
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Octocoder-GPTQ)
264
+ * [2, 3, 4, 5, 6 and 8-bit GGML models for CPU+GPU inference](https://huggingface.co/TheBloke/Octocoder-GGML)
265
+ * [BigCode's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/bigcode/octocoder)
266
+
267
+ ## Prompt template: QA
268
+
269
+ ```
270
+ Question: {prompt}
271
+ Answer:
272
+ ```
273
+
274
+ ## Provided files and GPTQ parameters
275
+
276
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
277
+
278
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
279
+
280
+ All GPTQ files are made with AutoGPTQ.
281
+
282
+ <details>
283
+ <summary>Explanation of GPTQ parameters</summary>
284
+
285
+ - Bits: The bit size of the quantised model.
286
+ - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
287
+ - 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.
288
+ - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
289
+ - 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).
290
+ - 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.
291
+ - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama models in 4-bit.
292
+
293
+ </details>
294
+
295
+ | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
296
+ | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
297
+ | [main](https://huggingface.co/TheBloke/Octocoder-GPTQ/tree/main) | 4 | 128 | No | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 8192 | 9.20 GB | No | Most compatible option. Good inference speed in AutoGPTQ and GPTQ-for-LLaMa. Lower inference quality than other options. |
298
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/Octocoder-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) | 8192 | 10.09 GB | No | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. Poor AutoGPTQ CUDA speed. |
299
+ | [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/Octocoder-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) | 8192 | 9.49 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. |
300
+ | [gptq-4bit-128g-actorder_True](https://huggingface.co/TheBloke/Octocoder-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) | 8192 | 9.20 GB | 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. |
301
+ | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/Octocoder-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) | 8192 | 16.49 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements and to improve AutoGPTQ speed. |
302
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/Octocoder-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) | 8192 | 16.84 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. Poor AutoGPTQ CUDA speed. |
303
+
304
+ ## How to download from branches
305
+
306
+ - In text-generation-webui, you can add `:branch` to the end of the download name, eg `TheBloke/Octocoder-GPTQ:gptq-4bit-32g-actorder_True`
307
+ - With Git, you can clone a branch with:
308
+ ```
309
+ git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/Octocoder-GPTQ
310
+ ```
311
+ - In Python Transformers code, the branch is the `revision` parameter; see below.
312
+
313
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
314
+
315
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
316
+
317
+ It is strongly recommended to use the text-generation-webui one-click-installers unless you know how to make a manual install.
318
+
319
+ 1. Click the **Model tab**.
320
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/Octocoder-GPTQ`.
321
+ - To download from a specific branch, enter for example `TheBloke/Octocoder-GPTQ:gptq-4bit-32g-actorder_True`
322
+ - see Provided Files above for the list of branches for each option.
323
+ 3. Click **Download**.
324
+ 4. The model will start downloading. Once it's finished it will say "Done"
325
+ 5. In the top left, click the refresh icon next to **Model**.
326
+ 6. In the **Model** dropdown, choose the model you just downloaded: `Octocoder-GPTQ`
327
+ 7. The model will automatically load, and is now ready for use!
328
+ 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.
329
+ * Note that you do not need to set GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
330
+ 9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
331
+
332
+ ## How to use this GPTQ model from Python code
333
+
334
+ First make sure you have [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ) 0.3.1 or later installed:
335
+
336
+ ```
337
+ pip3 install auto-gptq
338
+ ```
339
+
340
+ If you have problems installing AutoGPTQ, please build from source instead:
341
+ ```
342
+ pip3 uninstall -y auto-gptq
343
+ git clone https://github.com/PanQiWei/AutoGPTQ
344
+ cd AutoGPTQ
345
+ pip3 install .
346
+ ```
347
+
348
+ Then try the following example code:
349
+
350
+ ```python
351
+ from transformers import AutoTokenizer, pipeline, logging
352
+ from auto_gptq import AutoGPTQForCausalLM, BaseQuantizeConfig
353
+
354
+ model_name_or_path = "TheBloke/Octocoder-GPTQ"
355
+
356
+ use_triton = False
357
+
358
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
359
+
360
+ model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
361
+ use_safetensors=True,
362
+ trust_remote_code=False,
363
+ device="cuda:0",
364
+ use_triton=use_triton,
365
+ quantize_config=None)
366
+
367
+ """
368
+ # To download from a specific branch, use the revision parameter, as in this example:
369
+ # Note that `revision` requires AutoGPTQ 0.3.1 or later!
370
+
371
+ model = AutoGPTQForCausalLM.from_quantized(model_name_or_path,
372
+ revision="gptq-4bit-32g-actorder_True",
373
+ use_safetensors=True,
374
+ trust_remote_code=False,
375
+ device="cuda:0",
376
+ quantize_config=None)
377
+ """
378
+
379
+ prompt = "Tell me about AI"
380
+ prompt_template=f'''Question: {prompt}
381
+ Answer:
382
+ '''
383
+
384
+ print("\n\n*** Generate:")
385
+
386
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
387
+ output = model.generate(inputs=input_ids, temperature=0.7, max_new_tokens=512)
388
+ print(tokenizer.decode(output[0]))
389
+
390
+ # Inference can also be done using transformers' pipeline
391
+
392
+ # Prevent printing spurious transformers error when using pipeline with AutoGPTQ
393
+ logging.set_verbosity(logging.CRITICAL)
394
+
395
+ print("*** Pipeline:")
396
+ pipe = pipeline(
397
+ "text-generation",
398
+ model=model,
399
+ tokenizer=tokenizer,
400
+ max_new_tokens=512,
401
+ temperature=0.7,
402
+ top_p=0.95,
403
+ repetition_penalty=1.15
404
+ )
405
+
406
+ print(pipe(prompt_template)[0]['generated_text'])
407
+ ```
408
+
409
+ ## Compatibility
410
+
411
+ 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.
412
+
413
+ ExLlama works with Llama models in 4-bit. Please see the Provided Files table above for per-file compatibility.
414
+
415
+ <!-- footer start -->
416
+ ## Discord
417
+
418
+ For further support, and discussions on these models and AI in general, join us at:
419
+
420
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
421
+
422
+ ## Thanks, and how to contribute.
423
+
424
+ Thanks to the [chirper.ai](https://chirper.ai) team!
425
+
426
+ 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.
427
+
428
+ 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.
429
+
430
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
431
+
432
+ * Patreon: https://patreon.com/TheBlokeAI
433
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
434
+
435
+ **Special thanks to**: Aemon Algiz.
436
+
437
+ **Patreon special mentions**: Ajan Kanaga, David Ziegler, Raymond Fosdick, SuperWojo, Sam, webtim, Steven Wood, knownsqashed, Tony Hughes, Junyu Yang, J, Olakabola, Dan Guido, Stephen Murray, John Villwock, vamX, William Sang, Sean Connelly, LangChain4j, Olusegun Samson, Fen Risland, Derek Yates, Karl Bernard, transmissions 11, Trenton Dambrowitz, Pieter, Preetika Verma, Swaroop Kallakuri, Andrey, Slarti, Jonathan Leane, Michael Levine, Kalila, Joseph William Delisle, Rishabh Srivastava, Deo Leter, Luke Pendergrass, Spencer Kim, Geoffrey Montalvo, Thomas Belote, Jeffrey Morgan, Mandus, ya boyyy, Matthew Berman, Magnesian, Ai Maven, senxiiz, Alps Aficionado, Luke @flexchar, Raven Klaugh, Imad Khwaja, Gabriel Puliatti, Johann-Peter Hartmann, usrbinkat, Spiking Neurons AB, Artur Olbinski, chris gileta, danny, Willem Michiel, WelcomeToTheClub, Deep Realms, alfie_i, Dave, Leonard Tan, NimbleBox.ai, Randy H, Daniel P. Andersen, Pyrater, Will Dee, Elle, Space Cruiser, Gabriel Tamborski, Asp the Wyvern, Illia Dulskyi, Nikolai Manek, Sid, Brandon Frisco, Nathan LeClaire, Edmond Seymore, Enrico Ros, Pedro Madruga, Eugene Pentland, John Detwiler, Mano Prime, Stanislav Ovsiannikov, Alex, Vitor Caleffi, K, biorpg, Michael Davis, Lone Striker, Pierre Kircher, theTransient, Fred von Graf, Sebastain Graf, Vadim, Iucharbius, Clay Pascal, Chadd, Mesiah Bishop, terasurfer, Rainer Wilmers, Alexandros Triantafyllidis, Stefan Sabev, Talal Aujan, Cory Kujawski, Viktor Bowallius, subjectnull, ReadyPlayerEmma, zynix
438
+
439
+
440
+ Thank you to all my generous patrons and donaters!
441
+
442
+ <!-- footer end -->
443
+
444
+ # Original model card: BigCode's Octocoder
445
+
446
+
447
+ ![Octopack](https://github.com/bigcode-project/octopack/blob/31f3320f098703c7910e43492c39366eeea68d83/banner.png?raw=true)
448
+
449
+ # Table of Contents
450
+
451
+ 1. [Model Summary](#model-summary)
452
+ 2. [Use](#use)
453
+ 3. [Training](#training)
454
+ 4. [Citation](#citation)
455
+
456
+ # Model Summary
457
+
458
+ > OctoCoder is an instruction tuned model with 15.5B parameters created by finetuning StarCoder on CommitPackFT & OASST as described in the OctoPack paper.
459
+
460
+ - **Repository:** [bigcode-project/octopack](https://github.com/bigcode-project/octopack)
461
+ - **Paper:** [OctoPack: Instruction Tuning Code Large Language Models](https://arxiv.org/abs/2308.07124)
462
+ - **Languages:** 80+ Programming languages
463
+ - **OctoPack🐙🎒:**
464
+ <table>
465
+ <tr>
466
+ <th>Data</t>
467
+ <th><a href=https://huggingface.co/datasets/bigcode/commitpack>CommitPack</a></th>
468
+ <td>4TB of GitHub commits across 350 programming languages</td>
469
+ </tr>
470
+ <tr>
471
+ <th></t>
472
+ <th><a href=https://huggingface.co/datasets/bigcode/commitpackft>CommitPackFT</a></th>
473
+ <td>Filtered version of CommitPack for high-quality commit messages that resemble instructions</td>
474
+ </tr>
475
+ <tr>
476
+ <th>Model</t>
477
+ <th><a href=https://huggingface.co/bigcode/octocoder>OctoCoder</a></th>
478
+ <td>StarCoder (16B parameters) instruction tuned on CommitPackFT + OASST</td>
479
+ </tr>
480
+ <tr>
481
+ <th></t>
482
+ <th><a href=https://huggingface.co/bigcode/octogeex>OctoGeeX</a></th>
483
+ <td>CodeGeeX2 (6B parameters) instruction tuned on CommitPackFT + OASST</td>
484
+ </tr>
485
+ <tr>
486
+ <th>Evaluation&nbsp;&nbsp;</t>
487
+ <th><a href=https://huggingface.co/datasets/bigcode/humanevalpack>HumanEvalPack</a></th>
488
+ <td>Extension of OpenAI's HumanEval to cover 3 scenarios across 6 languages</td>
489
+ </tr>
490
+ </table>
491
+
492
+
493
+ # Use
494
+
495
+ ## Intended use
496
+
497
+ The model follows instructions provided in the input. You should always preface your input with "Question: " and finish it with "Answer:", for example: "Question: Please write a function in Python that performs bubble sort.\n\nAnswer:"
498
+
499
+ **Feel free to share your generations in the Community tab!**
500
+
501
+ ## Generation
502
+ ```python
503
+ # pip install -q transformers
504
+ from transformers import AutoModelForCausalLM, AutoTokenizer
505
+
506
+ checkpoint = "bigcode/octocoder"
507
+ device = "cuda" # for GPU usage or "cpu" for CPU usage
508
+
509
+ tokenizer = AutoTokenizer.from_pretrained(checkpoint)
510
+ model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
511
+
512
+ inputs = tokenizer.encode("Question: Please write a function in Python that performs bubble sort.\n\nAnswer:", return_tensors="pt").to(device)
513
+ outputs = model.generate(inputs)
514
+ print(tokenizer.decode(outputs[0]))
515
+ ```
516
+
517
+ # Training
518
+
519
+ ## Model
520
+
521
+ - **Architecture:** GPT-2 model with multi-query attention and Fill-in-the-Middle objective
522
+ - **Steps:** 250k pretraining & 30 instruction tuning
523
+ - **Pretraining tokens:** 1 trillion pretraining & 2M instruction tuning
524
+ - **Precision:** bfloat16
525
+
526
+ ## Hardware
527
+
528
+ - **Pretraining:**
529
+ - **GPUs:** 512 Tesla A100
530
+ - **Training time:** 24 days
531
+ - **Instruction tuning:**
532
+ - **GPUs:** 8 Tesla A100
533
+ - **Training time:** 4 hours
534
+
535
+ ## Software
536
+
537
+ - **Orchestration:** [Megatron-LM/Transformers](https://github.com/bigcode-project/octopack#training)
538
+ - **Neural networks:** [PyTorch](https://github.com/pytorch/pytorch)
539
+
540
+ # Citation
541
+
542
+ ```bibtex
543
+ @article{muennighoff2023octopack,
544
+ title={OctoPack: Instruction Tuning Code Large Language Models},
545
+ author={Niklas Muennighoff and Qian Liu and Armel Zebaze and Qinkai Zheng and Binyuan Hui and Terry Yue Zhuo and Swayam Singh and Xiangru Tang and Leandro von Werra and Shayne Longpre},
546
+ journal={arXiv preprint arXiv:2308.07124},
547
+ year={2023}
548
+ }
549
+ ```