amezasor commited on
Commit
3883326
1 Parent(s): cdea53c

First commit Granite-20B-Code-Instruct

Browse files
Files changed (1) hide show
  1. README.md +275 -0
README.md ADDED
@@ -0,0 +1,275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pipeline_tag: text-generation
3
+ base_model: ibm-granite/granite-20b-code-base
4
+ inference: true
5
+ license: apache-2.0
6
+ datasets:
7
+ # Finetuning datasets
8
+ - bigcode/commitpackft
9
+ - TIGER-Lab/MathInstruct
10
+ - meta-math/MetaMathQA
11
+ - glaiveai/glaive-code-assistant-v3
12
+ - glaive-function-calling-v2
13
+ - bugdaryan/sql-create-context-instruction
14
+ - garage-bAInd/Open-Platypus
15
+ - nvidia/HelpSteer # was it used for pretraing and finetuning?
16
+ metrics:
17
+ - code_eval
18
+ library_name: transformers
19
+ tags:
20
+ - code
21
+ model-index:
22
+ - name: granite-20b-code-instruct
23
+ results:
24
+ - task:
25
+ type: text-generation
26
+ dataset:
27
+ type: bigcode/humanevalpack
28
+ name: HumanEvalSynthesis(Python)
29
+ metrics:
30
+ - name: pass@1
31
+ type: pass@1
32
+ value: 60.4
33
+ veriefied: false # Check
34
+ - task:
35
+ type: text-generation
36
+ dataset:
37
+ type: bigcode/humanevalpack
38
+ name: HumanEvalSynthesis(JavaScript)
39
+ metrics:
40
+ - name: pass@1
41
+ type: pass@1
42
+ value: 53.7
43
+ veriefied: false # Check
44
+ - task:
45
+ type: text-generation
46
+ dataset:
47
+ type: bigcode/humanevalpack
48
+ name: HumanEvalSynthesis(Java)
49
+ metrics:
50
+ - name: pass@1
51
+ type: pass@1
52
+ value: 58.5
53
+ veriefied: false # Check
54
+ - task:
55
+ type: text-generation
56
+ dataset:
57
+ type: bigcode/humanevalpack
58
+ name: HumanEvalSynthesis(Go)
59
+ metrics:
60
+ - name: pass@1
61
+ type: pass@1
62
+ value: 42.1
63
+ veriefied: false # Check
64
+ - task:
65
+ type: text-generation
66
+ dataset:
67
+ type: bigcode/humanevalpack
68
+ name: HumanEvalSynthesis(C++)
69
+ metrics:
70
+ - name: pass@1
71
+ type: pass@1
72
+ value: 45.7
73
+ veriefied: false # Check
74
+ - task:
75
+ type: text-generation
76
+ dataset:
77
+ type: bigcode/humanevalpack
78
+ name: HumanEvalSynthesis(Rust)
79
+ metrics:
80
+ - name: pass@1
81
+ type: pass@1
82
+ value: 42.7
83
+ veriefied: false # Check
84
+ - task:
85
+ type: text-generation
86
+ dataset:
87
+ type: bigcode/humanevalpack
88
+ name: HumanEvalExplain(Python)
89
+ metrics:
90
+ - name: pass@1
91
+ type: pass@1
92
+ value: 44.5
93
+ veriefied: false # Check
94
+ - task:
95
+ type: text-generation
96
+ dataset:
97
+ type: bigcode/humanevalpack
98
+ name: HumanEvalExplain(JavaScript)
99
+ metrics:
100
+ - name: pass@1
101
+ type: pass@1
102
+ value: 42.7
103
+ veriefied: false # Check
104
+ - task:
105
+ type: text-generation
106
+ dataset:
107
+ type: bigcode/humanevalpack
108
+ name: HumanEvalExplain(Java)
109
+ metrics:
110
+ - name: pass@1
111
+ type: pass@1
112
+ value: 49.4
113
+ veriefied: false # Check
114
+ - task:
115
+ type: text-generation
116
+ dataset:
117
+ type: bigcode/humanevalpack
118
+ name: HumanEvalExplain(Go)
119
+ metrics:
120
+ - name: pass@1
121
+ type: pass@1
122
+ value: 32.3
123
+ veriefied: false # Check
124
+ - task:
125
+ type: text-generation
126
+ dataset:
127
+ type: bigcode/humanevalpack
128
+ name: HumanEvalExplain(C++)
129
+ metrics:
130
+ - name: pass@1
131
+ type: pass@1
132
+ value: 42.1
133
+ veriefied: false # Check
134
+ - task:
135
+ type: text-generation
136
+ dataset:
137
+ type: bigcode/humanevalpack
138
+ name: HumanEvalExplain(Rust)
139
+ metrics:
140
+ - name: pass@1
141
+ type: pass@1
142
+ value: 18.3
143
+ veriefied: false # Check
144
+ - task:
145
+ type: text-generation
146
+ dataset:
147
+ type: bigcode/humanevalpack
148
+ name: HumanEvalFix(Python)
149
+ metrics:
150
+ - name: pass@1
151
+ type: pass@1
152
+ value: 43.9
153
+ veriefied: false # Check
154
+ - task:
155
+ type: text-generation
156
+ dataset:
157
+ type: bigcode/humanevalpack
158
+ name: HumanEvalFix(JavaScript)
159
+ metrics:
160
+ - name: pass@1
161
+ type: pass@1
162
+ value: 43.9
163
+ veriefied: false # Check
164
+ - task:
165
+ type: text-generation
166
+ dataset:
167
+ type: bigcode/humanevalpack
168
+ name: HumanEvalFix(Java)
169
+ metrics:
170
+ - name: pass@1
171
+ type: pass@1
172
+ value: 45.7
173
+ veriefied: false # Check
174
+ - task:
175
+ type: text-generation
176
+ dataset:
177
+ type: bigcode/humanevalpack
178
+ name: HumanEvalFix(Go)
179
+ metrics:
180
+ - name: pass@1
181
+ type: pass@1
182
+ value: 41.5
183
+ veriefied: false # Check
184
+ - task:
185
+ type: text-generation
186
+ dataset:
187
+ type: bigcode/humanevalpack
188
+ name: HumanEvalFix(C++)
189
+ metrics:
190
+ - name: pass@1
191
+ type: pass@1
192
+ value: 41.5
193
+ veriefied: false # Check
194
+ - task:
195
+ type: text-generation
196
+ dataset:
197
+ type: bigcode/humanevalpack
198
+ name: HumanEvalFix(Rust)
199
+ metrics:
200
+ - name: pass@1
201
+ type: pass@1
202
+ value: 29.9
203
+ veriefied: false # Check
204
+ ---
205
+ # Granite-20B-Code-Instruct
206
+
207
+ ## Model Summary
208
+ **Granite-20B-Code-Instruct** is a 20B parameter model fine tuned from *Granite-20B-Code-Base* on a combination of **permissively licensed** instruction data to enhance instruction following capabilities including logical reasoning and problem-solving skills.
209
+
210
+ - **Developers:** IBM Research
211
+ - **GitHub Repository:** [ibm-granite/granite-code-models](https://github.com/ibm-granite/granite-code-models)
212
+ - **Paper:** [Granite Code Models: A Family of Open Foundation Models
213
+ for Code Intelligence](https://)
214
+ - **Release Date**: May 6th, 2024
215
+ - **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0).
216
+
217
+ ## Usage
218
+ ### Intended use
219
+ The model is designed to respond to coding related instructions and can be used to build coding assitants.
220
+
221
+ <!-- TO DO: Check starcoder2 instruct code example that includes the template https://huggingface.co/bigcode/starcoder2-15b-instruct-v0.1 -->
222
+
223
+ ### Generation
224
+ This is a simple example of how to use **Granite-20B-Code-Instruct** model.
225
+
226
+ ```python
227
+ import torch
228
+ from transformers import AutoModelForCausalLM, AutoTokenizer
229
+ device = "cuda" # or "cpu"
230
+ model_path = "ibm-granite/granite-20b-code-instruct"
231
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
232
+ # drop device_map if running on CPU
233
+ model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
234
+ model.eval()
235
+ # change input text as desired
236
+ input_text = "Write a code to find the maximum value in a list of numbers. The list can contain both positive and negative numbers, and the maximum value can be either a positive or negative number."
237
+ # tokenize the text
238
+ input_tokens = tokenizer(input_text, return_tensors="pt")
239
+ # transfer tokenized inputs to the device
240
+ for i in input_tokens:
241
+ input_tokens[i] = input_tokens[i].to(device)
242
+ # generate output tokens
243
+ output = model.generate(**input_tokens)
244
+ # decode output tokens into text
245
+ output = tokenizer.batch_decode(output)
246
+ # loop over the batch to print, in this example the batch size is 1
247
+ for i in output:
248
+ print(output)
249
+ ```
250
+
251
+ <!-- TO DO: Check this part -->
252
+ ## Training Data
253
+ Granite Code Instruct models are trained on the following types of data.
254
+ * 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-20B-Code-Base*).
255
+ * 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.
256
+ * 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.
257
+ * 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.
258
+
259
+ ## Infrastructure
260
+ 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.
261
+
262
+ ## Ethical Considerations and Limitations
263
+ 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-20B-Code-Base](https://huggingface.co/ibm-granite/granite-20b-code-base)* model card.
264
+
265
+ ## Citation
266
+ ```
267
+ @misc{granite-models,
268
+ author = {author 1, author2, ...},
269
+ title = {Granite Code Large Language Models: IBM Foundation Models for Code},
270
+ journal = {},
271
+ volume = {},
272
+ year = {2024},
273
+ url = {https://arxiv.org/abs/0000.00000},
274
+ }
275
+ ```