Instructions to use inferencerlabs/granite-vision-4.1-4b-MLX-Q9 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use inferencerlabs/granite-vision-4.1-4b-MLX-Q9 with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("inferencerlabs/granite-vision-4.1-4b-MLX-Q9") config = load_config("inferencerlabs/granite-vision-4.1-4b-MLX-Q9") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use inferencerlabs/granite-vision-4.1-4b-MLX-Q9 with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "inferencerlabs/granite-vision-4.1-4b-MLX-Q9"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "inferencerlabs/granite-vision-4.1-4b-MLX-Q9" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use inferencerlabs/granite-vision-4.1-4b-MLX-Q9 with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "inferencerlabs/granite-vision-4.1-4b-MLX-Q9"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default inferencerlabs/granite-vision-4.1-4b-MLX-Q9
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use inferencerlabs/granite-vision-4.1-4b-MLX-Q9 with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "inferencerlabs/granite-vision-4.1-4b-MLX-Q9"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "inferencerlabs/granite-vision-4.1-4b-MLX-Q9" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Upload model file
Browse files- config.json +210 -0
config.json
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Granite4VisionForConditionalGeneration"
|
| 4 |
+
],
|
| 5 |
+
"auto_map": {
|
| 6 |
+
"AutoConfig": "configuration.Granite4VisionConfig",
|
| 7 |
+
"AutoModel": "modeling.Granite4VisionForConditionalGeneration",
|
| 8 |
+
"AutoModelForVision2Seq": "modeling.Granite4VisionForConditionalGeneration",
|
| 9 |
+
"AutoModelForImageTextToText": "modeling.Granite4VisionForConditionalGeneration",
|
| 10 |
+
"AutoProcessor": "processing.Granite4VisionProcessor"
|
| 11 |
+
},
|
| 12 |
+
"deepstack_layer_map": [
|
| 13 |
+
[
|
| 14 |
+
-19,
|
| 15 |
+
9
|
| 16 |
+
],
|
| 17 |
+
[
|
| 18 |
+
-13,
|
| 19 |
+
6
|
| 20 |
+
],
|
| 21 |
+
[
|
| 22 |
+
-7,
|
| 23 |
+
3
|
| 24 |
+
],
|
| 25 |
+
[
|
| 26 |
+
-1,
|
| 27 |
+
0
|
| 28 |
+
]
|
| 29 |
+
],
|
| 30 |
+
"downsample_rate": "4/8",
|
| 31 |
+
"dtype": "bfloat16",
|
| 32 |
+
"eos_token_id": 100257,
|
| 33 |
+
"image_grid_pinpoints": [
|
| 34 |
+
[
|
| 35 |
+
384,
|
| 36 |
+
384
|
| 37 |
+
],
|
| 38 |
+
[
|
| 39 |
+
384,
|
| 40 |
+
768
|
| 41 |
+
],
|
| 42 |
+
[
|
| 43 |
+
384,
|
| 44 |
+
1152
|
| 45 |
+
],
|
| 46 |
+
[
|
| 47 |
+
384,
|
| 48 |
+
1536
|
| 49 |
+
],
|
| 50 |
+
[
|
| 51 |
+
384,
|
| 52 |
+
1920
|
| 53 |
+
],
|
| 54 |
+
[
|
| 55 |
+
384,
|
| 56 |
+
2304
|
| 57 |
+
],
|
| 58 |
+
[
|
| 59 |
+
384,
|
| 60 |
+
2688
|
| 61 |
+
],
|
| 62 |
+
[
|
| 63 |
+
384,
|
| 64 |
+
3072
|
| 65 |
+
],
|
| 66 |
+
[
|
| 67 |
+
384,
|
| 68 |
+
3456
|
| 69 |
+
],
|
| 70 |
+
[
|
| 71 |
+
384,
|
| 72 |
+
3840
|
| 73 |
+
],
|
| 74 |
+
[
|
| 75 |
+
768,
|
| 76 |
+
384
|
| 77 |
+
],
|
| 78 |
+
[
|
| 79 |
+
768,
|
| 80 |
+
768
|
| 81 |
+
],
|
| 82 |
+
[
|
| 83 |
+
768,
|
| 84 |
+
1152
|
| 85 |
+
],
|
| 86 |
+
[
|
| 87 |
+
768,
|
| 88 |
+
1536
|
| 89 |
+
],
|
| 90 |
+
[
|
| 91 |
+
768,
|
| 92 |
+
1920
|
| 93 |
+
],
|
| 94 |
+
[
|
| 95 |
+
1152,
|
| 96 |
+
384
|
| 97 |
+
],
|
| 98 |
+
[
|
| 99 |
+
1152,
|
| 100 |
+
768
|
| 101 |
+
],
|
| 102 |
+
[
|
| 103 |
+
1152,
|
| 104 |
+
1152
|
| 105 |
+
],
|
| 106 |
+
[
|
| 107 |
+
1536,
|
| 108 |
+
384
|
| 109 |
+
],
|
| 110 |
+
[
|
| 111 |
+
1536,
|
| 112 |
+
768
|
| 113 |
+
],
|
| 114 |
+
[
|
| 115 |
+
1920,
|
| 116 |
+
384
|
| 117 |
+
],
|
| 118 |
+
[
|
| 119 |
+
1920,
|
| 120 |
+
768
|
| 121 |
+
],
|
| 122 |
+
[
|
| 123 |
+
2304,
|
| 124 |
+
384
|
| 125 |
+
],
|
| 126 |
+
[
|
| 127 |
+
2688,
|
| 128 |
+
384
|
| 129 |
+
],
|
| 130 |
+
[
|
| 131 |
+
3072,
|
| 132 |
+
384
|
| 133 |
+
],
|
| 134 |
+
[
|
| 135 |
+
3456,
|
| 136 |
+
384
|
| 137 |
+
],
|
| 138 |
+
[
|
| 139 |
+
3840,
|
| 140 |
+
384
|
| 141 |
+
]
|
| 142 |
+
],
|
| 143 |
+
"image_seq_length": 576,
|
| 144 |
+
"image_token_index": 100352,
|
| 145 |
+
"initializer_range": 0.02,
|
| 146 |
+
"model_type": "granite4_vision",
|
| 147 |
+
"projector_dropout": 0.1,
|
| 148 |
+
"projector_hidden_act": "gelu",
|
| 149 |
+
"quantization_config": {
|
| 150 |
+
"group_size": 32
|
| 151 |
+
},
|
| 152 |
+
"spatial_stride": 2,
|
| 153 |
+
"spatial_target_layers": [
|
| 154 |
+
12,
|
| 155 |
+
15,
|
| 156 |
+
18,
|
| 157 |
+
21
|
| 158 |
+
],
|
| 159 |
+
"spatial_vision_layer": -1,
|
| 160 |
+
"text_config": {
|
| 161 |
+
"architectures": [
|
| 162 |
+
"GraniteForCausalLM"
|
| 163 |
+
],
|
| 164 |
+
"attention_bias": false,
|
| 165 |
+
"attention_dropout": 0.0,
|
| 166 |
+
"attention_multiplier": 0.015625,
|
| 167 |
+
"bos_token_id": 100257,
|
| 168 |
+
"embedding_multiplier": 12.0,
|
| 169 |
+
"eos_token_id": 100257,
|
| 170 |
+
"hidden_act": "silu",
|
| 171 |
+
"hidden_size": 2560,
|
| 172 |
+
"initializer_range": 0.1,
|
| 173 |
+
"intermediate_size": 8192,
|
| 174 |
+
"logits_scaling": 10.0,
|
| 175 |
+
"max_position_embeddings": 131072,
|
| 176 |
+
"mlp_bias": false,
|
| 177 |
+
"model_type": "granite",
|
| 178 |
+
"num_attention_heads": 40,
|
| 179 |
+
"num_hidden_layers": 40,
|
| 180 |
+
"num_key_value_heads": 8,
|
| 181 |
+
"pad_token_id": 100256,
|
| 182 |
+
"residual_multiplier": 0.22,
|
| 183 |
+
"rms_norm_eps": 1e-05,
|
| 184 |
+
"rope_scaling": null,
|
| 185 |
+
"rope_theta": 10000000,
|
| 186 |
+
"tie_word_embeddings": true,
|
| 187 |
+
"torch_dtype": "bfloat16",
|
| 188 |
+
"transformers_version": "4.53.3",
|
| 189 |
+
"use_cache": true,
|
| 190 |
+
"vocab_size": 100353
|
| 191 |
+
},
|
| 192 |
+
"tie_word_embeddings": true,
|
| 193 |
+
"transformers_version": "4.57.3",
|
| 194 |
+
"use_image_newline_parameter": true,
|
| 195 |
+
"use_spatial_sampling": true,
|
| 196 |
+
"vision_config": {
|
| 197 |
+
"attention_dropout": 0.0,
|
| 198 |
+
"hidden_act": "gelu_pytorch_tanh",
|
| 199 |
+
"hidden_size": 1152,
|
| 200 |
+
"image_size": 384,
|
| 201 |
+
"intermediate_size": 4304,
|
| 202 |
+
"layer_norm_eps": 1e-06,
|
| 203 |
+
"model_type": "siglip_vision_model",
|
| 204 |
+
"num_attention_heads": 16,
|
| 205 |
+
"num_channels": 3,
|
| 206 |
+
"num_hidden_layers": 27,
|
| 207 |
+
"patch_size": 16
|
| 208 |
+
},
|
| 209 |
+
"vision_feature_select_strategy": "full"
|
| 210 |
+
}
|