granite-vision-5.0-4b (GGUF)
[!NOTE] This repository contains models that have been converted to the GGUF format with various quantizations from an IBM Granite base model.
Please reference the base model's full model card here: https://huggingface.co/ibm-granite/granite-vision-5.0-4b
Running with llama.cpp
The examples below use the Q8_0 quantization (granite-vision-5.0-4b-Q8_0.gguf) together with the vision projector model (mmproj-model-bf16.gguf) from this repository. See the llama.cpp documentation for complete usage and options, including the llama cli and llama serve flag references.
example: llama cli
llama cli -m granite-vision-5.0-4b-Q8_0.gguf --mmproj mmproj-model-bf16.gguf --image page.png --jinja --temp 0 -p "Describe this image."
llama cli inserts the image marker into the prompt for you. Run it without --image and -p to start an interactive chat.
example: llama serve using OpenAI API
- Start llama serve with the vision model and projector model
llama serve -m granite-vision-5.0-4b-Q8_0.gguf \
--mmproj mmproj-model-bf16.gguf \
--jinja \
--port 8080
- Base64 encode the image file
IMAGE_B64=$(base64 < page.png | tr -d '\n')
cat > request.json <<EOF
{
"messages": [
{
"role": "user",
"content": [
{ "type": "image_url", "image_url": { "url": "data:image/png;base64,${IMAGE_B64}" } },
{ "type": "text", "text": "Describe this image." }
]
}
]
}
EOF
- Send the image to the llama serve /v1/chat/completions endpoint
curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d @request.json
The response is a JSON message with the generated text in the choices[0].message.content field.
Build Information
- llama.cpp build tag:
b11798 - Transformers version:
5.20.2