Text Generation
Transformers
GGUF
code
granite
llama-cpp
gguf-my-repo
Eval Results (legacy)
conversational
Instructions to use TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF", dtype="auto") - llama-cpp-python
How to use TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF", filename="granite-8b-code-instruct-128k-q4_k_m.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF:Q4_K_M # Run inference directly in the terminal: llama-cli -hf TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF:Q4_K_M
Use Docker
docker model run hf.co/TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF:Q4_K_M
- SGLang
How to use TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF with Ollama:
ollama run hf.co/TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF:Q4_K_M
- Unsloth Studio new
How to use TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF to start chatting
- Docker Model Runner
How to use TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF with Docker Model Runner:
docker model run hf.co/TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF:Q4_K_M
- Lemonade
How to use TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF:Q4_K_M
Run and chat with the model
lemonade run user.granite-8b-code-instruct-128k-Q4_K_M-GGUF-Q4_K_M
List all available models
lemonade list
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model: ibm-granite/granite-8b-code-instruct-128k
|
| 3 |
+
datasets:
|
| 4 |
+
- bigcode/commitpackft
|
| 5 |
+
- TIGER-Lab/MathInstruct
|
| 6 |
+
- meta-math/MetaMathQA
|
| 7 |
+
- glaiveai/glaive-code-assistant-v3
|
| 8 |
+
- glaive-function-calling-v2
|
| 9 |
+
- bugdaryan/sql-create-context-instruction
|
| 10 |
+
- garage-bAInd/Open-Platypus
|
| 11 |
+
- nvidia/HelpSteer
|
| 12 |
+
- bigcode/self-oss-instruct-sc2-exec-filter-50k
|
| 13 |
+
library_name: transformers
|
| 14 |
+
license: apache-2.0
|
| 15 |
+
metrics:
|
| 16 |
+
- code_eval
|
| 17 |
+
pipeline_tag: text-generation
|
| 18 |
+
tags:
|
| 19 |
+
- code
|
| 20 |
+
- granite
|
| 21 |
+
- llama-cpp
|
| 22 |
+
- gguf-my-repo
|
| 23 |
+
inference: false
|
| 24 |
+
model-index:
|
| 25 |
+
- name: granite-8B-Code-instruct-128k
|
| 26 |
+
results:
|
| 27 |
+
- task:
|
| 28 |
+
type: text-generation
|
| 29 |
+
dataset:
|
| 30 |
+
name: HumanEvalSynthesis (Python)
|
| 31 |
+
type: bigcode/humanevalpack
|
| 32 |
+
metrics:
|
| 33 |
+
- type: pass@1
|
| 34 |
+
value: 62.2
|
| 35 |
+
name: pass@1
|
| 36 |
+
verified: false
|
| 37 |
+
- type: pass@1
|
| 38 |
+
value: 51.4
|
| 39 |
+
name: pass@1
|
| 40 |
+
verified: false
|
| 41 |
+
- type: pass@1
|
| 42 |
+
value: 38.9
|
| 43 |
+
name: pass@1
|
| 44 |
+
verified: false
|
| 45 |
+
- type: pass@1
|
| 46 |
+
value: 38.3
|
| 47 |
+
name: pass@1
|
| 48 |
+
verified: false
|
| 49 |
+
- task:
|
| 50 |
+
type: text-generation
|
| 51 |
+
dataset:
|
| 52 |
+
name: RepoQA (Python@16K)
|
| 53 |
+
type: repoqa
|
| 54 |
+
metrics:
|
| 55 |
+
- type: pass@1 (thresh=0.5)
|
| 56 |
+
value: 73.0
|
| 57 |
+
name: pass@1 (thresh=0.5)
|
| 58 |
+
verified: false
|
| 59 |
+
- type: pass@1 (thresh=0.5)
|
| 60 |
+
value: 37.0
|
| 61 |
+
name: pass@1 (thresh=0.5)
|
| 62 |
+
verified: false
|
| 63 |
+
- type: pass@1 (thresh=0.5)
|
| 64 |
+
value: 73.0
|
| 65 |
+
name: pass@1 (thresh=0.5)
|
| 66 |
+
verified: false
|
| 67 |
+
- type: pass@1 (thresh=0.5)
|
| 68 |
+
value: 62.0
|
| 69 |
+
name: pass@1 (thresh=0.5)
|
| 70 |
+
verified: false
|
| 71 |
+
- type: pass@1 (thresh=0.5)
|
| 72 |
+
value: 63.0
|
| 73 |
+
name: pass@1 (thresh=0.5)
|
| 74 |
+
verified: false
|
| 75 |
+
---
|
| 76 |
+
|
| 77 |
+
# TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF
|
| 78 |
+
This model was converted to GGUF format from [`ibm-granite/granite-8b-code-instruct-128k`](https://huggingface.co/ibm-granite/granite-8b-code-instruct-128k) using llama.cpp via the ggml.ai's [GGUF-my-repo](https://huggingface.co/spaces/ggml-org/gguf-my-repo) space.
|
| 79 |
+
Refer to the [original model card](https://huggingface.co/ibm-granite/granite-8b-code-instruct-128k) for more details on the model.
|
| 80 |
+
|
| 81 |
+
## Use with llama.cpp
|
| 82 |
+
Install llama.cpp through brew (works on Mac and Linux)
|
| 83 |
+
|
| 84 |
+
```bash
|
| 85 |
+
brew install llama.cpp
|
| 86 |
+
|
| 87 |
+
```
|
| 88 |
+
Invoke the llama.cpp server or the CLI.
|
| 89 |
+
|
| 90 |
+
### CLI:
|
| 91 |
+
```bash
|
| 92 |
+
llama-cli --hf-repo TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF --hf-file granite-8b-code-instruct-128k-q4_k_m.gguf -p "The meaning to life and the universe is"
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
### Server:
|
| 96 |
+
```bash
|
| 97 |
+
llama-server --hf-repo TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF --hf-file granite-8b-code-instruct-128k-q4_k_m.gguf -c 2048
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
Note: You can also use this checkpoint directly through the [usage steps](https://github.com/ggerganov/llama.cpp?tab=readme-ov-file#usage) listed in the Llama.cpp repo as well.
|
| 101 |
+
|
| 102 |
+
Step 1: Clone llama.cpp from GitHub.
|
| 103 |
+
```
|
| 104 |
+
git clone https://github.com/ggerganov/llama.cpp
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
Step 2: Move into the llama.cpp folder and build it with `LLAMA_CURL=1` flag along with other hardware-specific flags (for ex: LLAMA_CUDA=1 for Nvidia GPUs on Linux).
|
| 108 |
+
```
|
| 109 |
+
cd llama.cpp && LLAMA_CURL=1 make
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
Step 3: Run inference through the main binary.
|
| 113 |
+
```
|
| 114 |
+
./llama-cli --hf-repo TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF --hf-file granite-8b-code-instruct-128k-q4_k_m.gguf -p "The meaning to life and the universe is"
|
| 115 |
+
```
|
| 116 |
+
or
|
| 117 |
+
```
|
| 118 |
+
./llama-server --hf-repo TobDeBer/granite-8b-code-instruct-128k-Q4_K_M-GGUF --hf-file granite-8b-code-instruct-128k-q4_k_m.gguf -c 2048
|
| 119 |
+
```
|