Text Generation
Transformers
GGUF
code
granite
Eval Results
munish0838 commited on
Commit
9ca050f
1 Parent(s): 0fb69a3

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +261 -0
README.md ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ---
3
+
4
+ pipeline_tag: text-generation
5
+ inference: false
6
+ license: apache-2.0
7
+ datasets:
8
+ - codeparrot/github-code-clean
9
+ - bigcode/starcoderdata
10
+ # - Stackexchange
11
+ # - CommonCrawl
12
+ - open-web-math/open-web-math
13
+ - math-ai/StackMathQA
14
+ # - Arxiv
15
+ # - Wikipedia
16
+ # - conceptofmind/FLAN_2022 # Original link is broken, we used IBM's filtered version
17
+ metrics:
18
+ - code_eval
19
+ library_name: transformers
20
+ tags:
21
+ - code
22
+ - granite
23
+ model-index:
24
+ - name: granite-3b-code-base-128k
25
+ results:
26
+ - task:
27
+ type: text-generation
28
+ dataset:
29
+ type: bigcode/humanevalpack
30
+ name: HumanEvalSynthesis (Python)
31
+ metrics:
32
+ - name: pass@1
33
+ type: pass@1
34
+ value: 36.0
35
+ verified: false
36
+ - task:
37
+ type: text-generation
38
+ dataset:
39
+ type: bigcode/humanevalpack
40
+ name: HumanEvalSynthesis (Average)
41
+ metrics:
42
+ - name: pass@1
43
+ type: pass@1
44
+ value: 30.5
45
+ verified: false
46
+ - task:
47
+ type: text-generation
48
+ dataset:
49
+ type: bigcode/humanevalpack
50
+ name: HumanEvalExplain (Average)
51
+ metrics:
52
+ - name: pass@1
53
+ type: pass@1
54
+ value: 22.4
55
+ verified: false
56
+ - task:
57
+ type: text-generation
58
+ dataset:
59
+ type: bigcode/humanevalpack
60
+ name: HumanEvalFix (Average)
61
+ metrics:
62
+ - name: pass@1
63
+ type: pass@1
64
+ value: 19.9
65
+ verified: false
66
+ - task:
67
+ type: text-generation
68
+ dataset:
69
+ type: repoqa
70
+ name: RepoQA (Python@16K)
71
+ metrics:
72
+ - name: pass@1 (thresh=0.5)
73
+ type: pass@1 (thresh=0.5)
74
+ value: 40.0
75
+ verified: false
76
+ - task:
77
+ type: text-generation
78
+ dataset:
79
+ type: repoqa
80
+ name: RepoQA (C++@16K)
81
+ metrics:
82
+ - name: pass@1 (thresh=0.5)
83
+ type: pass@1 (thresh=0.5)
84
+ value: 36.0
85
+ verified: false
86
+ - task:
87
+ type: text-generation
88
+ dataset:
89
+ type: repoqa
90
+ name: RepoQA (Java@16K)
91
+ metrics:
92
+ - name: pass@1 (thresh=0.5)
93
+ type: pass@1 (thresh=0.5)
94
+ value: 37.0
95
+ verified: false
96
+ - task:
97
+ type: text-generation
98
+ dataset:
99
+ type: repoqa
100
+ name: RepoQA (TypeScript@16K)
101
+ metrics:
102
+ - name: pass@1 (thresh=0.5)
103
+ type: pass@1 (thresh=0.5)
104
+ value: 27.0
105
+ verified: false
106
+ - task:
107
+ type: text-generation
108
+ dataset:
109
+ type: repoqa
110
+ name: RepoQA (Rust@16K)
111
+ metrics:
112
+ - name: pass@1 (thresh=0.5)
113
+ type: pass@1 (thresh=0.5)
114
+ value: 29.0
115
+ verified: false
116
+ - task:
117
+ type: text-generation
118
+ dataset:
119
+ type: lcc
120
+ name: LCC (Balanced)
121
+ metrics:
122
+ - name: Exact Match@4K
123
+ type: Exact Match@4K
124
+ value: 54.6
125
+ verified: false
126
+ - task:
127
+ type: text-generation
128
+ dataset:
129
+ type: lcc
130
+ name: LCC (Balanced)
131
+ metrics:
132
+ - name: Exact Match@8K
133
+ type: Exact Match@8K
134
+ value: 56.8
135
+ verified: false
136
+ - task:
137
+ type: text-generation
138
+ dataset:
139
+ type: lcc
140
+ name: LCC (Balanced)
141
+ metrics:
142
+ - name: Exact Match@16K
143
+ type: Exact Match@16K
144
+ value: 52.2
145
+ verified: false
146
+ - task:
147
+ type: text-generation
148
+ dataset:
149
+ type: lcc
150
+ name: LCC (Balanced)
151
+ metrics:
152
+ - name: Exact Match@32K
153
+ type: Exact Match@32K
154
+ value: 57.8
155
+ verified: false
156
+ - task:
157
+ type: text-generation
158
+ dataset:
159
+ type: repobench
160
+ name: RepoBench-P (Balanced)
161
+ metrics:
162
+ - name: Exact Match@4K
163
+ type: Exact Match@4K
164
+ value: 39.8
165
+ verified: false
166
+ - task:
167
+ type: text-generation
168
+ dataset:
169
+ type: repobench
170
+ name: RepoBench-P (Balanced)
171
+ metrics:
172
+ - name: Exact Match@8K
173
+ type: Exact Match@8K
174
+ value: 46.8
175
+ verified: false
176
+ - task:
177
+ type: text-generation
178
+ dataset:
179
+ type: repobench
180
+ name: RepoBench-P (Balanced)
181
+ metrics:
182
+ - name: Exact Match@16K
183
+ type: Exact Match@16K
184
+ value: 43.1
185
+ verified: false
186
+ - task:
187
+ type: text-generation
188
+ dataset:
189
+ type: repobench
190
+ name: RepoBench-Pn(Balanced)
191
+ metrics:
192
+ - name: Exact Match@32K
193
+ type: Exact Match@32K
194
+ value: 45.3
195
+ verified: false
196
+
197
+ ---
198
+
199
+ ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeiuCm7c8lEwEJuRey9kiVZsRn2W-b4pWlu3-X534V3YmVuVc2ZL-NXg2RkzSOOS2JXGHutDuyyNAUtdJI65jGTo8jT9Y99tMi4H4MqL44Uc5QKG77B0d6-JfIkZHFaUA71-RtjyYZWVIhqsNZcx8-OMaA?key=xt3VSDoCbmTY7o-cwwOFwQ)
200
+
201
+ # QuantFactory/granite-3b-code-base-128k-GGUF
202
+ This is quantized version of [ibm-granite/granite-3b-code-base-128k](https://huggingface.co/ibm-granite/granite-3b-code-base-128k) created using llama.cpp
203
+
204
+ # Original Model Card
205
+
206
+
207
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/62cd5057674cdb524450093d/1hzxoPwqkBJXshKVVe6_9.png)
208
+
209
+ # Granite-3B-Code-Base-128K
210
+
211
+ ## Model Summary
212
+ **Granite-3B-Code-Base-128K** extends the context length of Granite-3B-Code-Base from 2K 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.
213
+ 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-3B-Code-Base's original pre-training data.
214
+
215
+ - **Developers:** IBM Research
216
+ - **GitHub Repository:** [ibm-granite/granite-code-models](https://github.com/ibm-granite/granite-code-models)
217
+ - **Paper:** [Scaling Granite Code Models to 128K Context](https://arxiv.org/abs/2405.04324)
218
+ - **Release Date**: July 18th, 2024
219
+ - **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0).
220
+
221
+ ## Usage
222
+ ### Intended use
223
+ 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.
224
+
225
+ ### Generation
226
+ This is a simple example of how to use **Granite-3B-Code-Base-128K** model.
227
+
228
+ ```python
229
+ import torch
230
+ from transformers import AutoModelForCausalLM, AutoTokenizer
231
+ device = "cuda" # or "cpu"
232
+ model_path = "ibm-granite/granite-3b-code-base-128k"
233
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
234
+ # drop device_map if running on CPU
235
+ model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
236
+ model.eval()
237
+ # change input text as desired
238
+ input_text = "def generate():"
239
+ # tokenize the text
240
+ input_tokens = tokenizer(input_text, return_tensors="pt")
241
+ # transfer tokenized inputs to the device
242
+ for i in input_tokens:
243
+ input_tokens[i] = input_tokens[i].to(device)
244
+ # generate output tokens
245
+ output = model.generate(**input_tokens)
246
+ # decode output tokens into text
247
+ output = tokenizer.batch_decode(output)
248
+ # loop over the batch to print, in this example the batch size is 1
249
+ for i in output:
250
+ print(i)
251
+ ```
252
+
253
+ ## Training Data
254
+ 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.
255
+
256
+ ## Infrastructure
257
+ 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.
258
+
259
+ ## Ethical Considerations and Limitations
260
+ 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-3B-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-3B-Code-Base-128K** model with ethical intentions and in a responsible way. 
261
+