munish0838
commited on
Commit
•
612bcec
1
Parent(s):
4362cba
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
---
|
3 |
+
|
4 |
+
pipeline_tag: text-generation
|
5 |
+
inference: false
|
6 |
+
license: apache-2.0
|
7 |
+
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
|
16 |
+
- bigcode/self-oss-instruct-sc2-exec-filter-50k
|
17 |
+
metrics:
|
18 |
+
- code_eval
|
19 |
+
library_name: transformers
|
20 |
+
tags:
|
21 |
+
- code
|
22 |
+
- granite
|
23 |
+
model-index:
|
24 |
+
- name: granite-8B-Code-instruct-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: 62.2
|
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: 51.4
|
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: 38.9
|
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: 38.3
|
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: 73.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: 37.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: 73.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: 62.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: 63.0
|
115 |
+
verified: false
|
116 |
+
|
117 |
+
---
|
118 |
+
|
119 |
+
![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeiuCm7c8lEwEJuRey9kiVZsRn2W-b4pWlu3-X534V3YmVuVc2ZL-NXg2RkzSOOS2JXGHutDuyyNAUtdJI65jGTo8jT9Y99tMi4H4MqL44Uc5QKG77B0d6-JfIkZHFaUA71-RtjyYZWVIhqsNZcx8-OMaA?key=xt3VSDoCbmTY7o-cwwOFwQ)
|
120 |
+
|
121 |
+
# QuantFactory/granite-8b-code-instruct-128k-GGUF
|
122 |
+
This is quantized version of [ibm-granite/granite-8b-code-instruct-128k](https://huggingface.co/ibm-granite/granite-8b-code-instruct-128k) created using llama.cpp
|
123 |
+
|
124 |
+
# Original Model Card
|
125 |
+
|
126 |
+
|
127 |
+
|
128 |
+
![image/png](https://cdn-uploads.huggingface.co/production/uploads/62cd5057674cdb524450093d/1hzxoPwqkBJXshKVVe6_9.png)
|
129 |
+
|
130 |
+
# Granite-8B-Code-Instruct-128K
|
131 |
+
|
132 |
+
## Model Summary
|
133 |
+
**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.
|
134 |
+
|
135 |
+
- **Developers:** IBM Research
|
136 |
+
- **GitHub Repository:** [ibm-granite/granite-code-models](https://github.com/ibm-granite/granite-code-models)
|
137 |
+
- **Paper:** [Scaling Granite Code Models to 128K Context](https://arxiv.org/abs/2407.13739)
|
138 |
+
- **Release Date**: July 18th, 2024
|
139 |
+
- **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0).
|
140 |
+
|
141 |
+
## Usage
|
142 |
+
### Intended use
|
143 |
+
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.
|
144 |
+
|
145 |
+
<!-- TO DO: Check starcoder2 instruct code example that includes the template https://huggingface.co/bigcode/starcoder2-15b-instruct-v0.1 -->
|
146 |
+
|
147 |
+
### Generation
|
148 |
+
This is a simple example of how to use **Granite-8B-Code-Instruct** model.
|
149 |
+
|
150 |
+
```python
|
151 |
+
import torch
|
152 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
153 |
+
device = "cuda" # or "cpu"
|
154 |
+
model_path = "ibm-granite/granite-8B-Code-instruct-128k"
|
155 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
156 |
+
# drop device_map if running on CPU
|
157 |
+
model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
|
158 |
+
model.eval()
|
159 |
+
# change input text as desired
|
160 |
+
chat = [
|
161 |
+
{ "role": "user", "content": "Write a code to find the maximum value in a list of numbers." },
|
162 |
+
]
|
163 |
+
chat = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
|
164 |
+
# tokenize the text
|
165 |
+
input_tokens = tokenizer(chat, return_tensors="pt")
|
166 |
+
# transfer tokenized inputs to the device
|
167 |
+
for i in input_tokens:
|
168 |
+
input_tokens[i] = input_tokens[i].to(device)
|
169 |
+
# generate output tokens
|
170 |
+
output = model.generate(**input_tokens, max_new_tokens=100)
|
171 |
+
# decode output tokens into text
|
172 |
+
output = tokenizer.batch_decode(output)
|
173 |
+
# loop over the batch to print, in this example the batch size is 1
|
174 |
+
for i in output:
|
175 |
+
print(i)
|
176 |
+
```
|
177 |
+
|
178 |
+
<!-- TO DO: Check this part -->
|
179 |
+
## Training Data
|
180 |
+
Granite Code Instruct models are trained on a mix of short and long context data as follows.
|
181 |
+
* 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.
|
182 |
+
* 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.
|
183 |
+
|
184 |
+
## Infrastructure
|
185 |
+
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.
|
186 |
+
|
187 |
+
## Ethical Considerations and Limitations
|
188 |
+
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.
|
189 |
+
|