Instructions to use moonshotai/Kimi-K2-Instruct-0905 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use moonshotai/Kimi-K2-Instruct-0905 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="moonshotai/Kimi-K2-Instruct-0905", 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-Instruct-0905", trust_remote_code=True, device_map="auto") - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use moonshotai/Kimi-K2-Instruct-0905 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "moonshotai/Kimi-K2-Instruct-0905" # 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-Instruct-0905", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/moonshotai/Kimi-K2-Instruct-0905
- SGLang
How to use moonshotai/Kimi-K2-Instruct-0905 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-Instruct-0905" \ --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-Instruct-0905", "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-Instruct-0905" \ --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-Instruct-0905", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use moonshotai/Kimi-K2-Instruct-0905 with Docker Model Runner:
docker model run hf.co/moonshotai/Kimi-K2-Instruct-0905
Commit History
-
Transformers v5 support (#21)
Verified signature- Transformers v5 support (227ab582b3b2617d10be2f8bfa78707c3c38e4af) Co-authored-by: Harry Mellor <hmellor@users.noreply.huggingface.co>ac6c49f
-
fix-vocab-size (#17)
Verified signature- fix vocab size (15c1aa443e6aa5877a0aef051055cf54ea01c85c)12d9c7c
-
not add functions. in tool id (#15)
Verified signature- remove functions. in tool_id (b079de4ec9e452b60a608da2c92c0e0ae167395f)94a4053 -
remove-auto-add-str-functions (#14)
Verified signature- remove automatically add 'functions.' in tool id (9ceeeb376b73429099f543daba5aa3429f280e7a)975af05 -
fix apply_chat_template (#13)
Verified signature- fix apply_chat_templation for vllm (85874df3e344fa7da11abec2a5ddb2e9d88d81a1) - fix: check content type (8847e1cd7c71d5e31bca99776b1ec8cde6267d70)46ec167
-
update_chat_template_and_tokenizer (#12)
Verified signature- fix (39edb6d2b748f22aad6e806ac3dfbf7e48d244cf)09d5f93
-
Update README.md
Verified signature7152993 -
Update README.md
Verified signature2ce3235 -
Update README.md
Verified signaturee4f9671 -
Update README.md
Verified signature65191cf
-
Update README.md
Verified signatured30fdf6 -
add FAQ for tool calls.
Verified signatured56abb2
-
update readme
liushaowei13adc1d -
Add files using upload-large-folder tool
Verified signatureb1ad81b -
Add files using upload-large-folder tool
Verified signatureeb1e816 -
Upload config.json with huggingface_hub
Verified signature440d282 -
initial commit
Verified signature86c87f9