RichardErkhov commited on
Commit
bdadde0
·
verified ·
1 Parent(s): 2653775

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +313 -0
README.md ADDED
@@ -0,0 +1,313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Quantization made by Richard Erkhov.
2
+
3
+ [Github](https://github.com/RichardErkhov)
4
+
5
+ [Discord](https://discord.gg/pvy7H8DZMG)
6
+
7
+ [Request more models](https://github.com/RichardErkhov/quant_request)
8
+
9
+
10
+ granite-8b-code-instruct-4k - GGUF
11
+ - Model creator: https://huggingface.co/ibm-granite/
12
+ - Original model: https://huggingface.co/ibm-granite/granite-8b-code-instruct-4k/
13
+
14
+
15
+ | Name | Quant method | Size |
16
+ | ---- | ---- | ---- |
17
+ | [granite-8b-code-instruct-4k.Q2_K.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.Q2_K.gguf) | Q2_K | 2.85GB |
18
+ | [granite-8b-code-instruct-4k.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.IQ3_XS.gguf) | IQ3_XS | 3.15GB |
19
+ | [granite-8b-code-instruct-4k.IQ3_S.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.IQ3_S.gguf) | IQ3_S | 3.32GB |
20
+ | [granite-8b-code-instruct-4k.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.Q3_K_S.gguf) | Q3_K_S | 3.3GB |
21
+ | [granite-8b-code-instruct-4k.IQ3_M.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.IQ3_M.gguf) | IQ3_M | 3.43GB |
22
+ | [granite-8b-code-instruct-4k.Q3_K.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.Q3_K.gguf) | Q3_K | 3.67GB |
23
+ | [granite-8b-code-instruct-4k.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.Q3_K_M.gguf) | Q3_K_M | 3.67GB |
24
+ | [granite-8b-code-instruct-4k.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.Q3_K_L.gguf) | Q3_K_L | 3.99GB |
25
+ | [granite-8b-code-instruct-4k.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.IQ4_XS.gguf) | IQ4_XS | 4.1GB |
26
+ | [granite-8b-code-instruct-4k.Q4_0.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.Q4_0.gguf) | Q4_0 | 4.28GB |
27
+ | [granite-8b-code-instruct-4k.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.IQ4_NL.gguf) | IQ4_NL | 4.32GB |
28
+ | [granite-8b-code-instruct-4k.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.Q4_K_S.gguf) | Q4_K_S | 4.3GB |
29
+ | [granite-8b-code-instruct-4k.Q4_K.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.Q4_K.gguf) | Q4_K | 4.55GB |
30
+ | [granite-8b-code-instruct-4k.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.Q4_K_M.gguf) | Q4_K_M | 4.55GB |
31
+ | [granite-8b-code-instruct-4k.Q4_1.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.Q4_1.gguf) | Q4_1 | 4.73GB |
32
+ | [granite-8b-code-instruct-4k.Q5_0.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.Q5_0.gguf) | Q5_0 | 5.19GB |
33
+ | [granite-8b-code-instruct-4k.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.Q5_K_S.gguf) | Q5_K_S | 5.19GB |
34
+ | [granite-8b-code-instruct-4k.Q5_K.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.Q5_K.gguf) | Q5_K | 5.33GB |
35
+ | [granite-8b-code-instruct-4k.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.Q5_K_M.gguf) | Q5_K_M | 5.33GB |
36
+ | [granite-8b-code-instruct-4k.Q5_1.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.Q5_1.gguf) | Q5_1 | 5.65GB |
37
+ | [granite-8b-code-instruct-4k.Q6_K.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.Q6_K.gguf) | Q6_K | 6.16GB |
38
+ | [granite-8b-code-instruct-4k.Q8_0.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-4k-gguf/blob/main/granite-8b-code-instruct-4k.Q8_0.gguf) | Q8_0 | 7.98GB |
39
+
40
+
41
+
42
+
43
+ Original model description:
44
+ ---
45
+ pipeline_tag: text-generation
46
+ base_model: ibm-granite/granite-8b-code-base-4k
47
+ inference: false
48
+ license: apache-2.0
49
+ datasets:
50
+ - bigcode/commitpackft
51
+ - TIGER-Lab/MathInstruct
52
+ - meta-math/MetaMathQA
53
+ - glaiveai/glaive-code-assistant-v3
54
+ - glaive-function-calling-v2
55
+ - bugdaryan/sql-create-context-instruction
56
+ - garage-bAInd/Open-Platypus
57
+ - nvidia/HelpSteer
58
+ metrics:
59
+ - code_eval
60
+ library_name: transformers
61
+ tags:
62
+ - code
63
+ - granite
64
+ model-index:
65
+ - name: granite-8b-code-instruct-4k
66
+ results:
67
+ - task:
68
+ type: text-generation
69
+ dataset:
70
+ type: bigcode/humanevalpack
71
+ name: HumanEvalSynthesis(Python)
72
+ metrics:
73
+ - name: pass@1
74
+ type: pass@1
75
+ value: 57.9
76
+ veriefied: false
77
+ - task:
78
+ type: text-generation
79
+ dataset:
80
+ type: bigcode/humanevalpack
81
+ name: HumanEvalSynthesis(JavaScript)
82
+ metrics:
83
+ - name: pass@1
84
+ type: pass@1
85
+ value: 52.4
86
+ veriefied: false
87
+ - task:
88
+ type: text-generation
89
+ dataset:
90
+ type: bigcode/humanevalpack
91
+ name: HumanEvalSynthesis(Java)
92
+ metrics:
93
+ - name: pass@1
94
+ type: pass@1
95
+ value: 58.5
96
+ veriefied: false
97
+ - task:
98
+ type: text-generation
99
+ dataset:
100
+ type: bigcode/humanevalpack
101
+ name: HumanEvalSynthesis(Go)
102
+ metrics:
103
+ - name: pass@1
104
+ type: pass@1
105
+ value: 43.3
106
+ veriefied: false
107
+ - task:
108
+ type: text-generation
109
+ dataset:
110
+ type: bigcode/humanevalpack
111
+ name: HumanEvalSynthesis(C++)
112
+ metrics:
113
+ - name: pass@1
114
+ type: pass@1
115
+ value: 48.2
116
+ veriefied: false
117
+ - task:
118
+ type: text-generation
119
+ dataset:
120
+ type: bigcode/humanevalpack
121
+ name: HumanEvalSynthesis(Rust)
122
+ metrics:
123
+ - name: pass@1
124
+ type: pass@1
125
+ value: 37.2
126
+ veriefied: false
127
+ - task:
128
+ type: text-generation
129
+ dataset:
130
+ type: bigcode/humanevalpack
131
+ name: HumanEvalExplain(Python)
132
+ metrics:
133
+ - name: pass@1
134
+ type: pass@1
135
+ value: 53.0
136
+ veriefied: false
137
+ - task:
138
+ type: text-generation
139
+ dataset:
140
+ type: bigcode/humanevalpack
141
+ name: HumanEvalExplain(JavaScript)
142
+ metrics:
143
+ - name: pass@1
144
+ type: pass@1
145
+ value: 42.7
146
+ veriefied: false
147
+ - task:
148
+ type: text-generation
149
+ dataset:
150
+ type: bigcode/humanevalpack
151
+ name: HumanEvalExplain(Java)
152
+ metrics:
153
+ - name: pass@1
154
+ type: pass@1
155
+ value: 52.4
156
+ veriefied: false
157
+ - task:
158
+ type: text-generation
159
+ dataset:
160
+ type: bigcode/humanevalpack
161
+ name: HumanEvalExplain(Go)
162
+ metrics:
163
+ - name: pass@1
164
+ type: pass@1
165
+ value: 36.6
166
+ veriefied: false
167
+ - task:
168
+ type: text-generation
169
+ dataset:
170
+ type: bigcode/humanevalpack
171
+ name: HumanEvalExplain(C++)
172
+ metrics:
173
+ - name: pass@1
174
+ type: pass@1
175
+ value: 43.9
176
+ veriefied: false
177
+ - task:
178
+ type: text-generation
179
+ dataset:
180
+ type: bigcode/humanevalpack
181
+ name: HumanEvalExplain(Rust)
182
+ metrics:
183
+ - name: pass@1
184
+ type: pass@1
185
+ value: 16.5
186
+ veriefied: false
187
+ - task:
188
+ type: text-generation
189
+ dataset:
190
+ type: bigcode/humanevalpack
191
+ name: HumanEvalFix(Python)
192
+ metrics:
193
+ - name: pass@1
194
+ type: pass@1
195
+ value: 39.6
196
+ veriefied: false
197
+ - task:
198
+ type: text-generation
199
+ dataset:
200
+ type: bigcode/humanevalpack
201
+ name: HumanEvalFix(JavaScript)
202
+ metrics:
203
+ - name: pass@1
204
+ type: pass@1
205
+ value: 40.9
206
+ veriefied: false
207
+ - task:
208
+ type: text-generation
209
+ dataset:
210
+ type: bigcode/humanevalpack
211
+ name: HumanEvalFix(Java)
212
+ metrics:
213
+ - name: pass@1
214
+ type: pass@1
215
+ value: 48.2
216
+ veriefied: false
217
+ - task:
218
+ type: text-generation
219
+ dataset:
220
+ type: bigcode/humanevalpack
221
+ name: HumanEvalFix(Go)
222
+ metrics:
223
+ - name: pass@1
224
+ type: pass@1
225
+ value: 41.5
226
+ veriefied: false
227
+ - task:
228
+ type: text-generation
229
+ dataset:
230
+ type: bigcode/humanevalpack
231
+ name: HumanEvalFix(C++)
232
+ metrics:
233
+ - name: pass@1
234
+ type: pass@1
235
+ value: 39.0
236
+ veriefied: false
237
+ - task:
238
+ type: text-generation
239
+ dataset:
240
+ type: bigcode/humanevalpack
241
+ name: HumanEvalFix(Rust)
242
+ metrics:
243
+ - name: pass@1
244
+ type: pass@1
245
+ value: 32.9
246
+ veriefied: false
247
+ ---
248
+
249
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/62cd5057674cdb524450093d/1hzxoPwqkBJXshKVVe6_9.png)
250
+
251
+ # Granite-8B-Code-Instruct-4K
252
+
253
+ ## Model Summary
254
+ **Granite-8B-Code-Instruct-4K** is a 8B parameter model fine tuned from *Granite-8B-Code-Base-4K* on a combination of **permissively licensed** instruction data to enhance instruction following capabilities including logical reasoning and problem-solving skills.
255
+
256
+ - **Developers:** IBM Research
257
+ - **GitHub Repository:** [ibm-granite/granite-code-models](https://github.com/ibm-granite/granite-code-models)
258
+ - **Paper:** [Granite Code Models: A Family of Open Foundation Models for Code Intelligence](https://arxiv.org/abs/2405.04324)
259
+ - **Release Date**: May 6th, 2024
260
+ - **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0).
261
+
262
+ ## Usage
263
+ ### Intended use
264
+ The model is designed to respond to coding related instructions and can be used to build coding assistants.
265
+
266
+ <!-- TO DO: Check starcoder2 instruct code example that includes the template https://huggingface.co/bigcode/starcoder2-15b-instruct-v0.1 -->
267
+
268
+ ### Generation
269
+ This is a simple example of how to use **Granite-8B-Code-Instruct-4K** model.
270
+
271
+ ```python
272
+ import torch
273
+ from transformers import AutoModelForCausalLM, AutoTokenizer
274
+ device = "cuda" # or "cpu"
275
+ model_path = "ibm-granite/granite-8b-code-instruct-4k"
276
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
277
+ # drop device_map if running on CPU
278
+ model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
279
+ model.eval()
280
+ # change input text as desired
281
+ chat = [
282
+ { "role": "user", "content": "Write a code to find the maximum value in a list of numbers." },
283
+ ]
284
+ chat = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
285
+ # tokenize the text
286
+ input_tokens = tokenizer(chat, return_tensors="pt")
287
+ # transfer tokenized inputs to the device
288
+ for i in input_tokens:
289
+ input_tokens[i] = input_tokens[i].to(device)
290
+ # generate output tokens
291
+ output = model.generate(**input_tokens, max_new_tokens=100)
292
+ # decode output tokens into text
293
+ output = tokenizer.batch_decode(output)
294
+ # loop over the batch to print, in this example the batch size is 1
295
+ for i in output:
296
+ print(i)
297
+ ```
298
+
299
+ <!-- TO DO: Check this part -->
300
+ ## Training Data
301
+ Granite Code Instruct models are trained on the following types of data.
302
+ * Code Commits Datasets: we sourced code commits data from the [CommitPackFT](https://huggingface.co/datasets/bigcode/commitpackft) dataset, a filtered version of the full CommitPack dataset. From CommitPackFT dataset, we only consider data for 92 programming languages. Our inclusion criteria boils down to selecting programming languages common across CommitPackFT and the 116 languages that we considered to pretrain the code-base model (*Granite-8B-Code-Base*).
303
+ * Math Datasets: We consider two high-quality math datasets, [MathInstruct](https://huggingface.co/datasets/TIGER-Lab/MathInstruct) and [MetaMathQA](https://huggingface.co/datasets/meta-math/MetaMathQA). Due to license issues, we filtered out GSM8K-RFT and Camel-Math from MathInstruct dataset.
304
+ * Code Instruction Datasets: We use [Glaive-Code-Assistant-v3](https://huggingface.co/datasets/glaiveai/glaive-code-assistant-v3), [Glaive-Function-Calling-v2](https://huggingface.co/datasets/glaiveai/glaive-function-calling-v2), [NL2SQL11](https://huggingface.co/datasets/bugdaryan/sql-create-context-instruction) and a small collection of synthetic API calling datasets.
305
+ * Language Instruction Datasets: We include high-quality datasets such as [HelpSteer](https://huggingface.co/datasets/nvidia/HelpSteer) and an open license-filtered version of [Platypus](https://huggingface.co/datasets/garage-bAInd/Open-Platypus). We also include a collection of hardcoded prompts to ensure our model generates correct outputs given inquiries about its name or developers.
306
+
307
+ ## Infrastructure
308
+ We train the Granite Code models using two of IBM's super computing clusters, namely Vela and Blue Vela, both outfitted with NVIDIA A100 and H100 GPUs respectively. These clusters provide a scalable and efficient infrastructure for training our models over thousands of GPUs.
309
+
310
+ ## Ethical Considerations and Limitations
311
+ Granite code instruct models are primarily finetuned using instruction-response pairs across a specific set of programming languages. Thus, their performance may be limited with out-of-domain programming languages. In this situation, it is beneficial providing few-shot examples to steer the model's output. Moreover, developers should perform safety testing and target-specific tuning before deploying these models on critical applications. The model also inherits ethical considerations and limitations from its base model. For more information, please refer to *[Granite-8B-Code-Base-4K](https://huggingface.co/ibm-granite/granite-8b-code-base-4k)* model card.
312
+
313
+