Instructions to use lightseekorg/Inkling-Small-MXFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lightseekorg/Inkling-Small-MXFP4 with Transformers:
# 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)# 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use lightseekorg/Inkling-Small-MXFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lightseekorg/Inkling-Small-MXFP4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lightseekorg/Inkling-Small-MXFP4", "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/lightseekorg/Inkling-Small-MXFP4
- SGLang
How to use lightseekorg/Inkling-Small-MXFP4 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 "lightseekorg/Inkling-Small-MXFP4" \ --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": "lightseekorg/Inkling-Small-MXFP4", "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 "lightseekorg/Inkling-Small-MXFP4" \ --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": "lightseekorg/Inkling-Small-MXFP4", "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 lightseekorg/Inkling-Small-MXFP4 with Docker Model Runner:
docker model run hf.co/lightseekorg/Inkling-Small-MXFP4
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
- -
Model tree for lightseekorg/Inkling-Small-MXFP4
Base model
thinkingmachines/Inkling-Small