Instructions to use tiny-random/inkling-2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tiny-random/inkling-2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="tiny-random/inkling-2", trust_remote_code=True) 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("tiny-random/inkling-2", trust_remote_code=True) model = AutoModelForMultimodalLM.from_pretrained("tiny-random/inkling-2", trust_remote_code=True, 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tiny-random/inkling-2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tiny-random/inkling-2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tiny-random/inkling-2", "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/tiny-random/inkling-2
- SGLang
How to use tiny-random/inkling-2 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 "tiny-random/inkling-2" \ --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": "tiny-random/inkling-2", "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 "tiny-random/inkling-2" \ --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": "tiny-random/inkling-2", "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 tiny-random/inkling-2 with Docker Model Runner:
docker model run hf.co/tiny-random/inkling-2
|
Download README.md from tiny-random/inkling-2: direct link, hf CLI and curl.
- Browser
- Download file 3.55 kB
-
https://huggingface.co/tiny-random/inkling-2/resolve/main/README.md
- Command line
-
hf download hf://tiny-random/inkling-2/README.md
-
curl -L -o README.md https://huggingface.co/tiny-random/inkling-2/resolve/main/README.md
3.55 kB
| library_name: transformers | |
| pipeline_tag: image-text-to-text | |
| base_model: | |
| - thinkingmachines/Inkling-2-Small | |
| This is a randomly initialized tiny model based on [thinkingmachines/Inkling-2-Small](https://huggingface.co/thinkingmachines/Inkling-2-Small) for testing and debugging. | |
| | Feature | Source | Tiny | | |
| |---|---|---| | |
| | Checkpoint tensor elements (including packed weights/scales) | 8.69B BF16, 565.33K F32, 128.42B F8_E4M3, 247.67B U8 | 16.40M BF16, 3.21K F32, 1.88M F8_E4M3, 940.03K U8 | | |
| | Safetensors weight files (including MTP) | 393.48 GB (25 files) | 35.68 MB (2 files) | | |
| | Decoder layers / attention residual block | 48 / 6 | 12 / 6 | | |
| | Attention cycle | 5 SWA + 1 global | Same; two complete cycles | | |
| | Routed experts / experts per token | 384 / 8 | 96 / 8 | | |
| | Expert precision | 40 NVFP4 + 8 MXFP8 layers | 6 NVFP4 + 6 MXFP8 layers | | |
| | Vocabulary / tied embeddings | 201,024 / false | 201,024 / false | | |
| | Hidden / expert width | 4,608 / 2,304 | 32 / 32 | | |
| | Q heads / KV heads / head dimension | 48 / 8 / 128 | 24 / 4 / 32 | | |
| | Vision width / layers | 1,024 / 23 | 32 / 4 | | |
| | MTP layers / block size / Markov rank | 5 / 8 / 256 | 5 / 8 / 8 | | |
| | MTP feature taps | 5,11,17,23,29,35,41,48 | 5,12 (final norm sentinel) | | |
| | File path | Size | | |
| |------|------| | |
| | model.safetensors | 31.7MB | | |
| | mtp.safetensors | 4.0MB | | |
| ### Example usage | |
| #### Transformers (unverified) | |
| Install [Transformers with Inkling 2 support](https://github.com/huggingface/transformers/tree/c748111b3bb4d97df452f0fe60e63c480beb6fe6). The bundled loader expands packed expert weights to BF16. | |
| ```python | |
| def run_transformers(model_id: str): | |
| import torch | |
| from PIL import Image | |
| from transformers import AutoModelForImageTextToText, AutoProcessor | |
| processor = AutoProcessor.from_pretrained(model_id) | |
| model = AutoModelForImageTextToText.from_pretrained( | |
| model_id, trust_remote_code=True, dtype=torch.bfloat16, device_map="cuda" | |
| ) | |
| image = Image.new("RGB", (80, 80), (80, 120, 160)) | |
| inputs = processor(text=f"{processor.image_token}Describe this image.", images=image, return_tensors="pt").to( | |
| model.device | |
| ) | |
| with torch.inference_mode(): | |
| output = model.generate(**inputs, max_new_tokens=10, min_new_tokens=10, do_sample=False) | |
| print(processor.batch_decode(output[:, inputs.input_ids.shape[1] :], skip_special_tokens=True)) | |
| if __name__ == "__main__": | |
| run_transformers(model_id="tiny-random/inkling-2") | |
| ``` | |
| #### SGLang serving (unverified) | |
| Use the pinned SGLang version and the bundled small-matrix kernel plugin. | |
| ```bash | |
| SGLANG_BUILD_RUST_EXTS=none pip install 'git+https://github.com/sgl-project/sglang.git@f726172d760dea737c7f1e797c9f32efe14d1685#subdirectory=python' | |
| hf download tiny-random/inkling-2 --local-dir inkling-2-tiny | |
| pip install --no-deps ./inkling-2-tiny | |
| sglang serve --model-path ./inkling-2-tiny --tp 4 --ep 4 \ | |
| --dtype bfloat16 --attention-backend fa4 --enable-multimodal \ | |
| --context-length 2048 --mem-fraction-static 0.2 \ | |
| --disable-custom-all-reduce \ | |
| --cuda-graph-config '{"decode": {"bs": [1, 2, 4]}, "prefill": {"bs": [128, 2048]}}' \ | |
| --reasoning-parser inkling --tool-call-parser inkling2 | |
| ``` | |
| ### Creating this repo | |
| - Code: [.meta/create_model.py](.meta/create_model.py) | |
| - Model structure: [.meta/model.log](.meta/model.log) | |
| - Environment: [.meta/env.json](.meta/env.json) | |
| ### Change log | |
| - 2026-11-14: Updated tiny Inkling 2 with 96 mixed NVFP4/MXFP8 experts, independent token embeddings/output head, and BF16 MTP. | |
| *This repo is generated by GPT-6.1-Sol* |