Instructions to use cobrakenji/granite-3b-code-base-Q5_K_M-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cobrakenji/granite-3b-code-base-Q5_K_M-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cobrakenji/granite-3b-code-base-Q5_K_M-GGUF")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("cobrakenji/granite-3b-code-base-Q5_K_M-GGUF", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use cobrakenji/granite-3b-code-base-Q5_K_M-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf cobrakenji/granite-3b-code-base-Q5_K_M-GGUF:Q5_K_M # Run inference directly in the terminal: llama cli -hf cobrakenji/granite-3b-code-base-Q5_K_M-GGUF:Q5_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf cobrakenji/granite-3b-code-base-Q5_K_M-GGUF:Q5_K_M # Run inference directly in the terminal: llama cli -hf cobrakenji/granite-3b-code-base-Q5_K_M-GGUF:Q5_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 cobrakenji/granite-3b-code-base-Q5_K_M-GGUF:Q5_K_M # Run inference directly in the terminal: ./llama-cli -hf cobrakenji/granite-3b-code-base-Q5_K_M-GGUF:Q5_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 cobrakenji/granite-3b-code-base-Q5_K_M-GGUF:Q5_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf cobrakenji/granite-3b-code-base-Q5_K_M-GGUF:Q5_K_M
Use Docker
docker model run hf.co/cobrakenji/granite-3b-code-base-Q5_K_M-GGUF:Q5_K_M
- LM Studio
- Jan
- vLLM
How to use cobrakenji/granite-3b-code-base-Q5_K_M-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cobrakenji/granite-3b-code-base-Q5_K_M-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cobrakenji/granite-3b-code-base-Q5_K_M-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/cobrakenji/granite-3b-code-base-Q5_K_M-GGUF:Q5_K_M
- SGLang
How to use cobrakenji/granite-3b-code-base-Q5_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 "cobrakenji/granite-3b-code-base-Q5_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/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cobrakenji/granite-3b-code-base-Q5_K_M-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "cobrakenji/granite-3b-code-base-Q5_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/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cobrakenji/granite-3b-code-base-Q5_K_M-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use cobrakenji/granite-3b-code-base-Q5_K_M-GGUF with Ollama:
ollama run hf.co/cobrakenji/granite-3b-code-base-Q5_K_M-GGUF:Q5_K_M
- Unsloth Desktop
- Docker Model Runner
How to use cobrakenji/granite-3b-code-base-Q5_K_M-GGUF with Docker Model Runner:
docker model run hf.co/cobrakenji/granite-3b-code-base-Q5_K_M-GGUF:Q5_K_M
- Lemonade
How to use cobrakenji/granite-3b-code-base-Q5_K_M-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull cobrakenji/granite-3b-code-base-Q5_K_M-GGUF:Q5_K_M
Run and chat with the model
lemonade run user.granite-3b-code-base-Q5_K_M-GGUF-Q5_K_M
List all available models
lemonade list
- Atomic Chat
Download README.md from cobrakenji/granite-3b-code-base-Q5_K_M-GGUF: direct link, hf CLI and curl.
- Browser
- Download file 3.03 kB
-
https://huggingface.co/cobrakenji/granite-3b-code-base-Q5_K_M-GGUF/resolve/main/README.md
- Command line
-
hf download hf://cobrakenji/granite-3b-code-base-Q5_K_M-GGUF/README.md
-
curl -L -o README.md https://huggingface.co/cobrakenji/granite-3b-code-base-Q5_K_M-GGUF/resolve/main/README.md
license: apache-2.0
library_name: transformers
tags:
- code
- granite
- llama-cpp
- gguf-my-repo
datasets:
- codeparrot/github-code-clean
- bigcode/starcoderdata
- open-web-math/open-web-math
- math-ai/StackMathQA
metrics:
- code_eval
pipeline_tag: text-generation
inference: false
model-index:
- name: granite-3b-code-base
results:
- task:
type: text-generation
dataset:
name: MBPP
type: mbpp
metrics:
- type: pass@1
value: 36
name: pass@1
- task:
type: text-generation
dataset:
name: MBPP+
type: evalplus/mbppplus
metrics:
- type: pass@1
value: 45.1
name: pass@1
- task:
type: text-generation
dataset:
name: HumanEvalSynthesis(Python)
type: bigcode/humanevalpack
metrics:
- type: pass@1
value: 36.6
name: pass@1
- type: pass@1
value: 37.2
name: pass@1
- type: pass@1
value: 40.9
name: pass@1
- type: pass@1
value: 26.2
name: pass@1
- type: pass@1
value: 35.4
name: pass@1
- type: pass@1
value: 22
name: pass@1
- type: pass@1
value: 25
name: pass@1
- type: pass@1
value: 18.9
name: pass@1
- type: pass@1
value: 29.9
name: pass@1
- type: pass@1
value: 17.1
name: pass@1
- type: pass@1
value: 26.8
name: pass@1
- type: pass@1
value: 14
name: pass@1
- type: pass@1
value: 18.3
name: pass@1
- type: pass@1
value: 23.2
name: pass@1
- type: pass@1
value: 29.9
name: pass@1
- type: pass@1
value: 24.4
name: pass@1
- type: pass@1
value: 16.5
name: pass@1
- type: pass@1
value: 3.7
name: pass@1
cobrakenji/granite-3b-code-base-Q5_K_M-GGUF
This model was converted to GGUF format from ibm-granite/granite-3b-code-base using llama.cpp via the ggml.ai's GGUF-my-repo space.
Refer to the original model card for more details on the model.
Use with llama.cpp
Install llama.cpp through brew.
brew install ggerganov/ggerganov/llama.cpp
Invoke the llama.cpp server or the CLI.
CLI:
llama-cli --hf-repo cobrakenji/granite-3b-code-base-Q5_K_M-GGUF --model granite-3b-code-base.Q5_K_M.gguf -p "The meaning to life and the universe is"
Server:
llama-server --hf-repo cobrakenji/granite-3b-code-base-Q5_K_M-GGUF --model granite-3b-code-base.Q5_K_M.gguf -c 2048
Note: You can also use this checkpoint directly through the usage steps listed in the Llama.cpp repo as well.
git clone https://github.com/ggerganov/llama.cpp && cd llama.cpp && make && ./main -m granite-3b-code-base.Q5_K_M.gguf -n 128