RichardErkhov commited on
Commit
4f11382
·
verified ·
1 Parent(s): 4fb586a

uploaded readme

Browse files
Files changed (1) hide show
  1. README.md +222 -0
README.md ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-instruct-128k - GGUF
11
+ - Model creator: https://huggingface.co/ibm-granite/
12
+ - Original model: https://huggingface.co/ibm-granite/granite-8b-code-instruct-128k/
13
+
14
+
15
+ | Name | Quant method | Size |
16
+ | ---- | ---- | ---- |
17
+ | [granite-8b-code-instruct-128k.Q2_K.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.Q2_K.gguf) | Q2_K | 2.85GB |
18
+ | [granite-8b-code-instruct-128k.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.IQ3_XS.gguf) | IQ3_XS | 3.15GB |
19
+ | [granite-8b-code-instruct-128k.IQ3_S.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.IQ3_S.gguf) | IQ3_S | 3.32GB |
20
+ | [granite-8b-code-instruct-128k.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.Q3_K_S.gguf) | Q3_K_S | 3.3GB |
21
+ | [granite-8b-code-instruct-128k.IQ3_M.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.IQ3_M.gguf) | IQ3_M | 3.43GB |
22
+ | [granite-8b-code-instruct-128k.Q3_K.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.Q3_K.gguf) | Q3_K | 3.67GB |
23
+ | [granite-8b-code-instruct-128k.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.Q3_K_M.gguf) | Q3_K_M | 3.67GB |
24
+ | [granite-8b-code-instruct-128k.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.Q3_K_L.gguf) | Q3_K_L | 3.99GB |
25
+ | [granite-8b-code-instruct-128k.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.IQ4_XS.gguf) | IQ4_XS | 4.1GB |
26
+ | [granite-8b-code-instruct-128k.Q4_0.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.Q4_0.gguf) | Q4_0 | 4.28GB |
27
+ | [granite-8b-code-instruct-128k.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.IQ4_NL.gguf) | IQ4_NL | 4.32GB |
28
+ | [granite-8b-code-instruct-128k.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.Q4_K_S.gguf) | Q4_K_S | 4.3GB |
29
+ | [granite-8b-code-instruct-128k.Q4_K.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.Q4_K.gguf) | Q4_K | 4.55GB |
30
+ | [granite-8b-code-instruct-128k.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.Q4_K_M.gguf) | Q4_K_M | 4.55GB |
31
+ | [granite-8b-code-instruct-128k.Q4_1.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.Q4_1.gguf) | Q4_1 | 4.73GB |
32
+ | [granite-8b-code-instruct-128k.Q5_0.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.Q5_0.gguf) | Q5_0 | 5.19GB |
33
+ | [granite-8b-code-instruct-128k.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.Q5_K_S.gguf) | Q5_K_S | 5.19GB |
34
+ | [granite-8b-code-instruct-128k.Q5_K.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.Q5_K.gguf) | Q5_K | 5.33GB |
35
+ | [granite-8b-code-instruct-128k.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.Q5_K_M.gguf) | Q5_K_M | 5.33GB |
36
+ | [granite-8b-code-instruct-128k.Q5_1.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.Q5_1.gguf) | Q5_1 | 5.65GB |
37
+ | [granite-8b-code-instruct-128k.Q6_K.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-128k.Q6_K.gguf) | Q6_K | 6.16GB |
38
+ | [granite-8b-code-instruct-128k.Q8_0.gguf](https://huggingface.co/RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf/blob/main/granite-8b-code-instruct-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
+ - bigcode/commitpackft
50
+ - TIGER-Lab/MathInstruct
51
+ - meta-math/MetaMathQA
52
+ - glaiveai/glaive-code-assistant-v3
53
+ - glaive-function-calling-v2
54
+ - bugdaryan/sql-create-context-instruction
55
+ - garage-bAInd/Open-Platypus
56
+ - nvidia/HelpSteer
57
+ - bigcode/self-oss-instruct-sc2-exec-filter-50k
58
+ metrics:
59
+ - code_eval
60
+ library_name: transformers
61
+ tags:
62
+ - code
63
+ - granite
64
+ model-index:
65
+ - name: granite-8B-Code-instruct-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: 62.2
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: 51.4
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: 38.9
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: 38.3
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: 73.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: 37.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: 73.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: 62.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: 63.0
156
+ verified: false
157
+ ---
158
+
159
+
160
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/62cd5057674cdb524450093d/1hzxoPwqkBJXshKVVe6_9.png)
161
+
162
+ # Granite-8B-Code-Instruct-128K
163
+
164
+ ## Model Summary
165
+ **Granite-8B-Code-Instruct-128K** is a 8B parameter long-context instruct model fine tuned from *Granite-8B-Code-Base-128K* on a combination of **permissively licensed** data used in training the original Granite code instruct models, in addition to synthetically generated code instruction datasets tailored for solving long context problems. By exposing the model to both short and long context data, we aim to enhance its long-context capability without sacrificing code generation performance at short input context.
166
+
167
+ - **Developers:** IBM Research
168
+ - **GitHub Repository:** [ibm-granite/granite-code-models](https://github.com/ibm-granite/granite-code-models)
169
+ - **Paper:** [Scaling Granite Code Models to 128K Context](https://arxiv.org/abs/2407.13739)
170
+ - **Release Date**: July 18th, 2024
171
+ - **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0).
172
+
173
+ ## Usage
174
+ ### Intended use
175
+ The model is designed to respond to coding related instructions over long-conext input up to 128K length and can be used to build coding assistants.
176
+
177
+ <!-- TO DO: Check starcoder2 instruct code example that includes the template https://huggingface.co/bigcode/starcoder2-15b-instruct-v0.1 -->
178
+
179
+ ### Generation
180
+ This is a simple example of how to use **Granite-8B-Code-Instruct** model.
181
+
182
+ ```python
183
+ import torch
184
+ from transformers import AutoModelForCausalLM, AutoTokenizer
185
+ device = "cuda" # or "cpu"
186
+ model_path = "ibm-granite/granite-8B-Code-instruct-128k"
187
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
188
+ # drop device_map if running on CPU
189
+ model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
190
+ model.eval()
191
+ # change input text as desired
192
+ chat = [
193
+ { "role": "user", "content": "Write a code to find the maximum value in a list of numbers." },
194
+ ]
195
+ chat = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
196
+ # tokenize the text
197
+ input_tokens = tokenizer(chat, return_tensors="pt")
198
+ # transfer tokenized inputs to the device
199
+ for i in input_tokens:
200
+ input_tokens[i] = input_tokens[i].to(device)
201
+ # generate output tokens
202
+ output = model.generate(**input_tokens, max_new_tokens=100)
203
+ # decode output tokens into text
204
+ output = tokenizer.batch_decode(output)
205
+ # loop over the batch to print, in this example the batch size is 1
206
+ for i in output:
207
+ print(i)
208
+ ```
209
+
210
+ <!-- TO DO: Check this part -->
211
+ ## Training Data
212
+ Granite Code Instruct models are trained on a mix of short and long context data as follows.
213
+ * Short-Context Instruction Data: [CommitPackFT](https://huggingface.co/datasets/bigcode/commitpackft), [BigCode-SC2-Instruct](bigcode/self-oss-instruct-sc2-exec-filter-50k), [MathInstruct](https://huggingface.co/datasets/TIGER-Lab/MathInstruct), [MetaMathQA](https://huggingface.co/datasets/meta-math/MetaMathQA), [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), [HelpSteer](https://huggingface.co/datasets/nvidia/HelpSteer), [OpenPlatypus](https://huggingface.co/datasets/garage-bAInd/Open-Platypus) including a synthetically generated dataset for API calling and multi-turn code interactions with execution feedback. We also include a collection of hardcoded prompts to ensure our model generates correct outputs given inquiries about its name or developers.
214
+ * Long-Context Instruction Data: A synthetically-generated dataset by bootstrapping the repository-level file-packed documents through Granite-8b-Code-Instruct to improve long-context capability of the model.
215
+
216
+ ## Infrastructure
217
+ 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.
218
+
219
+ ## Ethical Considerations and Limitations
220
+ 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-8B-Code-Base-128K](https://huggingface.co/ibm-granite/granite-8B-Code-base-128k)* model card.
221
+
222
+