Instructions to use moonshotai/Kimi-K2.6 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use moonshotai/Kimi-K2.6 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="moonshotai/Kimi-K2.6", 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)# Load model directly from transformers import AutoProcessor, AutoModel processor = AutoProcessor.from_pretrained("moonshotai/Kimi-K2.6", trust_remote_code=True) model = AutoModel.from_pretrained("moonshotai/Kimi-K2.6", 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use moonshotai/Kimi-K2.6 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "moonshotai/Kimi-K2.6" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "moonshotai/Kimi-K2.6", "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/moonshotai/Kimi-K2.6
- SGLang
How to use moonshotai/Kimi-K2.6 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 "moonshotai/Kimi-K2.6" \ --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": "moonshotai/Kimi-K2.6", "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 "moonshotai/Kimi-K2.6" \ --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": "moonshotai/Kimi-K2.6", "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 moonshotai/Kimi-K2.6 with Docker Model Runner:
docker model run hf.co/moonshotai/Kimi-K2.6
Update SGLang deployment guide: point to K2.6 cookbook and use stable release
Browse filesThe SGLang section previously linked to the Kimi-K2.5 cookbook and required a `git+https://github.com/sgl-project/sglang.git` install from `main`. Kimi-K2.6 now has a dedicated cookbook page and is supported in the SGLang v0.5.10 stable release (available on PyPI), so a nightly/main build is no longer required.
Changes (SGLang section only):
- Update cookbook URL: Kimi-K2.5 -> Kimi-K2.6 (https://cookbook.sglang.io/autoregressive/Moonshotai/Kimi-K2.6)
- Replace "latest main" git install with `pip install "sglang[all]>=0.5.10"`
- Drop the separate `nvidia-cudnn-cu12==9.16.0.29` pin (bundled with the stable wheel)
No changes to vLLM or KTransformers sections.
- docs/deploy_guidance.md +4 -5
|
@@ -28,16 +28,15 @@ vllm serve $MODEL_PATH -tp 8 --mm-encoder-tp-mode data --trust-remote-code --too
|
|
| 28 |
|
| 29 |
## SGLang Deployment
|
| 30 |
|
| 31 |
-
You can refer to https://cookbook.sglang.io/autoregressive/Moonshotai/Kimi-K2.
|
| 32 |
|
| 33 |
-
This model is
|
| 34 |
|
| 35 |
```
|
| 36 |
-
pip install "sglang
|
| 37 |
-
pip install nvidia-cudnn-cu12==9.16.0.29
|
| 38 |
```
|
| 39 |
|
| 40 |
-
|
| 41 |
``` bash
|
| 42 |
sglang serve --model-path $MODEL_PATH --tp 8 --trust-remote-code --tool-call-parser kimi_k2 --reasoning-parser kimi_k2
|
| 43 |
```
|
|
|
|
| 28 |
|
| 29 |
## SGLang Deployment
|
| 30 |
|
| 31 |
+
You can refer to https://cookbook.sglang.io/autoregressive/Moonshotai/Kimi-K2.6 for the newest deployment guide.
|
| 32 |
|
| 33 |
+
This model is supported in SGLang v0.5.10 and later stable releases (no nightly / main build required):
|
| 34 |
|
| 35 |
```
|
| 36 |
+
pip install "sglang[all]>=0.5.10"
|
|
|
|
| 37 |
```
|
| 38 |
|
| 39 |
+
Here is the example for it to run with TP8 on H200 in a single node via SGLang:
|
| 40 |
``` bash
|
| 41 |
sglang serve --model-path $MODEL_PATH --tp 8 --trust-remote-code --tool-call-parser kimi_k2 --reasoning-parser kimi_k2
|
| 42 |
```
|