Image-Text-to-Text
MLX
Safetensors
English
inkling2_loop
mlx-vlm
inkling2
Mixture of Experts
quantized
gptq
apple-silicon
tool-calling
agents
conversational
8-bit precision
Instructions to use VisualInference/Inkling-2-Mini-MLX-3bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use VisualInference/Inkling-2-Mini-MLX-3bit 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("VisualInference/Inkling-2-Mini-MLX-3bit") config = load_config("VisualInference/Inkling-2-Mini-MLX-3bit") # 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 VisualInference/Inkling-2-Mini-MLX-3bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "VisualInference/Inkling-2-Mini-MLX-3bit"
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": "VisualInference/Inkling-2-Mini-MLX-3bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use VisualInference/Inkling-2-Mini-MLX-3bit 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 "VisualInference/Inkling-2-Mini-MLX-3bit"
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 VisualInference/Inkling-2-Mini-MLX-3bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use VisualInference/Inkling-2-Mini-MLX-3bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "VisualInference/Inkling-2-Mini-MLX-3bit"
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 "VisualInference/Inkling-2-Mini-MLX-3bit" \ --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"
Download extras/scripts/eval_nll.py from VisualInference/Inkling-2-Mini-MLX-3bit: direct link, hf CLI and curl.
- Browser
- Download file 3.36 kB
-
https://huggingface.co/VisualInference/Inkling-2-Mini-MLX-3bit/resolve/main/extras/scripts/eval_nll.py
- Command line
-
hf download hf://VisualInference/Inkling-2-Mini-MLX-3bit/extras/scripts/eval_nll.py
-
curl -L -o eval_nll.py https://huggingface.co/VisualInference/Inkling-2-Mini-MLX-3bit/resolve/main/extras/scripts/eval_nll.py
3.36 kB
| """Held-out loss on assistant-side tokens. Usage: eval_nll.py <model_dir|native> <sequences.json> <out.json> <tag> [--fp32] [--actquant input,hidden] | |
| Counts only tokens the model would generate itself (assistant messages: reasoning, text, tool calls, and the | |
| end-of-turn token). Stores per-sequence sums so variants can be compared with paired statistics. | |
| """ | |
| import json, os, sys, time | |
| import numpy as np | |
| import mlx.core as mx | |
| sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) | |
| import qlab | |
| MODEL_TOK, END_MSG, EOS = 200001, 200010, 200006 | |
| def assistant_mask(ids): | |
| mask, inside = [], False | |
| for t in ids: | |
| if t == MODEL_TOK: | |
| inside = True | |
| mask.append(inside or t == EOS) | |
| if t == END_MSG: | |
| inside = False | |
| return mask | |
| def main(): | |
| args = sys.argv[1:] | |
| fp32 = "--fp32" in args | |
| if fp32: args.remove("--fp32") | |
| aq = None | |
| if "--actquant" in args: | |
| i = args.index("--actquant"); aq = tuple(args[i + 1].split(",")); del args[i:i + 2] | |
| recipe = None | |
| if "--recipe" in args: | |
| i = args.index("--recipe"); rfile, rname = args[i + 1].split(":"); del args[i:i + 2] | |
| recipe = json.load(open(rfile))[rname] | |
| model_dir, seq_path, out_path, tag = args[:4] | |
| path = qlab.NATIVE if model_dir == "native" else model_dir | |
| model, _ = qlab.load_native(fp32=False, path=path) | |
| size = None | |
| if recipe is not None: | |
| import recipes as R | |
| R.apply(model, recipe, os.path.join(qlab.ROOT, "q", "shards")) | |
| size = R.nbytes(model) / 2**30 | |
| if fp32: | |
| qlab.to_fp32(model); mx.eval(model.parameters()) | |
| if aq: | |
| import actquant | |
| actquant.install(model, aq) | |
| seqs = qlab.load_sequences(seq_path, split="eval", max_len=1024) | |
| rows, t0 = [], time.time() | |
| for s in seqs: | |
| ids = s["ids"] | |
| lg = qlab.logits_for(model, ids) | |
| lp = qlab.log_softmax(lg)[:-1] | |
| nxt = mx.array(ids[1:]) | |
| nll = -mx.take_along_axis(lp, nxt[:, None], axis=-1)[:, 0] | |
| m = mx.array(assistant_mask(ids)[1:]).astype(mx.float32) | |
| hit = (mx.argmax(lp, axis=-1) == nxt).astype(mx.float32) | |
| vals = [(nll * m).sum(), m.sum(), (hit * m).sum()] | |
| mx.eval(vals) | |
| rows.append(dict(name=s["name"], kind=s["kind"].split(":")[0], nll=vals[0].item(), n=int(vals[1].item()), hit=vals[2].item())) | |
| del lg, lp | |
| res = json.load(open(out_path)) if os.path.exists(out_path) else {} | |
| n = sum(r["n"] for r in rows) | |
| summ = dict(tokens=n, nll=sum(r["nll"] for r in rows) / n, acc=sum(r["hit"] for r in rows) / n, seconds=round(time.time() - t0), | |
| peak_gb=round(mx.get_peak_memory() / 2**30, 2), weights_gib=size, activations="fp32" if fp32 else "bf16", actquant=aq) | |
| for kind in sorted({r["kind"] for r in rows}): | |
| sel = [r for r in rows if r["kind"] == kind] | |
| summ[kind] = dict(tokens=sum(r["n"] for r in sel), nll=sum(r["nll"] for r in sel) / max(1, sum(r["n"] for r in sel))) | |
| summ["rows"] = rows | |
| res[tag] = summ | |
| json.dump(res, open(out_path, "w")) | |
| print(f"{tag:28s} tokens {n} NLL {summ['nll']:.4f} ppl {np.exp(summ['nll']):.3f} acc {summ['acc']:.4f} " | |
| + " ".join(f"{k} {summ[k]['nll']:.4f}" for k in ("chat", "code", "wikitext") if k in summ) + f" ({summ['seconds']}s)", flush=True) | |
| if __name__ == "__main__": | |
| main() | |