TheBloke commited on
Commit
fbac64b
1 Parent(s): 272bbbe

Initial GGML model commit

Browse files
Files changed (1) hide show
  1. README.md +203 -0
README.md ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
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
9
+ model_type: llama
10
+ quantized_by: TheBloke
11
+ tags:
12
+ - text-to-code
13
+ - multilingual-code-generation
14
+ ---
15
+
16
+ <!-- header start -->
17
+ <div style="width: 100%;">
18
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
19
+ </div>
20
+ <div style="display: flex; justify-content: space-between; width: 100%;">
21
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
22
+ <p><a href="https://discord.gg/theblokeai">Chat & support: my new Discord server</a></p>
23
+ </div>
24
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
25
+ <p><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
26
+ </div>
27
+ </div>
28
+ <!-- header end -->
29
+
30
+ # CodeUp Llama 2 13B Chat HF - GGML
31
+ - Model creator: [DeepSE](https://huggingface.co/deepse)
32
+ - Original model: [CodeUp Llama 2 13B Chat HF](https://huggingface.co/deepse/CodeUp-Llama-2-13b-chat-hf)
33
+
34
+ ## Description
35
+
36
+ This repo contains GGML format model files for [DeepSE's CodeUp Llama 2 13B Chat HF](https://huggingface.co/deepse/CodeUp-Llama-2-13b-chat-hf).
37
+
38
+ GGML files are for CPU + GPU inference using [llama.cpp](https://github.com/ggerganov/llama.cpp) and libraries and UIs which support this format, such as:
39
+ * [text-generation-webui](https://github.com/oobabooga/text-generation-webui), the most popular web UI. Supports NVidia CUDA GPU acceleration.
40
+ * [KoboldCpp](https://github.com/LostRuins/koboldcpp), a powerful GGML web UI with GPU acceleration on all platforms (CUDA and OpenCL). Especially good for story telling.
41
+ * [LM Studio](https://lmstudio.ai/), a fully featured local GUI with GPU acceleration on both Windows (NVidia and AMD), and macOS.
42
+ * [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui), a great web UI with CUDA GPU acceleration via the c_transformers backend.
43
+ * [ctransformers](https://github.com/marella/ctransformers), a Python library with GPU accel, LangChain support, and OpenAI-compatible AI server.
44
+ * [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), a Python library with GPU accel, LangChain support, and OpenAI-compatible API server.
45
+
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 GGML models for CPU+GPU inference](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GGML)
50
+ * [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)
51
+
52
+ ## Prompt template: Alpaca
53
+
54
+ ```
55
+ Below is an instruction that describes a task. Write a response that appropriately completes the request.
56
+
57
+ ### Instruction:
58
+ {prompt}
59
+
60
+ ### Response:
61
+ ```
62
+
63
+ <!-- compatibility_ggml start -->
64
+ ## Compatibility
65
+
66
+ ### Original llama.cpp quant methods: `q4_0, q4_1, q5_0, q5_1, q8_0`
67
+
68
+ These are guaranteed to be compatible with any UIs, tools and libraries released since late May. They may be phased out soon, as they are largely superseded by the new k-quant methods.
69
+
70
+ ### New k-quant methods: `q2_K, q3_K_S, q3_K_M, q3_K_L, q4_K_S, q4_K_M, q5_K_S, q6_K`
71
+
72
+ These new quantisation methods are compatible with llama.cpp as of June 6th, commit `2d43387`.
73
+
74
+ They are now also compatible with recent releases of text-generation-webui, KoboldCpp, llama-cpp-python, ctransformers, rustformers and most others. For compatibility with other tools and libraries, please check their documentation.
75
+
76
+ ## Explanation of the new k-quant methods
77
+ <details>
78
+ <summary>Click to see details</summary>
79
+
80
+ The new methods available are:
81
+ * GGML_TYPE_Q2_K - "type-1" 2-bit quantization in super-blocks containing 16 blocks, each block having 16 weight. Block scales and mins are quantized with 4 bits. This ends up effectively using 2.5625 bits per weight (bpw)
82
+ * GGML_TYPE_Q3_K - "type-0" 3-bit quantization in super-blocks containing 16 blocks, each block having 16 weights. Scales are quantized with 6 bits. This end up using 3.4375 bpw.
83
+ * GGML_TYPE_Q4_K - "type-1" 4-bit quantization in super-blocks containing 8 blocks, each block having 32 weights. Scales and mins are quantized with 6 bits. This ends up using 4.5 bpw.
84
+ * GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
85
+ * GGML_TYPE_Q6_K - "type-0" 6-bit quantization. Super-blocks with 16 blocks, each block having 16 weights. Scales are quantized with 8 bits. This ends up using 6.5625 bpw
86
+ * GGML_TYPE_Q8_K - "type-0" 8-bit quantization. Only used for quantizing intermediate results. The difference to the existing Q8_0 is that the block size is 256. All 2-6 bit dot products are implemented for this quantization type.
87
+
88
+ Refer to the Provided Files table below to see what files use which methods, and how.
89
+ </details>
90
+ <!-- compatibility_ggml end -->
91
+
92
+ ## Provided files
93
+
94
+ | Name | Quant method | Bits | Size | Max RAM required | Use case |
95
+ | ---- | ---- | ---- | ---- | ---- | ----- |
96
+ | [codeup-llama-2-13b-chat-hf.ggmlv3.q2_K.bin](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GGML/blob/main/codeup-llama-2-13b-chat-hf.ggmlv3.q2_K.bin) | q2_K | 2 | 5.51 GB| 8.01 GB | New k-quant method. Uses GGML_TYPE_Q4_K for the attention.vw and feed_forward.w2 tensors, GGML_TYPE_Q2_K for the other tensors. |
97
+ | [codeup-llama-2-13b-chat-hf.ggmlv3.q3_K_L.bin](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GGML/blob/main/codeup-llama-2-13b-chat-hf.ggmlv3.q3_K_L.bin) | q3_K_L | 3 | 6.93 GB| 9.43 GB | New k-quant method. Uses GGML_TYPE_Q5_K for the attention.wv, attention.wo, and feed_forward.w2 tensors, else GGML_TYPE_Q3_K |
98
+ | [codeup-llama-2-13b-chat-hf.ggmlv3.q3_K_M.bin](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GGML/blob/main/codeup-llama-2-13b-chat-hf.ggmlv3.q3_K_M.bin) | q3_K_M | 3 | 6.31 GB| 8.81 GB | New k-quant method. Uses GGML_TYPE_Q4_K for the attention.wv, attention.wo, and feed_forward.w2 tensors, else GGML_TYPE_Q3_K |
99
+ | [codeup-llama-2-13b-chat-hf.ggmlv3.q3_K_S.bin](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GGML/blob/main/codeup-llama-2-13b-chat-hf.ggmlv3.q3_K_S.bin) | q3_K_S | 3 | 5.66 GB| 8.16 GB | New k-quant method. Uses GGML_TYPE_Q3_K for all tensors |
100
+ | [codeup-llama-2-13b-chat-hf.ggmlv3.q4_0.bin](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GGML/blob/main/codeup-llama-2-13b-chat-hf.ggmlv3.q4_0.bin) | q4_0 | 4 | 7.37 GB| 9.87 GB | Original quant method, 4-bit. |
101
+ | [codeup-llama-2-13b-chat-hf.ggmlv3.q4_1.bin](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GGML/blob/main/codeup-llama-2-13b-chat-hf.ggmlv3.q4_1.bin) | q4_1 | 4 | 8.17 GB| 10.67 GB | Original quant method, 4-bit. Higher accuracy than q4_0 but not as high as q5_0. However has quicker inference than q5 models. |
102
+ | [codeup-llama-2-13b-chat-hf.ggmlv3.q4_K_M.bin](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GGML/blob/main/codeup-llama-2-13b-chat-hf.ggmlv3.q4_K_M.bin) | q4_K_M | 4 | 7.87 GB| 10.37 GB | New k-quant method. Uses GGML_TYPE_Q6_K for half of the attention.wv and feed_forward.w2 tensors, else GGML_TYPE_Q4_K |
103
+ | [codeup-llama-2-13b-chat-hf.ggmlv3.q4_K_S.bin](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GGML/blob/main/codeup-llama-2-13b-chat-hf.ggmlv3.q4_K_S.bin) | q4_K_S | 4 | 7.37 GB| 9.87 GB | New k-quant method. Uses GGML_TYPE_Q4_K for all tensors |
104
+ | [codeup-llama-2-13b-chat-hf.ggmlv3.q5_0.bin](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GGML/blob/main/codeup-llama-2-13b-chat-hf.ggmlv3.q5_0.bin) | q5_0 | 5 | 8.97 GB| 11.47 GB | Original quant method, 5-bit. Higher accuracy, higher resource usage and slower inference. |
105
+ | [codeup-llama-2-13b-chat-hf.ggmlv3.q5_1.bin](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GGML/blob/main/codeup-llama-2-13b-chat-hf.ggmlv3.q5_1.bin) | q5_1 | 5 | 9.78 GB| 12.28 GB | Original quant method, 5-bit. Even higher accuracy, resource usage and slower inference. |
106
+ | [codeup-llama-2-13b-chat-hf.ggmlv3.q5_K_M.bin](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GGML/blob/main/codeup-llama-2-13b-chat-hf.ggmlv3.q5_K_M.bin) | q5_K_M | 5 | 9.23 GB| 11.73 GB | New k-quant method. Uses GGML_TYPE_Q6_K for half of the attention.wv and feed_forward.w2 tensors, else GGML_TYPE_Q5_K |
107
+ | [codeup-llama-2-13b-chat-hf.ggmlv3.q5_K_S.bin](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GGML/blob/main/codeup-llama-2-13b-chat-hf.ggmlv3.q5_K_S.bin) | q5_K_S | 5 | 8.97 GB| 11.47 GB | New k-quant method. Uses GGML_TYPE_Q5_K for all tensors |
108
+ | [codeup-llama-2-13b-chat-hf.ggmlv3.q6_K.bin](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GGML/blob/main/codeup-llama-2-13b-chat-hf.ggmlv3.q6_K.bin) | q6_K | 6 | 10.68 GB| 13.18 GB | New k-quant method. Uses GGML_TYPE_Q8_K for all tensors - 6-bit quantization |
109
+ | [codeup-llama-2-13b-chat-hf.ggmlv3.q8_0.bin](https://huggingface.co/TheBloke/CodeUp-Llama-2-13B-Chat-HF-GGML/blob/main/codeup-llama-2-13b-chat-hf.ggmlv3.q8_0.bin) | q8_0 | 8 | 13.79 GB| 16.29 GB | Original quant method, 8-bit. Almost indistinguishable from float16. High resource use and slow. Not recommended for most users. |
110
+
111
+ **Note**: the above RAM figures assume no GPU offloading. If layers are offloaded to the GPU, this will reduce RAM usage and use VRAM instead.
112
+
113
+ ## How to run in `llama.cpp`
114
+
115
+ I use the following command line; adjust for your tastes and needs:
116
+
117
+ ```
118
+ ./main -t 10 -ngl 32 -m codeup-llama-2-13b-chat-hf.ggmlv3.q4_K_M.bin --color -c 2048 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "### Instruction: Write a story about llamas\n### Response:"
119
+ ```
120
+ Change `-t 10` to the number of physical CPU cores you have. For example if your system has 8 cores/16 threads, use `-t 8`.
121
+
122
+ Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
123
+
124
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
125
+
126
+ ## How to run in `text-generation-webui`
127
+
128
+ Further instructions here: [text-generation-webui/docs/llama.cpp-models.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/llama.cpp-models.md).
129
+
130
+ <!-- footer start -->
131
+ ## Discord
132
+
133
+ For further support, and discussions on these models and AI in general, join us at:
134
+
135
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
136
+
137
+ ## Thanks, and how to contribute.
138
+
139
+ Thanks to the [chirper.ai](https://chirper.ai) team!
140
+
141
+ 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.
142
+
143
+ 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.
144
+
145
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
146
+
147
+ * Patreon: https://patreon.com/TheBlokeAI
148
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
149
+
150
+ **Special thanks to**: Luke from CarbonQuill, Aemon Algiz.
151
+
152
+ **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
153
+
154
+
155
+ Thank you to all my generous patrons and donaters!
156
+
157
+ <!-- footer end -->
158
+
159
+ # Original model card: DeepSE's CodeUp Llama 2 13B Chat HF
160
+
161
+
162
+ <!-- <p align="center" width="70%">
163
+ <img src="assets/Logo.jpg" alt="HKUST CodeUp" style="width: 50%; min-width: 250px; display: block; margin: auto;">
164
+ </p> -->
165
+ ![HKUST CodeUp](assets/Logo.jpg)
166
+ # CodeUp: A Multilingual Code Generation Llama2 Model with Parameter-Efficient Instruction-Tuning on a Single RTX 3090
167
+
168
+ ## Description
169
+ 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.
170
+ 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.
171
+
172
+ 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.
173
+
174
+ ![Training Framework](assets/Framework.jpg)
175
+
176
+
177
+ ## NL2Code Data Release
178
+ Recently, it has attracted significant attention to exploiting much larger and more powerful LLMs (e.g., ChatGPT, GPT-4) to self-generate instruction-following data by delicate prompt design. However, many approaches primarily focus on the general domain and lack code-specific domain considerations. To this end, [Code Alpaca](https://github.com/sahil280114/codealpaca) follows the previous Self-Instruct paper [3] and [Stanford Alpaca repo](https://github.com/tatsu-lab/stanford_alpaca) with some code-related modifications to conduct 20K instruction-following data `data/code_alpaca_20k.json` for code generation tasks. This `JSON` file following `alpaca_data.json` format is a list of dictionaries; each dictionary contains the following fields:
179
+
180
+ - `instruction`: `str`, describes the task the model should perform. Each of the 20K instructions is unique.
181
+ - `input`: `str`, optional context or input for the task. For example, when the instruction is "Amend the following SQL query to select distinct elements", the input is the SQL query. Around 40% of the examples have an input.
182
+ - `output`: `str`, the answer to the instruction as generated by `text-davinci-003`.
183
+
184
+ ### High-quality Data Filter
185
+ 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
186
+
187
+ 1. When `instruction` doesn't specify the programming language (PL) of implementation, the `output` appears with diverse options, e.g., Python, C++, and JavaScript.
188
+ 2. It is ambiguous to identify which programming language `output` is implemented by.
189
+ 3. Both `instruction` and `output` are irrelevant to the code-specific domain.
190
+
191
+ 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.
192
+
193
+ 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.
194
+
195
+ <!-- | Raw Data (20K + 4K)| Filtered Data (19K) |
196
+ | -- | -- |
197
+ | <center><img src="assets/PL_Raw.png" width="100%"></center> | <center><img src="assets/PL_Clean.png" width="92%"></center> | -->
198
+
199
+ ![PL Data Filtering)](assets/PL_Filter.jpg)
200
+
201
+
202
+ ## Training & Inference
203
+ Detailed instructions can be found at [https://github.com/juyongjiang/CodeUp](https://github.com/juyongjiang/CodeUp).