Instructions to use thinkingmachines/Inkling-2-Mini with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use thinkingmachines/Inkling-2-Mini with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="thinkingmachines/Inkling-2-Mini") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("thinkingmachines/Inkling-2-Mini") model = AutoModelForMultimodalLM.from_pretrained("thinkingmachines/Inkling-2-Mini", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use thinkingmachines/Inkling-2-Mini with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "thinkingmachines/Inkling-2-Mini" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "thinkingmachines/Inkling-2-Mini", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/thinkingmachines/Inkling-2-Mini
- SGLang
How to use thinkingmachines/Inkling-2-Mini with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "thinkingmachines/Inkling-2-Mini" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "thinkingmachines/Inkling-2-Mini", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "thinkingmachines/Inkling-2-Mini" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "thinkingmachines/Inkling-2-Mini", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use thinkingmachines/Inkling-2-Mini with Docker Model Runner:
docker model run hf.co/thinkingmachines/Inkling-2-Mini
PRIME-Quant: Running Inkling-2-Mini 100% resident on 12–16 GB GPUs (8.83 GB / 10.87 GB, 54–56 tok/s on RX 9060 XT, 0.054 KLD) + OpenAI server
Sharing a 2-bit/4-bit quantization & fused Triton runtime for Inkling-2-Mini built specifically for 12 GB and 16 GB consumer GPUs (AMD ROCm & NVIDIA CUDA):
Repo: https://huggingface.co/batteryphil/Inkling-2-Mini-PRIME-Quant
(Free for personal, hobbyist, academic, and research use.)
Why Looped-Layer Sensitivity Matters for 2-Bit Inkling-2-Mini
Because layers L6..17 run 3 looped passes per token (48 logical layer applications), uniform 2-bit MoE error compounds 3× per token. Promoting only the top-8 highest-sensitivity looped/boundary MoE layers (L5, L8, L9, L11, L12, L14, L15, L16) from 2-bit (P2_G32) to 4-bit (P4_G32) cuts mean KL divergence in half (0.1138 → 0.0542) for +2.04 GB VRAM while keeping all other 16 MoE banks at 2-bit:
| Checkpoint | VRAM | Mean KLD (1,849 toks) |
PPL (ref = 2.1416) |
Python / C++ Top-1 | Decode (RX 9060 XT 16 GB) | Fits 100% On |
|---|---|---|---|---|---|---|
loop_top8 (Recommended) |
10.87 GB |
0.0542 |
2.1542 |
97.50% / 97.61% |
54.2 tok/s (4K) / 48.6 tok/s (16K) |
16 GB GPUs |
maxcomp (All-2-Bit MoE) |
8.83 GB |
0.1138 |
2.2143 |
95.39% / 96.90% |
56.2 tok/s (4K) |
12 GB & 16 GB GPUs |
- Real coding check vs unquantized
BF16(52.8 GB): On a 15-test reactive spreadsheet compiler + 40-layer diamond DAG suite (benchmarks/included in repo),loop_top8(10.87 GB) solved Stage A (6/6) in 5.3 min (46.9–49.3 tok/s) vs BF16 CPU+GPU hybrid (4/6in 92.5 min at2.6 tok/s), and hit14/15on Stage B. - Fused Triton runtime + HIP/CUDA Graph replay: Includes fused Triton kernels for Inkling-2's 4-tap static/dynamic short-convs, rank-64
message_gate,AttnRes,router_topk, and ring-buffer GQA with chunked prefill (16Kcontext resident inside16 GBVRAM).
30-Second Quick Start (Downloads Only 1 Checkpoint)
pip install -U torch triton safetensors huggingface-hub "transformers>=5.24.0"
huggingface-cli download batteryphil/Inkling-2-Mini-PRIME-Quant \
--include "*.py" "*.json" "*.jinja" "tiktoken/*" "requirements.txt" "inkling2_mini_p2_looptop8.safetensors" \
--local-dir ./Inkling-2-Mini-PRIME-Quant
cd ./Inkling-2-Mini-PRIME-Quant
# Interactive chat:
python run_inkling2_prime.py --variant looptop8 --max-cache-len 16384 --interactive
# Or built-in OpenAI-compatible HTTP/SSE server (Open WebUI / Cursor / Cline / Continue):
python run_inkling2_prime.py --variant looptop8 --max-cache-len 16384 --serve --port 8080
Feedback, CUDA/ROCm speed numbers on other 12–16 GB cards, and benchmark reports are super welcome!