RichardErkhov commited on
Commit
1e6708d
·
verified ·
1 Parent(s): 6fdc35d

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +295 -0
README.md ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-base-128k - GGUF
11
+ - Model creator: https://huggingface.co/ibm-granite/
12
+ - Original model: https://huggingface.co/ibm-granite/granite-8b-code-base-128k/
13
+
14
+
15
+ | Name | Quant method | Size |
16
+ | ---- | ---- | ---- |
17
+ | [granite-8b-code-base-128k.Q2_K.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.Q2_K.gguf) | Q2_K | 2.85GB |
18
+ | [granite-8b-code-base-128k.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.IQ3_XS.gguf) | IQ3_XS | 3.15GB |
19
+ | [granite-8b-code-base-128k.IQ3_S.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.IQ3_S.gguf) | IQ3_S | 3.32GB |
20
+ | [granite-8b-code-base-128k.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.Q3_K_S.gguf) | Q3_K_S | 3.3GB |
21
+ | [granite-8b-code-base-128k.IQ3_M.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.IQ3_M.gguf) | IQ3_M | 3.43GB |
22
+ | [granite-8b-code-base-128k.Q3_K.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.Q3_K.gguf) | Q3_K | 3.67GB |
23
+ | [granite-8b-code-base-128k.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.Q3_K_M.gguf) | Q3_K_M | 3.67GB |
24
+ | [granite-8b-code-base-128k.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.Q3_K_L.gguf) | Q3_K_L | 3.99GB |
25
+ | [granite-8b-code-base-128k.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.IQ4_XS.gguf) | IQ4_XS | 4.1GB |
26
+ | [granite-8b-code-base-128k.Q4_0.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.Q4_0.gguf) | Q4_0 | 4.28GB |
27
+ | [granite-8b-code-base-128k.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.IQ4_NL.gguf) | IQ4_NL | 4.32GB |
28
+ | [granite-8b-code-base-128k.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.Q4_K_S.gguf) | Q4_K_S | 4.3GB |
29
+ | [granite-8b-code-base-128k.Q4_K.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.Q4_K.gguf) | Q4_K | 4.55GB |
30
+ | [granite-8b-code-base-128k.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.Q4_K_M.gguf) | Q4_K_M | 4.55GB |
31
+ | [granite-8b-code-base-128k.Q4_1.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.Q4_1.gguf) | Q4_1 | 4.73GB |
32
+ | [granite-8b-code-base-128k.Q5_0.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.Q5_0.gguf) | Q5_0 | 5.19GB |
33
+ | [granite-8b-code-base-128k.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.Q5_K_S.gguf) | Q5_K_S | 5.19GB |
34
+ | [granite-8b-code-base-128k.Q5_K.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.Q5_K.gguf) | Q5_K | 5.33GB |
35
+ | [granite-8b-code-base-128k.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.Q5_K_M.gguf) | Q5_K_M | 5.33GB |
36
+ | [granite-8b-code-base-128k.Q5_1.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.Q5_1.gguf) | Q5_1 | 5.65GB |
37
+ | [granite-8b-code-base-128k.Q6_K.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.Q6_K.gguf) | Q6_K | 6.16GB |
38
+ | [granite-8b-code-base-128k.Q8_0.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-base-128k-gguf/blob/main/granite-8b-code-base-128k.Q8_0.gguf) | Q8_0 | 7.98GB |
39
+
40
+
41
+
42
+
43
+ Original model description:
44
+ ---
45
+ pipeline_tag: text-generation
46
+ inference: false
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
58
+ metrics:
59
+ - code_eval
60
+ library_name: transformers
61
+ tags:
62
+ - code
63
+ - granite
64
+ model-index:
65
+ - name: granite-8B-code-base-128k
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: 43.1
76
+ verified: false
77
+ - task:
78
+ type: text-generation
79
+ dataset:
80
+ type: bigcode/humanevalpack
81
+ name: HumanEvalSynthesis (Average)
82
+ metrics:
83
+ - name: pass@1
84
+ type: pass@1
85
+ value: 40.2
86
+ verified: false
87
+ - task:
88
+ type: text-generation
89
+ dataset:
90
+ type: bigcode/humanevalpack
91
+ name: HumanEvalExplain (Average)
92
+ metrics:
93
+ - name: pass@1
94
+ type: pass@1
95
+ value: 28.2
96
+ verified: false
97
+ - task:
98
+ type: text-generation
99
+ dataset:
100
+ type: bigcode/humanevalpack
101
+ name: HumanEvalFix (Average)
102
+ metrics:
103
+ - name: pass@1
104
+ type: pass@1
105
+ value: 25.2
106
+ verified: false
107
+ - task:
108
+ type: text-generation
109
+ dataset:
110
+ type: repoqa
111
+ name: RepoQA (Python@16K)
112
+ metrics:
113
+ - name: pass@1 (thresh=0.5)
114
+ type: pass@1 (thresh=0.5)
115
+ value: 48.0
116
+ verified: false
117
+ - task:
118
+ type: text-generation
119
+ dataset:
120
+ type: repoqa
121
+ name: RepoQA (C++@16K)
122
+ metrics:
123
+ - name: pass@1 (thresh=0.5)
124
+ type: pass@1 (thresh=0.5)
125
+ value: 36.0
126
+ verified: false
127
+ - task:
128
+ type: text-generation
129
+ dataset:
130
+ type: repoqa
131
+ name: RepoQA (Java@16K)
132
+ metrics:
133
+ - name: pass@1 (thresh=0.5)
134
+ type: pass@1 (thresh=0.5)
135
+ value: 38.0
136
+ verified: false
137
+ - task:
138
+ type: text-generation
139
+ dataset:
140
+ type: repoqa
141
+ name: RepoQA (TypeScript@16K)
142
+ metrics:
143
+ - name: pass@1 (thresh=0.5)
144
+ type: pass@1 (thresh=0.5)
145
+ value: 39.0
146
+ verified: false
147
+ - task:
148
+ type: text-generation
149
+ dataset:
150
+ type: repoqa
151
+ name: RepoQA (Rust@16K)
152
+ metrics:
153
+ - name: pass@1 (thresh=0.5)
154
+ type: pass@1 (thresh=0.5)
155
+ value: 29.0
156
+ verified: false
157
+ - task:
158
+ type: text-generation
159
+ dataset:
160
+ type: lcc
161
+ name: LCC (Balanced)
162
+ metrics:
163
+ - name: Exact Match@4K
164
+ type: Exact Match@4K
165
+ value: 56.5
166
+ verified: false
167
+ - task:
168
+ type: text-generation
169
+ dataset:
170
+ type: lcc
171
+ name: LCC (Balanced)
172
+ metrics:
173
+ - name: Exact Match@8K
174
+ type: Exact Match@8K
175
+ value: 60.1
176
+ verified: false
177
+ - task:
178
+ type: text-generation
179
+ dataset:
180
+ type: lcc
181
+ name: LCC (Balanced)
182
+ metrics:
183
+ - name: Exact Match@16K
184
+ type: Exact Match@16K
185
+ value: 51.8
186
+ verified: false
187
+ - task:
188
+ type: text-generation
189
+ dataset:
190
+ type: lcc
191
+ name: LCC (Balanced)
192
+ metrics:
193
+ - name: Exact Match@32K
194
+ type: Exact Match@32K
195
+ value: 57.4
196
+ verified: false
197
+ - task:
198
+ type: text-generation
199
+ dataset:
200
+ type: repobench
201
+ name: RepoBench-P (Balanced)
202
+ metrics:
203
+ - name: Exact Match@4K
204
+ type: Exact Match@4K
205
+ value: 42.7
206
+ verified: false
207
+ - task:
208
+ type: text-generation
209
+ dataset:
210
+ type: repobench
211
+ name: RepoBench-P (Balanced)
212
+ metrics:
213
+ - name: Exact Match@8K
214
+ type: Exact Match@8K
215
+ value: 44.0
216
+ verified: false
217
+ - task:
218
+ type: text-generation
219
+ dataset:
220
+ type: repobench
221
+ name: RepoBench-P (Balanced)
222
+ metrics:
223
+ - name: Exact Match@16K
224
+ type: Exact Match@16K
225
+ value: 44.8
226
+ verified: false
227
+ - task:
228
+ type: text-generation
229
+ dataset:
230
+ type: repobench
231
+ name: RepoBench-Pn(Balanced)
232
+ metrics:
233
+ - name: Exact Match@32K
234
+ type: Exact Match@32K
235
+ value: 44.5
236
+ verified: false
237
+ ---
238
+
239
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/62cd5057674cdb524450093d/1hzxoPwqkBJXshKVVe6_9.png)
240
+
241
+ # Granite-8B-Code-Base-128K
242
+
243
+ ## Model Summary
244
+ **Granite-8B-Code-Base-128K** extends the context length of Granite-8B-Code-Base from 4K to 128K with continual pretraining using the original training data but with repository-level file packing and per-language length upsampling, that we found to be critical for long-context pretraining.
245
+ We adopt an progressive training strategy where we doubled the context window until it reached the desired length of 128K by appropriately adjusting RoPE theta. We trained on 4B tokens total for all stages, which is only 0.1% of Granite-8B-Code-Base's original pre-training data.
246
+
247
+ - **Developers:** IBM Research
248
+ - **GitHub Repository:** [ibm-granite/granite-code-models](https://github.com/ibm-granite/granite-code-models)
249
+ - **Paper:** [Scaling Granite Code Models to 128K Context](https://arxiv.org/abs/2405.04324)
250
+ - **Release Date**: July 18th, 2024
251
+ - **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0).
252
+
253
+ ## Usage
254
+ ### Intended use
255
+ Prominent enterprise use cases of LLMs in software engineering productivity with 128K context length support that includes 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 **3B parameter model**, are able to handle these tasks as they were trained on a large amount of code data from 116 programming languages.
256
+
257
+ ### Generation
258
+ This is a simple example of how to use **Granite-8B-Code-Base-128K** model.
259
+
260
+ ```python
261
+ import torch
262
+ from transformers import AutoModelForCausalLM, AutoTokenizer
263
+ device = "cuda" # or "cpu"
264
+ model_path = "ibm-granite/granite-8B-code-base-128K"
265
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
266
+ # drop device_map if running on CPU
267
+ model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
268
+ model.eval()
269
+ # change input text as desired
270
+ input_text = "def generate():"
271
+ # tokenize the text
272
+ input_tokens = tokenizer(input_text, return_tensors="pt")
273
+ # transfer tokenized inputs to the device
274
+ for i in input_tokens:
275
+ input_tokens[i] = input_tokens[i].to(device)
276
+ # generate output tokens
277
+ output = model.generate(**input_tokens)
278
+ # decode output tokens into text
279
+ output = tokenizer.batch_decode(output)
280
+ # loop over the batch to print, in this example the batch size is 1
281
+ for i in output:
282
+ print(i)
283
+ ```
284
+
285
+ ## Training Data
286
+ Starting from the base Granite model, this model was further pretrained on repository-level code data with per-language context-length oversampling, allowing it to effectively utilize up to 128K tokens of context. This continued training stage focused on a curated selection of programming languages, such as Python, C, C++, Go, Java, JavaScript, and TypeScript.
287
+
288
+ ## Infrastructure
289
+ 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.
290
+
291
+ ## Ethical Considerations and Limitations
292
+ 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-8B-code-Base-128K** 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-8B-Code-Base-128K** model with ethical intentions and in a responsible way. 
293
+
294
+
295
+