rpand002 commited on
Commit
7f1dc0e
·
verified ·
1 Parent(s): 8fdde18

update readme

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