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"
| { | |
| "architectures": [ | |
| "Granite4VisionForConditionalGeneration" | |
| ], | |
| "auto_map": { | |
| "AutoConfig": "configuration.Granite4VisionConfig", | |
| "AutoModel": "modeling.Granite4VisionForConditionalGeneration", | |
| "AutoModelForVision2Seq": "modeling.Granite4VisionForConditionalGeneration", | |
| "AutoModelForImageTextToText": "modeling.Granite4VisionForConditionalGeneration", | |
| "AutoProcessor": "processing.Granite4VisionProcessor" | |
| }, | |
| "deepstack_layer_map": [ | |
| [ | |
| -19, | |
| 9 | |
| ], | |
| [ | |
| -13, | |
| 6 | |
| ], | |
| [ | |
| -7, | |
| 3 | |
| ], | |
| [ | |
| -1, | |
| 0 | |
| ] | |
| ], | |
| "downsample_rate": "4/8", | |
| "dtype": "bfloat16", | |
| "eos_token_id": 100257, | |
| "image_grid_pinpoints": [ | |
| [ | |
| 384, | |
| 384 | |
| ], | |
| [ | |
| 384, | |
| 768 | |
| ], | |
| [ | |
| 384, | |
| 1152 | |
| ], | |
| [ | |
| 384, | |
| 1536 | |
| ], | |
| [ | |
| 384, | |
| 1920 | |
| ], | |
| [ | |
| 384, | |
| 2304 | |
| ], | |
| [ | |
| 384, | |
| 2688 | |
| ], | |
| [ | |
| 384, | |
| 3072 | |
| ], | |
| [ | |
| 384, | |
| 3456 | |
| ], | |
| [ | |
| 384, | |
| 3840 | |
| ], | |
| [ | |
| 768, | |
| 384 | |
| ], | |
| [ | |
| 768, | |
| 768 | |
| ], | |
| [ | |
| 768, | |
| 1152 | |
| ], | |
| [ | |
| 768, | |
| 1536 | |
| ], | |
| [ | |
| 768, | |
| 1920 | |
| ], | |
| [ | |
| 1152, | |
| 384 | |
| ], | |
| [ | |
| 1152, | |
| 768 | |
| ], | |
| [ | |
| 1152, | |
| 1152 | |
| ], | |
| [ | |
| 1536, | |
| 384 | |
| ], | |
| [ | |
| 1536, | |
| 768 | |
| ], | |
| [ | |
| 1920, | |
| 384 | |
| ], | |
| [ | |
| 1920, | |
| 768 | |
| ], | |
| [ | |
| 2304, | |
| 384 | |
| ], | |
| [ | |
| 2688, | |
| 384 | |
| ], | |
| [ | |
| 3072, | |
| 384 | |
| ], | |
| [ | |
| 3456, | |
| 384 | |
| ], | |
| [ | |
| 3840, | |
| 384 | |
| ] | |
| ], | |
| "image_seq_length": 576, | |
| "image_token_index": 100352, | |
| "initializer_range": 0.02, | |
| "model_type": "granite4_vision", | |
| "projector_dropout": 0.1, | |
| "projector_hidden_act": "gelu", | |
| "quantization_config": { | |
| "group_size": 32 | |
| }, | |
| "spatial_stride": 2, | |
| "spatial_target_layers": [ | |
| 12, | |
| 15, | |
| 18, | |
| 21 | |
| ], | |
| "spatial_vision_layer": -1, | |
| "text_config": { | |
| "architectures": [ | |
| "GraniteForCausalLM" | |
| ], | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "attention_multiplier": 0.015625, | |
| "bos_token_id": 100257, | |
| "embedding_multiplier": 12.0, | |
| "eos_token_id": 100257, | |
| "hidden_act": "silu", | |
| "hidden_size": 2560, | |
| "initializer_range": 0.1, | |
| "intermediate_size": 8192, | |
| "logits_scaling": 10.0, | |
| "max_position_embeddings": 131072, | |
| "mlp_bias": false, | |
| "model_type": "granite", | |
| "num_attention_heads": 40, | |
| "num_hidden_layers": 40, | |
| "num_key_value_heads": 8, | |
| "pad_token_id": 100256, | |
| "residual_multiplier": 0.22, | |
| "rms_norm_eps": 1e-05, | |
| "rope_scaling": null, | |
| "rope_theta": 10000000, | |
| "tie_word_embeddings": true, | |
| "torch_dtype": "bfloat16", | |
| "transformers_version": "4.53.3", | |
| "use_cache": true, | |
| "vocab_size": 100353 | |
| }, | |
| "tie_word_embeddings": true, | |
| "transformers_version": "4.57.3", | |
| "use_image_newline_parameter": true, | |
| "use_spatial_sampling": true, | |
| "vision_config": { | |
| "attention_dropout": 0.0, | |
| "hidden_act": "gelu_pytorch_tanh", | |
| "hidden_size": 1152, | |
| "image_size": 384, | |
| "intermediate_size": 4304, | |
| "layer_norm_eps": 1e-06, | |
| "model_type": "siglip_vision_model", | |
| "num_attention_heads": 16, | |
| "num_channels": 3, | |
| "num_hidden_layers": 27, | |
| "patch_size": 16 | |
| }, | |
| "vision_feature_select_strategy": "full" | |
| } |