RichardErkhov commited on
Commit
4502c2d
1 Parent(s): f274587

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +326 -0
README.md ADDED
@@ -0,0 +1,326 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-20b-code-base - GGUF
11
+ - Model creator: https://huggingface.co/ibm-granite/
12
+ - Original model: https://huggingface.co/ibm-granite/granite-20b-code-base/
13
+
14
+
15
+ | Name | Quant method | Size |
16
+ | ---- | ---- | ---- |
17
+ | [granite-20b-code-base.Q2_K.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.Q2_K.gguf) | Q2_K | 7.38GB |
18
+ | [granite-20b-code-base.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.IQ3_XS.gguf) | IQ3_XS | 8.06GB |
19
+ | [granite-20b-code-base.IQ3_S.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.IQ3_S.gguf) | IQ3_S | 1.45GB |
20
+ | [granite-20b-code-base.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.Q3_K_S.gguf) | Q3_K_S | 8.32GB |
21
+ | [granite-20b-code-base.IQ3_M.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.IQ3_M.gguf) | IQ3_M | 2.21GB |
22
+ | [granite-20b-code-base.Q3_K.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.Q3_K.gguf) | Q3_K | 1.42GB |
23
+ | [granite-20b-code-base.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.Q3_K_M.gguf) | Q3_K_M | 0.87GB |
24
+ | [granite-20b-code-base.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.Q3_K_L.gguf) | Q3_K_L | 0.51GB |
25
+ | [granite-20b-code-base.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.IQ4_XS.gguf) | IQ4_XS | 0.11GB |
26
+ | [granite-20b-code-base.Q4_0.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.Q4_0.gguf) | Q4_0 | 0.1GB |
27
+ | [granite-20b-code-base.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.IQ4_NL.gguf) | IQ4_NL | 0.02GB |
28
+ | [granite-20b-code-base.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.Q4_K_S.gguf) | Q4_K_S | 0.01GB |
29
+ | [granite-20b-code-base.Q4_K.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.Q4_K.gguf) | Q4_K | 0.01GB |
30
+ | [granite-20b-code-base.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.Q4_K_M.gguf) | Q4_K_M | 0.0GB |
31
+ | [granite-20b-code-base.Q4_1.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.Q4_1.gguf) | Q4_1 | 0.0GB |
32
+ | [granite-20b-code-base.Q5_0.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.Q5_0.gguf) | Q5_0 | 0.0GB |
33
+ | [granite-20b-code-base.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.Q5_K_S.gguf) | Q5_K_S | 0.0GB |
34
+ | [granite-20b-code-base.Q5_K.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.Q5_K.gguf) | Q5_K | 0.0GB |
35
+ | [granite-20b-code-base.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.Q5_K_M.gguf) | Q5_K_M | 0.0GB |
36
+ | [granite-20b-code-base.Q5_1.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.Q5_1.gguf) | Q5_1 | 0.0GB |
37
+ | [granite-20b-code-base.Q6_K.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.Q6_K.gguf) | Q6_K | 0.0GB |
38
+ | [granite-20b-code-base.Q8_0.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-20b-code-base-gguf/blob/main/granite-20b-code-base.Q8_0.gguf) | Q8_0 | 0.0GB |
39
+
40
+
41
+
42
+
43
+ Original model description:
44
+ ---
45
+ pipeline_tag: text-generation
46
+ inference: true
47
+ license: apache-2.0
48
+ datasets:
49
+ - codeparrot/github-code-clean
50
+ - bigcode/starcoderdata
51
+ # - Stackexchange
52
+ # - CommonCrawl
53
+ - open-web-math/open-web-math
54
+ - math-ai/StackMathQA
55
+ # - Arxiv
56
+ # - Wikipedia
57
+ # - conceptofmind/FLAN_2022 # Original link is broken, we used IBM's filtered version | Phase 2
58
+ metrics:
59
+ - code_eval
60
+ library_name: transformers
61
+ tags:
62
+ - code
63
+ - granite
64
+ model-index:
65
+ - name: granite-20b-code-base
66
+ results:
67
+ - task:
68
+ type: text-generation
69
+ dataset:
70
+ type: mbpp
71
+ name: MBPP
72
+ metrics:
73
+ - name: pass@1
74
+ type: pass@1
75
+ value: 43.8
76
+ veriefied: false
77
+ - task:
78
+ type: text-generation
79
+ dataset:
80
+ type: evalplus/mbppplus
81
+ name: MBPP+
82
+ metrics:
83
+ - name: pass@1
84
+ type: pass@1
85
+ value: 51.6
86
+ veriefied: false
87
+ - task:
88
+ type: text-generation
89
+ dataset:
90
+ type: bigcode/humanevalpack
91
+ name: HumanEvalSynthesis(Python)
92
+ metrics:
93
+ - name: pass@1
94
+ type: pass@1
95
+ value: 48.2
96
+ veriefied: false
97
+ - task:
98
+ type: text-generation
99
+ dataset:
100
+ type: bigcode/humanevalpack
101
+ name: HumanEvalSynthesis(JavaScript)
102
+ metrics:
103
+ - name: pass@1
104
+ type: pass@1
105
+ value: 50.0
106
+ veriefied: false
107
+ - task:
108
+ type: text-generation
109
+ dataset:
110
+ type: bigcode/humanevalpack
111
+ name: HumanEvalSynthesis(Java)
112
+ metrics:
113
+ - name: pass@1
114
+ type: pass@1
115
+ value: 59.1
116
+ veriefied: false
117
+ - task:
118
+ type: text-generation
119
+ dataset:
120
+ type: bigcode/humanevalpack
121
+ name: HumanEvalSynthesis(Go)
122
+ metrics:
123
+ - name: pass@1
124
+ type: pass@1
125
+ value: 32.3
126
+ veriefied: false
127
+ - task:
128
+ type: text-generation
129
+ dataset:
130
+ type: bigcode/humanevalpack
131
+ name: HumanEvalSynthesis(C++)
132
+ metrics:
133
+ - name: pass@1
134
+ type: pass@1
135
+ value: 40.9
136
+ veriefied: false
137
+ - task:
138
+ type: text-generation
139
+ dataset:
140
+ type: bigcode/humanevalpack
141
+ name: HumanEvalSynthesis(Rust)
142
+ metrics:
143
+ - name: pass@1
144
+ type: pass@1
145
+ value: 35.4
146
+ veriefied: false
147
+ - task:
148
+ type: text-generation
149
+ dataset:
150
+ type: bigcode/humanevalpack
151
+ name: HumanEvalExplain(Python)
152
+ metrics:
153
+ - name: pass@1
154
+ type: pass@1
155
+ value: 17.1
156
+ veriefied: false
157
+ - task:
158
+ type: text-generation
159
+ dataset:
160
+ type: bigcode/humanevalpack
161
+ name: HumanEvalExplain(JavaScript)
162
+ metrics:
163
+ - name: pass@1
164
+ type: pass@1
165
+ value: 18.3
166
+ veriefied: false
167
+ - task:
168
+ type: text-generation
169
+ dataset:
170
+ type: bigcode/humanevalpack
171
+ name: HumanEvalExplain(Java)
172
+ metrics:
173
+ - name: pass@1
174
+ type: pass@1
175
+ value: 23.2
176
+ veriefied: false
177
+ - task:
178
+ type: text-generation
179
+ dataset:
180
+ type: bigcode/humanevalpack
181
+ name: HumanEvalExplain(Go)
182
+ metrics:
183
+ - name: pass@1
184
+ type: pass@1
185
+ value: 10.4
186
+ veriefied: false
187
+ - task:
188
+ type: text-generation
189
+ dataset:
190
+ type: bigcode/humanevalpack
191
+ name: HumanEvalExplain(C++)
192
+ metrics:
193
+ - name: pass@1
194
+ type: pass@1
195
+ value: 25.6
196
+ veriefied: false
197
+ - task:
198
+ type: text-generation
199
+ dataset:
200
+ type: bigcode/humanevalpack
201
+ name: HumanEvalExplain(Rust)
202
+ metrics:
203
+ - name: pass@1
204
+ type: pass@1
205
+ value: 18.3
206
+ veriefied: false
207
+ - task:
208
+ type: text-generation
209
+ dataset:
210
+ type: bigcode/humanevalpack
211
+ name: HumanEvalFix(Python)
212
+ metrics:
213
+ - name: pass@1
214
+ type: pass@1
215
+ value: 23.2
216
+ veriefied: false
217
+ - task:
218
+ type: text-generation
219
+ dataset:
220
+ type: bigcode/humanevalpack
221
+ name: HumanEvalFix(JavaScript)
222
+ metrics:
223
+ - name: pass@1
224
+ type: pass@1
225
+ value: 23.8
226
+ veriefied: false # Check
227
+ - task:
228
+ type: text-generation
229
+ dataset:
230
+ type: bigcode/humanevalpack
231
+ name: HumanEvalFix(Java)
232
+ metrics:
233
+ - name: pass@1
234
+ type: pass@1
235
+ value: 14.6
236
+ veriefied: false
237
+ - task:
238
+ type: text-generation
239
+ dataset:
240
+ type: bigcode/humanevalpack
241
+ name: HumanEvalFix(Go)
242
+ metrics:
243
+ - name: pass@1
244
+ type: pass@1
245
+ value: 26.2
246
+ veriefied: false
247
+ - task:
248
+ type: text-generation
249
+ dataset:
250
+ type: bigcode/humanevalpack
251
+ name: HumanEvalFix(C++)
252
+ metrics:
253
+ - name: pass@1
254
+ type: pass@1
255
+ value: 15.2
256
+ veriefied: false
257
+ - task:
258
+ type: text-generation
259
+ dataset:
260
+ type: bigcode/humanevalpack
261
+ name: HumanEvalFix(Rust)
262
+ metrics:
263
+ - name: pass@1
264
+ type: pass@1
265
+ value: 3.0
266
+ veriefied: false
267
+ ---
268
+
269
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/62cd5057674cdb524450093d/1hzxoPwqkBJXshKVVe6_9.png)
270
+
271
+ # Granite-20B-Code-Base
272
+
273
+ ## Model Summary
274
+ **Granite-20B-Code-Base** is a decoder-only code model designed for code generative tasks (e.g., code generation, code explanation, code fixing, etc.). It is trained from scratch with a two-phase training strategy. In phase 1, our model is trained on 3 trillion tokens sourced from 116 programming languages, ensuring a comprehensive understanding of programming languages and syntax. In phase 2, our model is trained on 500 billion tokens with a carefully designed mixture of high-quality data from code and natural language domains to improve the models’ ability to reason and follow instructions.
275
+
276
+ - **Developers:** IBM Research
277
+ - **GitHub Repository:** [ibm-granite/granite-code-models](https://github.com/ibm-granite/granite-code-models)
278
+ - **Paper:** [Granite Code Models: A Family of Open Foundation Models for Code Intelligence](https://arxiv.org/abs/2405.04324)
279
+ - **Release Date**: May 6th, 2024
280
+ - **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0).
281
+
282
+ ## Usage
283
+ ### Intended use
284
+ Prominent enterprise use cases of LLMs in software engineering productivity include code generation, code explanation, code fixing, generating unit tests, generating documentation, addressing technical debt issues, vulnerability detection, code translation, and more. All Granite Code Base models, including the **20B parameter model**, are able to handle these tasks as they were trained on a large amount of code data from 116 programming languages.
285
+
286
+ ### Generation
287
+ This is a simple example of how to use **Granite-20B-Code-Base** model.
288
+
289
+ ```python
290
+ import torch
291
+ from transformers import AutoModelForCausalLM, AutoTokenizer
292
+ device = "cuda" # or "cpu"
293
+ model_path = "ibm-granite/granite-20b-code-base"
294
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
295
+ # drop device_map if running on CPU
296
+ model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
297
+ model.eval()
298
+ # change input text as desired
299
+ input_text = "def generate():"
300
+ # tokenize the text
301
+ input_tokens = tokenizer(input_text, return_tensors="pt")
302
+ # transfer tokenized inputs to the device
303
+ for i in input_tokens:
304
+ input_tokens[i] = input_tokens[i].to(device)
305
+ # generate output tokens
306
+ output = model.generate(**input_tokens)
307
+ # decode output tokens into text
308
+ output = tokenizer.batch_decode(output)
309
+ # loop over the batch to print, in this example the batch size is 1
310
+ for i in output:
311
+ print(i)
312
+ ```
313
+
314
+ ## Training Data
315
+ - **Data Collection and Filtering:** Pretraining code data is sourced from a combination of publicly available datasets (e.g., [GitHub Code Clean](https://huggingface.co/datasets/codeparrot/github-code-clean), [Starcoder data](https://huggingface.co/datasets/bigcode/starcoderdata)), and additional public code repositories and issues from GitHub. We filter raw data to retain a list of 116 programming languages. After language filtering, we also filter out low-quality code.
316
+ - **Exact and Fuzzy Deduplication:** We adopt an aggressive deduplication strategy that includes both exact and fuzzy deduplication to remove documents having (near) identical code content.
317
+ - **HAP, PII, Malware Filtering:** We apply a HAP content filter that reduces models' likelihood of generating hateful, abusive, or profane language. We also make sure to redact Personally Identifiable Information (PII) by replacing PII content (e.g., names, email addresses, keys, passwords) with corresponding tokens (e.g., ⟨NAME⟩, ⟨EMAIL⟩, ⟨KEY⟩, ⟨PASSWORD⟩). Moreover, we scan all datasets using [ClamAV](https://www.clamav.net/) to identify and remove instances of malware in the source code.
318
+ - **Natural Language Datasets:** In addition to collecting code data for model training, we curate several publicly available high-quality natural language datasets to improve models' proficiency in language understanding and mathematical reasoning. Unlike the code data, we do not deduplicate these datasets.
319
+
320
+ ## Infrastructure
321
+ 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.
322
+
323
+ ## Ethical Considerations and Limitations
324
+ The use of Large Language Models involves risks and ethical considerations people must be aware of. Regarding code generation, caution is urged against complete reliance on specific code models for crucial decisions or impactful information as the generated code is not guaranteed to work as intended. **Granite-20B-Code-Base** model is not the exception in this regard. Even though this model is suited for multiple code-related tasks, it has not undergone any safety alignment, there it may produce problematic outputs. Additionally, it remains uncertain whether smaller models might exhibit increased susceptibility to hallucination in generation scenarios by copying source code verbatim from the training dataset due to their reduced sizes and memorization capacities. This aspect is currently an active area of research, and we anticipate more rigorous exploration, comprehension, and mitigations in this domain. Regarding ethics, a latent risk associated with all Large Language Models is their malicious utilization. We urge the community to use **Granite-20B-Code-Base** model with ethical intentions and in a responsible way.
325
+
326
+