初始化项目,由ModelHub XC社区提供模型

Model: RichardErkhov/ibm-granite_-_granite-8b-code-instruct-128k-gguf
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-04-10 11:32:55 +08:00
commit cf0d385bee
24 changed files with 345 additions and 0 deletions

57
.gitattributes vendored Normal file
View File

@@ -0,0 +1,57 @@
*.7z filter=lfs diff=lfs merge=lfs -text
*.arrow filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.ckpt filter=lfs diff=lfs merge=lfs -text
*.ftz filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.mlmodel filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
*.npy filter=lfs diff=lfs merge=lfs -text
*.npz filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.ot filter=lfs diff=lfs merge=lfs -text
*.parquet filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.pickle filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.pt filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.safetensors filter=lfs diff=lfs merge=lfs -text
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.tar.* filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.wasm filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.Q2_K.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.IQ3_XS.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.IQ3_S.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.Q3_K_S.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.IQ3_M.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.Q3_K.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.Q3_K_M.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.Q3_K_L.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.IQ4_XS.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.IQ4_NL.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.Q4_K_S.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.Q4_K.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.Q4_1.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.Q5_0.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.Q5_K_S.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.Q5_K.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.Q5_K_M.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.Q5_1.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.Q6_K.gguf filter=lfs diff=lfs merge=lfs -text
granite-8b-code-instruct-128k.Q8_0.gguf filter=lfs diff=lfs merge=lfs -text

222
README.md Normal file
View File

