How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("image-text-to-text", model="lightseekorg/Inkling-Small-MXFP4")
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("lightseekorg/Inkling-Small-MXFP4")
model = AutoModelForMultimodalLM.from_pretrained("lightseekorg/Inkling-Small-MXFP4", 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]:]))
Quick Links

Inkling-Small-MXFP4

Model Overview

  • Base model: thinkingmachines/Inkling-Small
  • Architecture: 42-layer multimodal sparse Mixture-of-Experts transformer
    • Parameters: 276B total, 12B active
    • Input: Text, image, and audio
    • Output: Text
  • Inference engine: TokenSpeed
  • Model optimizer: AMD Quark (0.12.post1+rocm72.torch2.11)
    • Quantized layers: MoE routed experts in transformer layers 3-41
    • Weight quantization: OCP MXFP4, static, group size 32
    • Activation quantization: OCP MXFP4, dynamic, group size 32

This checkpoint was produced by applying AMD Quark MXFP4 file-to-file quantization to the BF16 Inkling-Small checkpoint. Attention layers, shared experts, router weights, embeddings, normalization layers, multimodal components, MTP weights, and transformer layers 0-2 remain in BF16.

Environment

The quantization was performed on an AMD gfx950 system with the following software:

  • GPU: AMD MI350/MI355
  • Target graphics version: gfx950
  • ROCm: 7.2.1
  • Python: 3.12.3
  • PyTorch: 2.13.0+rocm7.1
  • AMD Quark: 0.12.post1+rocm72.torch2.11
  • Safetensors: 0.8.0

Create and activate a dedicated Quark environment:

python3 -m venv ~/.venv-quark
source ~/.venv-quark/bin/activate

Install the required packages:

python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/rocm7.1
python -m pip install amd-quark --extra-index-url https://pypi.amd.com/quark/rocm72/simple
python -m pip install safetensors transformers accelerate tqdm

Model Quantization

The included quantize_quark.py uses Quark's file-to-file flow to process safetensor shards without loading the full BF16 checkpoint into GPU memory. It automatically applies the Inkling-Small exclusion policy and quantizes only routed expert weights in layers 3-41.

python quantize_quark.py \
  --model_dir /path/to/Inkling-Small \
  --output_dir /path/to/Inkling-Small-MXFP4 \
  --quant_scheme mxfp4 \
  --file2file_quantization

Deployment

This model can be served with TokenSpeed:

tokenspeed serve \
  --model lightseekorg/Inkling-Small-MXFP4 \
  --attn-tp-size 1 \
  --moe-tp-size 1 \
  --max-model-len 81920 \
  --max-num-seqs 16 \
  --max-prefill-tokens 8192 \
  --chunked-prefill-size 8192 \
  --gpu-memory-utilization 0.95 \
  --disable-cuda-graph-padding \
  --trust-remote-code \
  --dtype bfloat16 \
  --disable-kvstore \
  --kvstore-ratio 0 \
  --block-size 128 \
  --speculative-algorithm MTP \
  --speculative-num-steps 3 \
  --speculative-eagle-topk 1 \
  --speculative-num-draft-tokens 4 \
  --host 127.0.0.1 \
  --port 22015
Downloads last month
83
Safetensors
Model size
148B params
Tensor type
F32
路
BF16
路
U8
路
Inference Providers NEW
This model isn't deployed by any Inference Provider. 馃檵 Ask for provider support

Model tree for lightseekorg/Inkling-Small-MXFP4

Quantized
(54)
this model