Image-Text-to-Text
MLX
Safetensors
inkling_mm_model
inkling
Mixture of Experts
multimodal
text-generation
apple-silicon
conversational
Instructions to use mlx-community/Inkling-Small-mlx-2bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/Inkling-Small-mlx-2bit 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("mlx-community/Inkling-Small-mlx-2bit") config = load_config("mlx-community/Inkling-Small-mlx-2bit") # 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 mlx-community/Inkling-Small-mlx-2bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/Inkling-Small-mlx-2bit"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "mlx-community/Inkling-Small-mlx-2bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use mlx-community/Inkling-Small-mlx-2bit 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 "mlx-community/Inkling-Small-mlx-2bit"
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 mlx-community/Inkling-Small-mlx-2bit
Run Hermes
hermes
- OpenClaw new
How to use mlx-community/Inkling-Small-mlx-2bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/Inkling-Small-mlx-2bit"
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 "mlx-community/Inkling-Small-mlx-2bit" \ --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"
| """Greedy generation for an Inkling MLX model, using an incremental KV + conv-state | |
| cache: the prompt is prefilled once, then each new token is a single-position step. | |
| """ | |
| from __future__ import annotations | |
| import argparse | |
| import time | |
| import mlx.core as mx | |
| from .cache import make_cache | |
| from .load import load | |
| def load_tokenizer(path: str): | |
| try: | |
| from transformers import AutoTokenizer | |
| return AutoTokenizer.from_pretrained(path, trust_remote_code=True) | |
| except Exception: | |
| from transformers import PreTrainedTokenizerFast | |
| import os | |
| return PreTrainedTokenizerFast(tokenizer_file=os.path.join(path, "tokenizer.json")) | |
| def greedy_generate(model, config, input_ids, max_new_tokens=32, eos_id=None, | |
| pixel_values=None, audio_input_ids=None): | |
| """Greedy decode. For multimodal, pass ``pixel_values`` / ``audio_input_ids`` | |
| (from ``InklingProcessor``); they are consumed only by the prompt prefill.""" | |
| eos_id = eos_id if eos_id is not None else config.eos_token_id | |
| caches = make_cache(model) | |
| prompt = list(input_ids) | |
| # prefill the whole prompt (with any media) in one pass | |
| logits = model(mx.array([prompt]), caches=caches, start_pos=0, last_logit_only=True, | |
| pixel_values=pixel_values, audio_input_ids=audio_input_ids) | |
| next_id = int(mx.argmax(logits[0, -1]).item()) | |
| out = [next_id] | |
| pos = len(prompt) | |
| for _ in range(max_new_tokens - 1): | |
| if next_id == eos_id: | |
| break | |
| logits = model(mx.array([[next_id]]), caches=caches, start_pos=pos, last_logit_only=True) | |
| next_id = int(mx.argmax(logits[0, -1]).item()) | |
| out.append(next_id) | |
| pos += 1 | |
| return prompt + out | |
| def main(): | |
| ap = argparse.ArgumentParser() | |
| ap.add_argument("--model", required=True, help="converted MLX model dir") | |
| ap.add_argument("--prompt", default="The capital of France is") | |
| ap.add_argument("--max-new-tokens", type=int, default=32) | |
| ap.add_argument("--wired-limit-gb", type=float, default=500.0, | |
| help="mx wired-memory limit; needs `sudo sysctl iogpu.wired_limit_mb` set too") | |
| ap.add_argument("--lazy", action="store_true", | |
| help="mmap weights instead of eager-loading (lower peak RAM, but forwards " | |
| "re-read from disk and thrash near the memory ceiling)") | |
| args = ap.parse_args() | |
| # eager load pins the weights wired-resident so prefill/decode don't re-read the | |
| # mmap (the big win for near-capacity models); pass --lazy to opt out. | |
| try: | |
| mx.set_wired_limit(int(args.wired_limit_gb * 1e9)) | |
| except Exception as e: | |
| print(f"[warn] set_wired_limit: {e}") | |
| print(f"[load] {args.model} ({'lazy mmap' if args.lazy else 'eager, wired-resident'})") | |
| t0 = time.time() | |
| model, config = load(args.model, lazy=args.lazy) | |
| print(f"[load] ready in {time.time()-t0:.0f}s") | |
| tok = load_tokenizer(args.model) | |
| input_ids = tok(args.prompt)["input_ids"] | |
| print(f"[prompt] {args.prompt!r} -> {len(input_ids)} tokens") | |
| t0 = time.time() | |
| out_ids = greedy_generate(model, config, input_ids, args.max_new_tokens) | |
| dt = time.time() - t0 | |
| text = tok.decode(out_ids) | |
| n_new = len(out_ids) - len(input_ids) | |
| print(f"\n{text}\n") | |
| print(f"[gen] {n_new} tokens in {dt:.1f}s ({n_new/dt:.2f} tok/s)") | |
| if __name__ == "__main__": | |
| main() | |