Instructions to use hyper-accel/tiny-random-kimi-k2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hyper-accel/tiny-random-kimi-k2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="hyper-accel/tiny-random-kimi-k2", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("hyper-accel/tiny-random-kimi-k2", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use hyper-accel/tiny-random-kimi-k2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hyper-accel/tiny-random-kimi-k2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hyper-accel/tiny-random-kimi-k2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/hyper-accel/tiny-random-kimi-k2
- SGLang
How to use hyper-accel/tiny-random-kimi-k2 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 "hyper-accel/tiny-random-kimi-k2" \ --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": "hyper-accel/tiny-random-kimi-k2", "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 "hyper-accel/tiny-random-kimi-k2" \ --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": "hyper-accel/tiny-random-kimi-k2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use hyper-accel/tiny-random-kimi-k2 with Docker Model Runner:
docker model run hf.co/hyper-accel/tiny-random-kimi-k2
| { | |
| "_attn_implementation_autoset": false, | |
| "add_cross_attention": false, | |
| "architectures": [ | |
| "KimiK2ForCausalLM" | |
| ], | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "auto_map": { | |
| "AutoConfig": "configuration_kimi_k2.KimiK2Config", | |
| "AutoModelForCausalLM": "modeling_kimi_k2.KimiK2ForCausalLM" | |
| }, | |
| "aux_loss_alpha": 0.001, | |
| "bos_token_id": 163584, | |
| "cross_attention_hidden_size": null, | |
| "decoder_start_token_id": null, | |
| "dtype": "float32", | |
| "eos_token_id": 163585, | |
| "finetuning_task": null, | |
| "first_k_dense_replace": 1, | |
| "head_dim": 16, | |
| "hidden_act": "silu", | |
| "hidden_size": 512, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 256, | |
| "is_decoder": false, | |
| "kv_lora_rank": 32, | |
| "max_position_embeddings": 131072, | |
| "model_type": "kimi_k2", | |
| "moe_intermediate_size": 256, | |
| "moe_layer_freq": 1, | |
| "n_group": 1, | |
| "n_routed_experts": 4, | |
| "n_shared_experts": 1, | |
| "norm_topk_prob": true, | |
| "num_attention_heads": 8, | |
| "num_experts_per_tok": 2, | |
| "num_hidden_layers": 2, | |
| "num_key_value_heads": 8, | |
| "num_nextn_predict_layers": 0, | |
| "pad_token_id": null, | |
| "prefix": null, | |
| "pretraining_tp": 1, | |
| "pruned_heads": {}, | |
| "q_lora_rank": 64, | |
| "qk_head_dim": 48, | |
| "qk_nope_head_dim": 32, | |
| "qk_rope_head_dim": 16, | |
| "rms_norm_eps": 1e-06, | |
| "rope_interleave": true, | |
| "rope_parameters": { | |
| "beta_fast": 1.0, | |
| "beta_slow": 1.0, | |
| "factor": 32.0, | |
| "mscale": 1.0, | |
| "mscale_all_dim": 1.0, | |
| "original_max_position_embeddings": 4096, | |
| "rope_theta": 50000.0, | |
| "rope_type": "yarn", | |
| "type": "yarn" | |
| }, | |
| "routed_scaling_factor": 2.827, | |
| "scoring_func": "sigmoid", | |
| "sep_token_id": null, | |
| "seq_aux": true, | |
| "task_specific_params": null, | |
| "tf_legacy_loss": false, | |
| "tie_encoder_decoder": false, | |
| "tie_word_embeddings": false, | |
| "tokenizer_class": null, | |
| "topk_group": 1, | |
| "topk_method": "noaux_tc", | |
| "torchscript": false, | |
| "transformers_version": "5.3.0", | |
| "use_bfloat16": false, | |
| "use_cache": true, | |
| "v_head_dim": 32, | |
| "vocab_size": 163840 | |
| } | |