tiny ramdom models
Collection
159 items • Updated • 11
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]:]))How to use tiny-random/inkling-2 with vLLM:
# 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"
}
}
]
}
]
}'docker model run hf.co/tiny-random/inkling-2
How to use tiny-random/inkling-2 with SGLang:
# 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"
}
}
]
}
]
}'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"
}
}
]
}
]
}'How to use tiny-random/inkling-2 with Docker Model Runner:
docker model run hf.co/tiny-random/inkling-2
This is a randomly initialized tiny model based on 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 |
Install Transformers with Inkling 2 support. The bundled loader expands packed expert weights to BF16.
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")
Use the pinned SGLang version and the bundled small-matrix kernel plugin.
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
This repo is generated by GPT-6.1-Sol
Base model
thinkingmachines/Inkling-2-Small
docker model run hf.co/tiny-random/inkling-2