đ Granite-8B-Code-Instruct-4K
Granite-8B-Code-Instruct-4K is an 8B parameter model fine-tuned from Granite-8B-Code-Base-4K. It's optimized on a combination of permissively licensed instruction data to enhance instruction-following capabilities, including logical reasoning and problem-solving skills.

đ Quick Start
The model is designed to respond to coding-related instructions and can be used to build coding assistants. Here is a simple example of how to use the Granite-8B-Code-Instruct-4K model:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cuda"
model_path = "ibm-granite/granite-8b-code-instruct-4k"
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
model.eval()
chat = [
{ "role": "user", "content": "Write a code to find the maximum value in a list of numbers." },
]
chat = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
input_tokens = tokenizer(chat, return_tensors="pt")
for i in input_tokens:
input_tokens[i] = input_tokens[i].to(device)
output = model.generate(**input_tokens, max_new_tokens=100)
output = tokenizer.batch_decode(output)
for i in output:
print(i)
⨠Features
- Enhanced Instruction Following: Fine-tuned to better follow coding instructions, improving logical reasoning and problem-solving abilities.
- Multilingual Support: Trained on data from 92 programming languages, offering broad language coverage.
đĻ Installation
No specific installation steps were provided in the original README.
đ Documentation
Model Summary
Training Data
Granite Code Instruct models are trained on the following types of data:
Infrastructure
The Granite Code models are trained using two of IBM's supercomputing clusters, Vela and Blue Vela, equipped with NVIDIA A100 and H100 GPUs respectively, providing a scalable and efficient training infrastructure.
Ethical Considerations and Limitations
The model's performance may be limited with out-of-domain programming languages. It's beneficial to provide few-shot examples. Developers should perform safety testing and target-specific tuning before deploying on critical applications. The model also inherits ethical considerations and limitations from its base model. For more information, refer to the Granite-8B-Code-Base-4K model card.
đ§ Technical Details
Model Index
Task Type |
Dataset Type |
Dataset Name |
Metric Name |
Metric Type |
Value |
Verified |
text-generation |
bigcode/humanevalpack |
HumanEvalSynthesis(Python) |
pass@1 |
pass@1 |
57.9 |
false |
text-generation |
bigcode/humanevalpack |
HumanEvalSynthesis(JavaScript) |
pass@1 |
pass@1 |
52.4 |
false |
text-generation |
bigcode/humanevalpack |
HumanEvalSynthesis(Java) |
pass@1 |
pass@1 |
58.5 |
false |
text-generation |
bigcode/humanevalpack |
HumanEvalSynthesis(Go) |
pass@1 |
pass@1 |
43.3 |
false |
text-generation |
bigcode/humanevalpack |
HumanEvalSynthesis(C++) |
pass@1 |
pass@1 |
48.2 |
false |
text-generation |
bigcode/humanevalpack |
HumanEvalSynthesis(Rust) |
pass@1 |
pass@1 |
37.2 |
false |
text-generation |
bigcode/humanevalpack |
HumanEvalExplain(Python) |
pass@1 |
pass@1 |
53.0 |
false |
text-generation |
bigcode/humanevalpack |
HumanEvalExplain(JavaScript) |
pass@1 |
pass@1 |
42.7 |
false |
text-generation |
bigcode/humanevalpack |
HumanEvalExplain(Java) |
pass@1 |
pass@1 |
52.4 |
false |
text-generation |
bigcode/humanevalpack |
HumanEvalExplain(Go) |
pass@1 |
pass@1 |
36.6 |
false |
text-generation |
bigcode/humanevalpack |
HumanEvalExplain(C++) |
pass@1 |
pass@1 |
43.9 |
false |
text-generation |
bigcode/humanevalpack |
HumanEvalExplain(Rust) |
pass@1 |
pass@1 |
16.5 |
false |
text-generation |
bigcode/humanevalpack |
HumanEvalFix(Python) |
pass@1 |
pass@1 |
39.6 |
false |
text-generation |
bigcode/humanevalpack |
HumanEvalFix(JavaScript) |
pass@1 |
pass@1 |
40.9 |
false |
text-generation |
bigcode/humanevalpack |
HumanEvalFix(Java) |
pass@1 |
pass@1 |
48.2 |
false |
text-generation |
bigcode/humanevalpack |
HumanEvalFix(Go) |
pass@1 |
pass@1 |
41.5 |
false |
text-generation |
bigcode/humanevalpack |
HumanEvalFix(C++) |
pass@1 |
pass@1 |
39.0 |
false |
text-generation |
bigcode/humanevalpack |
HumanEvalFix(Rust) |
pass@1 |
pass@1 |
32.9 |
false |
đ License
The model is licensed under the Apache 2.0 license.