TheBloke commited on
Commit
9250f2e
1 Parent(s): a219092

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +582 -0
README.md ADDED
@@ -0,0 +1,582 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: uukuguy/speechless-codellama-34b-v2.0
3
+ datasets:
4
+ - jondurbin/airoboros-2.2
5
+ - Open-Orca/OpenOrca
6
+ - garage-bAInd/Open-Platypus
7
+ - WizardLM/WizardLM_evol_instruct_V2_196k
8
+ inference: false
9
+ language:
10
+ - en
11
+ library_name: transformers
12
+ license: llama2
13
+ model-index:
14
+ - name: SpeechlessCoder
15
+ results:
16
+ - dataset:
17
+ name: HumanEval
18
+ type: openai_humaneval
19
+ metrics:
20
+ - name: pass@1
21
+ type: pass@1
22
+ value: 75.61
23
+ verified: false
24
+ task:
25
+ type: text-generation
26
+ model_creator: Jiangwen Su
27
+ model_name: Speechless Codellama 34B v2.0
28
+ model_type: llama
29
+ pipeline_tag: text-generation
30
+ prompt_template: '{prompt}
31
+
32
+ '
33
+ quantized_by: TheBloke
34
+ tags:
35
+ - llama-2
36
+ - code
37
+ ---
38
+
39
+ <!-- header start -->
40
+ <!-- 200823 -->
41
+ <div style="width: auto; margin-left: auto; margin-right: auto">
42
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
43
+ </div>
44
+ <div style="display: flex; justify-content: space-between; width: 100%;">
45
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
46
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
47
+ </div>
48
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
49
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
50
+ </div>
51
+ </div>
52
+ <div style="text-align:center; margin-top: 0em; margin-bottom: 0em"><p style="margin-top: 0.25em; margin-bottom: 0em;">TheBloke's LLM work is generously supported by a grant from <a href="https://a16z.com">andreessen horowitz (a16z)</a></p></div>
53
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
54
+ <!-- header end -->
55
+
56
+ # Speechless Codellama 34B v2.0 - GPTQ
57
+ - Model creator: [Jiangwen Su](https://huggingface.co/uukuguy)
58
+ - Original model: [Speechless Codellama 34B v2.0](https://huggingface.co/uukuguy/speechless-codellama-34b-v2.0)
59
+
60
+ <!-- description start -->
61
+ ## Description
62
+
63
+ This repo contains GPTQ model files for [Jiangwen Su's Speechless Codellama 34B v2.0](https://huggingface.co/uukuguy/speechless-codellama-34b-v2.0).
64
+
65
+ 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.
66
+
67
+ <!-- description end -->
68
+ <!-- repositories-available start -->
69
+ ## Repositories available
70
+
71
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/speechless-codellama-34b-v2.0-AWQ)
72
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/speechless-codellama-34b-v2.0-GPTQ)
73
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/speechless-codellama-34b-v2.0-GGUF)
74
+ * [Jiangwen Su's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/uukuguy/speechless-codellama-34b-v2.0)
75
+ <!-- repositories-available end -->
76
+
77
+ <!-- prompt-template start -->
78
+ ## Prompt template: None
79
+
80
+ ```
81
+ {prompt}
82
+
83
+ ```
84
+
85
+ <!-- prompt-template end -->
86
+
87
+
88
+ <!-- README_GPTQ.md-provided-files start -->
89
+ ## Provided files, and GPTQ parameters
90
+
91
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
92
+
93
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
94
+
95
+ Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
96
+
97
+ <details>
98
+ <summary>Explanation of GPTQ parameters</summary>
99
+
100
+ - Bits: The bit size of the quantised model.
101
+ - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
102
+ - 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.
103
+ - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
104
+ - GPTQ dataset: The calibration dataset used during quantisation. Using a dataset more appropriate to the model's training can improve quantisation accuracy. Note that the GPTQ calibration 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).
105
+ - 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.
106
+ - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama models in 4-bit.
107
+
108
+ </details>
109
+
110
+ | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
111
+ | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
112
+ | [main](https://huggingface.co/TheBloke/speechless-codellama-34b-v2.0-GPTQ/tree/main) | 4 | None | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 16384 | 17.69 GB | Yes | 4-bit, with Act Order. No group size, to lower VRAM requirements. |
113
+ | [gptq-4bit-128g-actorder_True](https://huggingface.co/TheBloke/speechless-codellama-34b-v2.0-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) | 16384 | 18.33 GB | Yes | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
114
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/speechless-codellama-34b-v2.0-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) | 16384 | 20.28 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
115
+ | [gptq-3bit-128g-actorder_True](https://huggingface.co/TheBloke/speechless-codellama-34b-v2.0-GPTQ/tree/gptq-3bit-128g-actorder_True) | 3 | 128 | Yes | 0.1 | [Evol Instruct Code](https://huggingface.co/datasets/nickrosh/Evol-Instruct-Code-80k-v1) | 16384 | 14.14 GB | No | 3-bit, with group size 128g and act-order. Higher quality than 128g-False. |
116
+ | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/speechless-codellama-34b-v2.0-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) | 16384 | 34.30 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
117
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/speechless-codellama-34b-v2.0-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) | 16384 | 35.07 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
118
+
119
+ <!-- README_GPTQ.md-provided-files end -->
120
+
121
+ <!-- README_GPTQ.md-download-from-branches start -->
122
+ ## How to download, including from branches
123
+
124
+ ### In text-generation-webui
125
+
126
+ To download from the `main` branch, enter `TheBloke/speechless-codellama-34b-v2.0-GPTQ` in the "Download model" box.
127
+
128
+ To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/speechless-codellama-34b-v2.0-GPTQ:gptq-4bit-128g-actorder_True`
129
+
130
+ ### From the command line
131
+
132
+ I recommend using the `huggingface-hub` Python library:
133
+
134
+ ```shell
135
+ pip3 install huggingface-hub
136
+ ```
137
+
138
+ To download the `main` branch to a folder called `speechless-codellama-34b-v2.0-GPTQ`:
139
+
140
+ ```shell
141
+ mkdir speechless-codellama-34b-v2.0-GPTQ
142
+ huggingface-cli download TheBloke/speechless-codellama-34b-v2.0-GPTQ --local-dir speechless-codellama-34b-v2.0-GPTQ --local-dir-use-symlinks False
143
+ ```
144
+
145
+ To download from a different branch, add the `--revision` parameter:
146
+
147
+ ```shell
148
+ mkdir speechless-codellama-34b-v2.0-GPTQ
149
+ huggingface-cli download TheBloke/speechless-codellama-34b-v2.0-GPTQ --revision gptq-4bit-128g-actorder_True --local-dir speechless-codellama-34b-v2.0-GPTQ --local-dir-use-symlinks False
150
+ ```
151
+
152
+ <details>
153
+ <summary>More advanced huggingface-cli download usage</summary>
154
+
155
+ If you remove the `--local-dir-use-symlinks False` parameter, the files will instead be stored in the central Huggingface cache directory (default location on Linux is: `~/.cache/huggingface`), and symlinks will be added to the specified `--local-dir`, pointing to their real location in the cache. This allows for interrupted downloads to be resumed, and allows you to quickly clone the repo to multiple places on disk without triggering a download again. The downside, and the reason why I don't list that as the default option, is that the files are then hidden away in a cache folder and it's harder to know where your disk space is being used, and to clear it up if/when you want to remove a download model.
156
+
157
+ The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
158
+
159
+ For more documentation on downloading with `huggingface-cli`, please see: [HF -> Hub Python Library -> Download files -> Download from the CLI](https://huggingface.co/docs/huggingface_hub/guides/download#download-from-the-cli).
160
+
161
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
162
+
163
+ ```shell
164
+ pip3 install hf_transfer
165
+ ```
166
+
167
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
168
+
169
+ ```shell
170
+ mkdir speechless-codellama-34b-v2.0-GPTQ
171
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/speechless-codellama-34b-v2.0-GPTQ --local-dir speechless-codellama-34b-v2.0-GPTQ --local-dir-use-symlinks False
172
+ ```
173
+
174
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
175
+ </details>
176
+
177
+ ### With `git` (**not** recommended)
178
+
179
+ To clone a specific branch with `git`, use a command like this:
180
+
181
+ ```shell
182
+ git clone --single-branch --branch gptq-4bit-128g-actorder_True https://huggingface.co/TheBloke/speechless-codellama-34b-v2.0-GPTQ
183
+ ```
184
+
185
+ Note that using Git with HF repos is strongly discouraged. It will be much slower than using `huggingface-hub`, and will use twice as much disk space as it has to store the model files twice (it stores every byte both in the intended target folder, and again in the `.git` folder as a blob.)
186
+
187
+ <!-- README_GPTQ.md-download-from-branches end -->
188
+ <!-- README_GPTQ.md-text-generation-webui start -->
189
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
190
+
191
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
192
+
193
+ 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.
194
+
195
+ 1. Click the **Model tab**.
196
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/speechless-codellama-34b-v2.0-GPTQ`.
197
+ - To download from a specific branch, enter for example `TheBloke/speechless-codellama-34b-v2.0-GPTQ:gptq-4bit-128g-actorder_True`
198
+ - see Provided Files above for the list of branches for each option.
199
+ 3. Click **Download**.
200
+ 4. The model will start downloading. Once it's finished it will say "Done".
201
+ 5. In the top left, click the refresh icon next to **Model**.
202
+ 6. In the **Model** dropdown, choose the model you just downloaded: `speechless-codellama-34b-v2.0-GPTQ`
203
+ 7. The model will automatically load, and is now ready for use!
204
+ 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.
205
+ * 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`.
206
+ 9. Once you're ready, click the **Text Generation tab** and enter a prompt to get started!
207
+
208
+ <!-- README_GPTQ.md-text-generation-webui end -->
209
+
210
+ <!-- README_GPTQ.md-use-from-tgi start -->
211
+ ## Serving this model from Text Generation Inference (TGI)
212
+
213
+ It's recommended to use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
214
+
215
+ Example Docker parameters:
216
+
217
+ ```shell
218
+ --model-id TheBloke/speechless-codellama-34b-v2.0-GPTQ --port 3000 --quantize awq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
219
+ ```
220
+
221
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
222
+
223
+ ```shell
224
+ pip3 install huggingface-hub
225
+ ```
226
+
227
+ ```python
228
+ from huggingface_hub import InferenceClient
229
+
230
+ endpoint_url = "https://your-endpoint-url-here"
231
+
232
+ prompt = "Tell me about AI"
233
+ prompt_template=f'''{prompt}
234
+ '''
235
+
236
+ client = InferenceClient(endpoint_url)
237
+ response = client.text_generation(prompt,
238
+ max_new_tokens=128,
239
+ do_sample=True,
240
+ temperature=0.7,
241
+ top_p=0.95,
242
+ top_k=40,
243
+ repetition_penalty=1.1)
244
+
245
+ print(f"Model output: {response}")
246
+ ```
247
+ <!-- README_GPTQ.md-use-from-tgi end -->
248
+ <!-- README_GPTQ.md-use-from-python start -->
249
+ ## How to use this GPTQ model from Python code
250
+
251
+ ### Install the necessary packages
252
+
253
+ Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
254
+
255
+ ```shell
256
+ pip3 install transformers optimum
257
+ pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
258
+ ```
259
+
260
+ If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
261
+
262
+ ```shell
263
+ pip3 uninstall -y auto-gptq
264
+ git clone https://github.com/PanQiWei/AutoGPTQ
265
+ cd AutoGPTQ
266
+ git checkout v0.4.2
267
+ pip3 install .
268
+ ```
269
+
270
+ ### You can then use the following code
271
+
272
+ ```python
273
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
274
+
275
+ model_name_or_path = "TheBloke/speechless-codellama-34b-v2.0-GPTQ"
276
+ # To use a different branch, change revision
277
+ # For example: revision="gptq-4bit-128g-actorder_True"
278
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
279
+ device_map="auto",
280
+ trust_remote_code=False,
281
+ revision="main")
282
+
283
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
284
+
285
+ prompt = "Tell me about AI"
286
+ prompt_template=f'''{prompt}
287
+ '''
288
+
289
+ print("\n\n*** Generate:")
290
+
291
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
292
+ output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
293
+ print(tokenizer.decode(output[0]))
294
+
295
+ # Inference can also be done using transformers' pipeline
296
+
297
+ print("*** Pipeline:")
298
+ pipe = pipeline(
299
+ "text-generation",
300
+ model=model,
301
+ tokenizer=tokenizer,
302
+ max_new_tokens=512,
303
+ do_sample=True,
304
+ temperature=0.7,
305
+ top_p=0.95,
306
+ top_k=40,
307
+ repetition_penalty=1.1
308
+ )
309
+
310
+ print(pipe(prompt_template)[0]['generated_text'])
311
+ ```
312
+ <!-- README_GPTQ.md-use-from-python end -->
313
+
314
+ <!-- README_GPTQ.md-compatibility start -->
315
+ ## Compatibility
316
+
317
+ 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).
318
+
319
+ [ExLlama](https://github.com/turboderp/exllama) is compatible with Llama and Mistral models in 4-bit. Please see the Provided Files table above for per-file compatibility.
320
+
321
+ [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) is compatible with all GPTQ models.
322
+ <!-- README_GPTQ.md-compatibility end -->
323
+
324
+ <!-- footer start -->
325
+ <!-- 200823 -->
326
+ ## Discord
327
+
328
+ For further support, and discussions on these models and AI in general, join us at:
329
+
330
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
331
+
332
+ ## Thanks, and how to contribute
333
+
334
+ Thanks to the [chirper.ai](https://chirper.ai) team!
335
+
336
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
337
+
338
+ 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.
339
+
340
+ 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.
341
+
342
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
343
+
344
+ * Patreon: https://patreon.com/TheBlokeAI
345
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
346
+
347
+ **Special thanks to**: Aemon Algiz.
348
+
349
+ **Patreon special mentions**: Pierre Kircher, Stanislav Ovsiannikov, Michael Levine, Eugene Pentland, Andrey, 준교 김, Randy H, Fred von Graf, Artur Olbinski, Caitlyn Gatomon, terasurfer, Jeff Scroggin, James Bentley, Vadim, Gabriel Puliatti, Harry Royden McLaughlin, Sean Connelly, Dan Guido, Edmond Seymore, Alicia Loh, subjectnull, AzureBlack, Manuel Alberto Morcote, Thomas Belote, Lone Striker, Chris Smitley, Vitor Caleffi, Johann-Peter Hartmann, Clay Pascal, biorpg, Brandon Frisco, sidney chen, transmissions 11, Pedro Madruga, jinyuan sun, Ajan Kanaga, Emad Mostaque, Trenton Dambrowitz, Jonathan Leane, Iucharbius, usrbinkat, vamX, George Stoitzev, Luke Pendergrass, theTransient, Olakabola, Swaroop Kallakuri, Cap'n Zoog, Brandon Phillips, Michael Dempsey, Nikolai Manek, danny, Matthew Berman, Gabriel Tamborski, alfie_i, Raymond Fosdick, Tom X Nguyen, Raven Klaugh, LangChain4j, Magnesian, Illia Dulskyi, David Ziegler, Mano Prime, Luis Javier Navarrete Lozano, Erik Bjäreholt, 阿明, Nathan Dryer, Alex, Rainer Wilmers, zynix, TL, Joseph William Delisle, John Villwock, Nathan LeClaire, Willem Michiel, Joguhyik, GodLy, OG, Alps Aficionado, Jeffrey Morgan, ReadyPlayerEmma, Tiffany J. Kim, Sebastain Graf, Spencer Kim, Michael Davis, webtim, Talal Aujan, knownsqashed, John Detwiler, Imad Khwaja, Deo Leter, Jerry Meng, Elijah Stavena, Rooh Singh, Pieter, SuperWojo, Alexandros Triantafyllidis, Stephen Murray, Ai Maven, ya boyyy, Enrico Ros, Ken Nordquist, Deep Realms, Nicholas, Spiking Neurons AB, Elle, Will Dee, Jack West, RoA, Luke @flexchar, Viktor Bowallius, Derek Yates, Subspace Studios, jjj, Toran Billups, Asp the Wyvern, Fen Risland, Ilya, NimbleBox.ai, Chadd, Nitin Borwankar, Emre, Mandus, Leonard Tan, Kalila, K, Trailburnt, S_X, Cory Kujawski
350
+
351
+
352
+ Thank you to all my generous patrons and donaters!
353
+
354
+ And thank you again to a16z for their generous grant.
355
+
356
+ <!-- footer end -->
357
+
358
+ # Original model card: Jiangwen Su's Speechless Codellama 34B v2.0
359
+
360
+
361
+ <p><h1> speechless-codellama-34b-v2.0 </h1></p>
362
+
363
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/speechless-codellama-34b-v2.0-AWQ)
364
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/speechless-codellama-34b-v2.0-GPTQ)
365
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/speechless-codellama-34b-v2.0-GGUF)
366
+
367
+
368
+ Use the following datasets to fine-tune codellama/CodeLlama-34B in order to improve the model's inference and planning capabilities.
369
+
370
+ Total 153,013 samples.
371
+ - jondurbin/airoboros-2.2: Filter categories related to coding, reasoning and planning. 23,462 samples.
372
+ - Open-Orca/OpenOrca: Filter the 'cot' category in 1M GPT4 dataset. 74,440 samples.
373
+ - garage-bAInd/Open-Platypus: 100%, 24,926 samples.
374
+ - WizardLM/WizardLM_evol_instruct_V2_196k: Coding coversation part. 30,185 samples
375
+
376
+
377
+
378
+
379
+
380
+ ## HumanEval
381
+
382
+ | human-eval | pass@1 |
383
+ | --- | --- |
384
+ | humaneval-python | 75.61 |
385
+
386
+ [Big Code Models Leaderboard](https://huggingface.co/spaces/bigcode/bigcode-models-leaderboard)
387
+
388
+ | Models | pass@1 |
389
+ |------ | ------ |
390
+ | Phind-CodeLlama-34B-v2| 71.95|
391
+ | WizardCoder-Python-34B-V1.0| 70.73|
392
+ | Phind-CodeLlama-34B-Python-v1| 70.22|
393
+ | Phind-CodeLlama-34B-v1| 65.85|
394
+ | WizardCoder-Python-13B-V1.0| 62.19|
395
+ | WizardCoder-15B-V1.0| 58.12|
396
+ | CodeLlama-34B-Python| 53.29|
397
+ | CodeLlama-34B-Instruct| 50.79|
398
+ | CodeLlama-13B-Instruct| 50.6|
399
+ | CodeLlama-34B| 45.11|
400
+ | CodeLlama-13B-Python| 42.89|
401
+ | CodeLlama-13B| 35.07|
402
+
403
+ ## NL2SQL
404
+
405
+ SQL-EVAL: 125/175 (71.43%)
406
+
407
+ Average rate of exact match: 67.43%
408
+
409
+ Average correct rate: 71.43%
410
+
411
+ - GPT4: 130/175 (74.29%)
412
+ - GPT3-Turbo-0613: 105/174 (60.00%)
413
+
414
+
415
+ ## lm-evaluation-harness
416
+
417
+ [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)
418
+ | Metric | Value |
419
+ | --- | --- |
420
+ | ARC | 54.35 |
421
+ | HellaSwag | 75.65 |
422
+ | MMLU | 54.67 |
423
+ | TruthfulQA | 45.21 |
424
+ | Average | 57.47 |
425
+
426
+
427
+ H800-80G x 2
428
+
429
+ transformers=4.33.0
430
+
431
+ flash-attn=2.1.0
432
+
433
+ bitsandbytes=0.41.1
434
+
435
+ peft=0.5.0
436
+
437
+ ## Training Arguments
438
+ | | |
439
+ |------ | ------ |
440
+ | lr | 2e-4 |
441
+ | lr_scheduler_type | cosine |
442
+ | weight_decay | 0.0 |
443
+ | optim | paged_adamw_8bit |
444
+ | flash_attention | True |
445
+ | rerope | False |
446
+ | max_new_tokens | 8192 |
447
+ | num_train_epochs | 3 |
448
+ | bits | 4 |
449
+ | lora_r | 64 |
450
+ | lora_alpha | 16 |
451
+ | lora_dropout | 0.05 |
452
+ | double_quant | True |
453
+ | quant_type | nf4 |
454
+ | dataset_format | airoboros |
455
+ | mini_batch_size | 4 |
456
+ | grandient_accumulation_steps | 16 |
457
+ | bf16 | True |
458
+
459
+
460
+ | | |
461
+ |------ | ------ |
462
+ | epoch | 3.0 |
463
+ | etrain_loss | 0.4261 |
464
+ | etrain_runtime | 1 day, 14:42:57.87 |
465
+ | etrain_samples_per_second | 3.227 |
466
+ | etrain_steps_per_second | 0.025 |
467
+ | eeval_loss | 0.4537 |
468
+ | eeval_runtime | 0:00:36.19 |
469
+ | eeval_samples_per_second | 5.525 |
470
+ | eeval_steps_per_second | 2.763 |
471
+
472
+
473
+ # **Code Llama**
474
+
475
+ Code Llama is a collection of pretrained and fine-tuned generative text models ranging in scale from 7 billion to 34 billion parameters. This is the repository for the base 13B version in the Hugging Face Transformers format. This model is designed for general code synthesis and understanding. Links to other models can be found in the index at the bottom.
476
+
477
+ | | Base Model | Python | Instruct |
478
+ | --- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
479
+ | 7B | [codellama/CodeLlama-7b-hf](https://huggingface.co/codellama/CodeLlama-7b-hf) | [codellama/CodeLlama-7b-Python-hf](https://huggingface.co/codellama/CodeLlama-7b-Python-hf) | [codellama/CodeLlama-7b-Instruct-hf](https://huggingface.co/codellama/CodeLlama-7b-Instruct-hf) |
480
+ | 13B | [codellama/CodeLlama-13b-hf](https://huggingface.co/codellama/CodeLlama-13b-hf) | [codellama/CodeLlama-13b-Python-hf](https://huggingface.co/codellama/CodeLlama-13b-Python-hf) | [codellama/CodeLlama-13b-Instruct-hf](https://huggingface.co/codellama/CodeLlama-13b-Instruct-hf) |
481
+ | 34B | [codellama/CodeLlama-34b-hf](https://huggingface.co/codellama/CodeLlama-34b-hf) | [codellama/CodeLlama-34b-Python-hf](https://huggingface.co/codellama/CodeLlama-34b-Python-hf) | [codellama/CodeLlama-34b-Instruct-hf](https://huggingface.co/codellama/CodeLlama-34b-Instruct-hf) |
482
+
483
+
484
+ ## Model Use
485
+
486
+ To use this model, please make sure to install transformers from `main` until the next version is released:
487
+
488
+ ```bash
489
+ pip install git+https://github.com/huggingface/transformers.git@main accelerate
490
+ ```
491
+
492
+ Model capabilities:
493
+
494
+ - [x] Code completion.
495
+ - [x] Infilling.
496
+ - [ ] Instructions / chat.
497
+ - [ ] Python specialist.
498
+
499
+
500
+ ```python
501
+ from transformers import AutoTokenizer
502
+ import transformers
503
+ import torch
504
+
505
+ model = "codellama/CodeLlama-13b-hf"
506
+
507
+ tokenizer = AutoTokenizer.from_pretrained(model)
508
+ pipeline = transformers.pipeline(
509
+ "text-generation",
510
+ model=model,
511
+ torch_dtype=torch.float16,
512
+ device_map="auto",
513
+ )
514
+
515
+ sequences = pipeline(
516
+ 'import socket\n\ndef ping_exponential_backoff(host: str):',
517
+ do_sample=True,
518
+ top_k=10,
519
+ temperature=0.1,
520
+ top_p=0.95,
521
+ num_return_sequences=1,
522
+ eos_token_id=tokenizer.eos_token_id,
523
+ max_length=200,
524
+ )
525
+ for seq in sequences:
526
+ print(f"Result: {seq['generated_text']}")
527
+ ```
528
+
529
+
530
+ ## Model Details
531
+ *Note: Use of this model is governed by the Meta license. Meta developed and publicly released the Code Llama family of large language models (LLMs).
532
+
533
+ **Model Developers** Meta
534
+
535
+ **Variations** Code Llama comes in three model sizes, and three variants:
536
+
537
+ * Code Llama: base models designed for general code synthesis and understanding
538
+ * Code Llama - Python: designed specifically for Python
539
+ * Code Llama - Instruct: for instruction following and safer deployment
540
+
541
+ All variants are available in sizes of 7B, 13B and 34B parameters.
542
+
543
+ **This repository contains the base version of the 13B parameters model.**
544
+
545
+ **Input** Models input text only.
546
+
547
+ **Output** Models generate text only.
548
+
549
+ **Model Architecture** Code Llama is an auto-regressive language model that uses an optimized transformer architecture.
550
+
551
+ **Model Dates** Code Llama and its variants have been trained between January 2023 and July 2023.
552
+
553
+ **Status** This is a static model trained on an offline dataset. Future versions of Code Llama - Instruct will be released as we improve model safety with community feedback.
554
+
555
+ **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/)
556
+
557
+ **Research Paper** More information can be found in the paper "[Code Llama: Open Foundation Models for Code](https://ai.meta.com/research/publications/code-llama-open-foundation-models-for-code/)" or its [arXiv page](https://arxiv.org/abs/2308.12950).
558
+
559
+ ## Intended Use
560
+ **Intended Use Cases** Code Llama and its variants is intended for commercial and research use in English and relevant programming languages. The base model Code Llama can be adapted for a variety of code synthesis and understanding tasks, Code Llama - Python is designed specifically to handle the Python programming language, and Code Llama - Instruct is intended to be safer to use for code assistant and generation applications.
561
+
562
+ **Out-of-Scope Uses** Use in any manner that violates applicable laws or regulations (including trade compliance laws). Use in languages other than English. Use in any other way that is prohibited by the Acceptable Use Policy and Licensing Agreement for Code Llama and its variants.
563
+
564
+ ## Hardware and Software
565
+ **Training Factors** We used custom training libraries. The training and fine-tuning of the released models have been performed Meta’s Research Super Cluster.
566
+
567
+ **Carbon Footprint** In aggregate, training all 9 Code Llama models required 400K GPU hours of computation on hardware of type A100-80GB (TDP of 350-400W). Estimated total emissions were 65.3 tCO2eq, 100% of which were offset by Meta’s sustainability program.
568
+
569
+ ## Training Data
570
+
571
+ All experiments reported here and the released models have been trained and fine-tuned using the same data as Llama 2 with different weights (see Section 2 and Table 1 in the [research paper](https://ai.meta.com/research/publications/code-llama-open-foundation-models-for-code/) for details).
572
+
573
+ ## Evaluation Results
574
+
575
+ See evaluations for the main models and detailed ablations in Section 3 and safety evaluations in Section 4 of the research paper.
576
+
577
+
578
+ ## Ethical Considerations and Limitations
579
+
580
+ Code Llama and its variants are a new technology that carries risks with use. Testing conducted to date has been in English, and has not covered, nor could it cover all scenarios. For these reasons, as with all LLMs, Code Llama’s potential outputs cannot be predicted in advance, and the model may in some instances produce inaccurate or objectionable responses to user prompts. Therefore, before deploying any applications of Code Llama, developers should perform safety testing and tuning tailored to their specific applications of the model.
581
+
582
+ Please see the Responsible Use Guide available available at [https://ai.meta.com/llama/responsible-user-guide](https://ai.meta.com/llama/responsible-user-guide).