bigcode/commitpackft
Viewer • Updated • 702k • 382k • 108
How to use Wusul/granite-20b-code-instruct-Q5_K_M-GGUF with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Wusul/granite-20b-code-instruct-Q5_K_M-GGUF") # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("Wusul/granite-20b-code-instruct-Q5_K_M-GGUF", dtype="auto")How to use Wusul/granite-20b-code-instruct-Q5_K_M-GGUF with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Wusul/granite-20b-code-instruct-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": "Wusul/granite-20b-code-instruct-Q5_K_M-GGUF",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/Wusul/granite-20b-code-instruct-Q5_K_M-GGUF
How to use Wusul/granite-20b-code-instruct-Q5_K_M-GGUF with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Wusul/granite-20b-code-instruct-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": "Wusul/granite-20b-code-instruct-Q5_K_M-GGUF",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "Wusul/granite-20b-code-instruct-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": "Wusul/granite-20b-code-instruct-Q5_K_M-GGUF",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use Wusul/granite-20b-code-instruct-Q5_K_M-GGUF with Docker Model Runner:
docker model run hf.co/Wusul/granite-20b-code-instruct-Q5_K_M-GGUF
This model was converted to GGUF format from ibm-granite/granite-20b-code-instruct using llama.cpp via the ggml.ai's GGUF-my-repo space.
Refer to the original model card for more details on the model.
Install llama.cpp through brew.
brew install ggerganov/ggerganov/llama.cpp
Invoke the llama.cpp server or the CLI.
CLI:
llama-cli --hf-repo Wusul/granite-20b-code-instruct-Q5_K_M-GGUF --model granite-20b-code-instruct.Q5_K_M.gguf -p "The meaning to life and the universe is"
Server:
llama-server --hf-repo Wusul/granite-20b-code-instruct-Q5_K_M-GGUF --model granite-20b-code-instruct.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-20b-code-instruct.Q5_K_M.gguf -n 128
5-bit
Base model
ibm-granite/granite-20b-code-base-8k