Image-Text-to-Text
Transformers
Safetensors
kimi_k25
feature-extraction
compressed-tensors
conversational
custom_code
Eval Results
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
Commit ·
bc8e704
1
Parent(s): 2b2b88e
Update SGLang deployment guide: point to K2.6 cookbook and use stable release (#6)
Browse files- Update SGLang deployment guide: point to K2.6 cookbook and use stable release (b5632fb78a0f133882b5d4ecfe53913221f3a039)
- Use sglang>=0.5.10.post1 (drop [all] extra) (8a5354a4c1cde1ee18cebf4d61a6ae02f8916887)
- Use uv (preferred) with --prerelease=allow for sglang install (06b359a11c97ad794eafbf128e3836ed03cfcfc5)
Co-authored-by: Xinyuan Tong <JustinTong@users.noreply.huggingface.co>
- docs/deploy_guidance.md +4 -5
docs/deploy_guidance.md
CHANGED
|
@@ -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). `uv` is preferred:
|
| 34 |
|
| 35 |
```
|
| 36 |
+
uv pip install "sglang>=0.5.10.post1" --prerelease=allow
|
|
|
|
| 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 |
```
|