Text Generation
Transformers
Safetensors
kimi_k2
conversational
custom_code
Eval Results
compressed-tensors
Instructions to use moonshotai/Kimi-K2-Thinking with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use moonshotai/Kimi-K2-Thinking with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="moonshotai/Kimi-K2-Thinking", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("moonshotai/Kimi-K2-Thinking", trust_remote_code=True, device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use moonshotai/Kimi-K2-Thinking with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "moonshotai/Kimi-K2-Thinking" # 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-Thinking", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/moonshotai/Kimi-K2-Thinking
- SGLang
How to use moonshotai/Kimi-K2-Thinking 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-Thinking" \ --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-Thinking", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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-Thinking" \ --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-Thinking", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use moonshotai/Kimi-K2-Thinking with Docker Model Runner:
docker model run hf.co/moonshotai/Kimi-K2-Thinking
Commit History
-
Transformers v5 support (#53)
Verified signature- Transformers v5 support (8f7dfd66ac78f662f2c326e52a65d028cba01154) Co-authored-by: Harry Mellor <hmellor@users.noreply.huggingface.co>a51ccc0
-
fix-default-system-prompt (#12)
Verified signature- fix default system prompt (324c50995e2b03dc7f3624fc34280c88ba67d2f5)6126819
-
Fix args in SGLang launch command (#9)
Verified signature- Fix args in SGLang launch command (a6aac7760af929ceefcbbbcf41750f9a81d2f0db) Co-authored-by: Ke Bao <ispobock@users.noreply.huggingface.co>f1ed9ca -
Update README.md
Verified signature1b9dbb7 -
fix vocab size (#4)
Verified signature- fix vocab size (5633fd564248e996fc7ee333a35dfc16ab662585)6e3cdad
-
Update LICENSE
Verified signature357b94a -
Update README.md
Verified signature603577f -
Update README.md
Verified signature7d2962b -
Update README.md
Verified signaturef5ed4a8 -
Update README.md
Verified signatured02605f -
Update README.md
Verified signature5b64d2a -
update
liushaoweic9caddd -
update
liushaoweif1cdb45 -
update deploy guidance
liushaowei6dead1a -
fix tokenizer
liushaoweia060a3e -
Update README.md
Unverified signature22bbb72 -
Update README.md
Unverified signature7b23274
-
initial commit
652f5f9