@@ -0,0 +1,222 @@
Quantization made by Richard Erkhov.
[Github](https://github.com/RichardErkhov)
[Discord](https://discord.gg/pvy7H8DZMG)
[Request more models](https://github.com/RichardErkhov/quant_request)
granite-8b-code-instruct-128k - GGUF
- Model creator: https://huggingface.co/ibm-granite/
- Original model: https://huggingface.co/ibm-granite/granite-8b-code-instruct-128k/
| Name | Quant method | Size |
| ---- | ---- | ---- |
| [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 |
| [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 |
| [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 |
| [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 |
| [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 |
| [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 |
| [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 |
| [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 |
| [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 |
| [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 |
| [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 |
| [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 |
| [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 |
| [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 |
| [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 |
| [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 |
| [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 |
| [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 |
| [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 |
| [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 |
| [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 |
| [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 |
Original model description:
---
pipeline_tag: text-generation
inference: false
license: apache-2.0
datasets:
- bigcode/commitpackft
- TIGER-Lab/MathInstruct
- meta-math/MetaMathQA
- glaiveai/glaive-code-assistant-v3
- glaive-function-calling-v2
- bugdaryan/sql-create-context-instruction
- garage-bAInd/Open-Platypus
- nvidia/HelpSteer
- bigcode/self-oss-instruct-sc2-exec-filter-50k
metrics:
- code_eval
library_name: transformers
tags:
- code
- granite
model-index:
- name: granite-8B-Code-instruct-128k
results:
- task:
type: text-generation
dataset:
type: bigcode/humanevalpack
name: HumanEvalSynthesis (Python)
metrics:
- name: pass@1
type: pass@1
value: 62.2
verified: false
- task:
type: text-generation
dataset:
type: bigcode/humanevalpack
name: HumanEvalSynthesis (Average)
metrics:
- name: pass@1
type: pass@1
value: 51.4
verified: false
- task:
type: text-generation
dataset:
type: bigcode/humanevalpack
name: HumanEvalExplain (Average)
metrics:
- name: pass@1
type: pass@1
value: 38.9
verified: false
- task:
type: text-generation
dataset:
type: bigcode/humanevalpack
name: HumanEvalFix (Average)
metrics:
- name: pass@1
type: pass@1
value: 38.3
verified: false
- task:
type: text-generation
dataset:
type: repoqa
name: RepoQA (Python@16K)
metrics:
- name: pass@1 (thresh=0.5)
type: pass@1 (thresh=0.5)
value: 73.0
verified: false
- task:
type: text-generation
dataset:
type: repoqa
name: RepoQA (C++@16K)
metrics:
- name: pass@1 (thresh=0.5)
type: pass@1 (thresh=0.5)
value: 37.0
verified: false
- task:
type: text-generation
dataset:
type: repoqa
name: RepoQA (Java@16K)
metrics:
- name: pass@1 (thresh=0.5)
type: pass@1 (thresh=0.5)
value: 73.0
verified: false
- task:
type: text-generation
dataset:
type: repoqa
name: RepoQA (TypeScript@16K)
metrics:
- name: pass@1 (thresh=0.5)
type: pass@1 (thresh=0.5)
value: 62.0
verified: false
- task:
type: text-generation
dataset:
type: repoqa
name: RepoQA (Rust@16K)
metrics:
- name: pass@1 (thresh=0.5)
type: pass@1 (thresh=0.5)
value: 63.0
verified: false
---
![image/png](https://cdn-uploads.huggingface.co/production/uploads/62cd5057674cdb524450093d/1hzxoPwqkBJXshKVVe6_9.png)
# Granite-8B-Code-Instruct-128K
## Model Summary
**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.
- **Developers:** IBM Research
- **GitHub Repository:** [ibm-granite/granite-code-models](https://github.com/ibm-granite/granite-code-models)
- **Paper:** [Scaling Granite Code Models to 128K Context](https://arxiv.org/abs/2407.13739)
- **Release Date**: July 18th, 2024
- **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0).
## Usage
### Intended use
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.
<!-- TO DO: Check starcoder2 instruct code example that includes the template https://huggingface.co/bigcode/starcoder2-15b-instruct-v0.1 -->
### Generation
This is a simple example of how to use **Granite-8B-Code-Instruct** model.
```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cuda" # or "cpu"
model_path = "ibm-granite/granite-8B-Code-instruct-128k"
tokenizer = AutoTokenizer.from_pretrained(model_path)
# drop device_map if running on CPU
model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
model.eval()
# change input text as desired
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)
# tokenize the text
input_tokens = tokenizer(chat, return_tensors="pt")
# transfer tokenized inputs to the device
for i in input_tokens:
input_tokens[i] = input_tokens[i].to(device)
# generate output tokens
output = model.generate(**input_tokens, max_new_tokens=100)
# decode output tokens into text
output = tokenizer.batch_decode(output)
# loop over the batch to print, in this example the batch size is 1
for i in output:
print(i)
```
<!-- TO DO: Check this part -->
## Training Data
Granite Code Instruct models are trained on a mix of short and long context data as follows.
* 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.
* 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.
## Infrastructure
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.
## Ethical Considerations and Limitations
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.

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:22e0ca0616c06f87d7feb4b128f32476beb772ec003c3a58e4e048d509bbef5d
size 3679551328

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2cf316d8660381dfbca1c3dbd702f658079ae8deca9792f40d88c8772c243d03
size 3568140128

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:754fa47657ed0bf7c37c97b48e85fc7c3e3d2be91fcd027e7d085ba540621d05
size 3384115040

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:282395b3bedbac5aef948eaad69e9b9ef56698179b6cacedd872cbaae8376bd3
size 4639129440

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1dd083337cf044f458174ffa9e880f911da05a27dfbaf69549b7b1044411ad3d
size 4405821280

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3d7217b97b84353916db9e9431b070e24fdc8917c7cd5cf6819ee3171c74e172
size 3062071136

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:72799e900df45aebb41a7d46c45075206c0726657347164231f2d929d0afb886
size 3944841056

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:45039af021e0f70d0c91f88ddef2edf66401b9f33eae8a04b57e871c31e47e23
size 4287725408

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:72799e900df45aebb41a7d46c45075206c0726657347164231f2d929d0afb886
size 3944841056

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:eb4b9f7340cca6043813dbfe5c5e3e43aa4cbfc628d4fa316a151672ccc10ea6
size 3548086112

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7538a47af660b341befb2737a559221ac7f6b2c6e09e4a48be2ba6eabf64d629
size 4590894944

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:801d1212dd7e455de18f7d5c1725a9d8983d4336d3b2dd45274b0caa5230842e
size 5081628512

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ef4fe5ea80ec8908484f52d54a68e44d231998104f2fd8303b7349d713a93fa2
size 4882857824

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ef4fe5ea80ec8908484f52d54a68e44d231998104f2fd8303b7349d713a93fa2
size 4882857824

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:99573f2402a3ef509c59146952a1860cc9d1913d58127d9f26b80fb71da9f82f
size 4622352224

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:264bec0158c7759cef384bcd8e37133db207104fb7c1eb109ad831199894f9b8
size 5572362080

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:536ac23f6eaa89bb476006d03e137d6da902b7a3f71aa96582b9d33fda4b0324
size 6063095648

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:445ecf95ecc42056068cf8e06b2002354b1fa5224bac3f1e89c5c414d09d3a42
size 5722767200

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:445ecf95ecc42056068cf8e06b2002354b1fa5224bac3f1e89c5c414d09d3a42
size 5722767200

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ab2d774837bfa6197a00e76045ea57ad0f435c1bd4f5031eb1eb1041ba541324
size 5572362080

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8f9b5c5c11f60512538322139a9894e95c466679c0f9da046ff93d02882f483a
size 6615170912

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7bbeba7889673d85bca7d8aa3a872efcda7f539093c4354c594b8f392a13710d
size 8565522272