Image-Text-to-Text
Transformers
Safetensors
kimi_k3
feature-extraction
compressed-tensors
unsloth
conversational
custom_code
Eval Results
8-bit precision
Instructions to use unsloth/Kimi-K3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsloth/Kimi-K3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="unsloth/Kimi-K3", 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 AutoModel model = AutoModel.from_pretrained("unsloth/Kimi-K3", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use unsloth/Kimi-K3 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "unsloth/Kimi-K3" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsloth/Kimi-K3", "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/unsloth/Kimi-K3
- SGLang
How to use unsloth/Kimi-K3 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 "unsloth/Kimi-K3" \ --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": "unsloth/Kimi-K3", "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 "unsloth/Kimi-K3" \ --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": "unsloth/Kimi-K3", "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" } } ] } ] }' - Unsloth Desktop
- Docker Model Runner
How to use unsloth/Kimi-K3 with Docker Model Runner:
docker model run hf.co/unsloth/Kimi-K3
Commit History
-
Accept an empty mapping as message content
Verified signatureA user message whose content is an empty mapping renders as empty content in the official encoder: _render_content_segments iterates `for part in content`, which for {} is zero iterations. Any non-empty mapping iterates its keys instead and dies on part["type"]. The template rejected every mapping, so it refused a request the model's own encoder accepts. Found by scoring the template against a 1451 case corpus built independently of our own fixtures. That corpus now reports 1409 exact, 0 mismatches, 40 cases where both implementations correctly reject the input, and 2 remaining differences, both a deliberate decision: a schema dict with mixed int and str keys makes CPython's json.dumps(sort_keys=True) raise TypeError, which is an incidental sort crash rather than a validation rule, and cannot arrive over a JSON API where object keys are always strings.6095bb6 -
Shorten the header comment
Verified signatureComment only. Rendered output is byte identical on all 231 fixtures.9735926 -
Honour the documented reasoning_effort request field
Verified signatureplatform.kimi.ai documents reasoning_effort as K3's top-level Chat Completions field: "supports low, high and max, with max as the default", and "when migrating from K2.x to K3, remove the K2.x thinking configuration and use top-level reasoning_effort as needed". The template previously read only thinking_effort, which is the name the local Python encoder uses as a kwarg. A client following Moonshot's own documentation sends reasoning_effort, so every such request silently ran at max with no way to lower it. Behaviour now: - reasoning_effort low, high or max is honoured. - thinking_effort wins if both are supplied, so nothing that worked before changes. - reasoning_effort none disables thinking, matching what llama.cpp already does with that value in tools/server/server-common.cpp before the template runs. - values K3 does not define, such as OpenAI's medium and minimal, fall back to the default rather than raising, since they arrive in a foreign namespace. The encoder's own thi…196c48d -
Remove comments from chat_template.jinja
Verified signatureThe rendered output is unchanged: this template is byte-identical to the previous one on every input tested (227 fixtures under transformers' jinja environment, the same sweep through llama.cpp's engine, and a separate 1189 case corpus, all producing identical bytes before and after). Only the Jinja comments are gone. 60 comment blocks removed, 33389 characters down to 24534. Comments are not free in this file: it is embedded in GGUF metadata and in tokenizer_config.json, and llama.cpp's common_chat_try_specialized_template substring matches the raw template source including comments when it picks a per model handler. A four line header remains, recording the two deliberate differences from the Python reference that exist for llama.cpp compatibility.e3e340f -
Update chat_template.jinja to match the official encoder
Verified signatureThe previous template diverged from tokenization_kimi.TikTokenTokenizer.apply_chat_template for every conversation that declares tools, and in several other places. This version is verified byte for byte against apply_chat_template (not against the lower level build_chat_segments, which sits below the thinking_effort and image_prompts defaults). Coverage: 227 fixtures under transformers' own jinja environment plus the same sweep through llama.cpp's engine via llama-server /apply-template, and a separate 1189 case corpus. What changed: - tool and response schema JSON is now recursively key sorted with compact separators, so the prompt bytes match. This alone accounted for every tools conversation differing. - parallel tool result runs are reordered by tool_call_id, and a matched assistant call now overrides a stale name on the result message. - whitespace only reasoning content renders an empty think body instead of leaking through. - JSON string tool arguments are decoded and re…3b6ad35
-
Delete __pycache__
Verified signature27b1e98 -
Upload folder using huggingface_hub
Verified signaturefad3d2e -
Upload folder using huggingface_hub
Verified signature105c5bb -
Update README.md
Verified signaturee553bc3 -
Add files using upload-large-folder tool
Verified signaturee6818d0 -
Add files using upload-large-folder tool
Verified signaturea1c0942 -
Add files using upload-large-folder tool
Verified signaturebc5d60c -
Add files using upload-large-folder tool
Verified signatureb1c5f1d -
Create README.md
Verified signature8580b5a -
initial commit
Verified signaturea454650