Text Generation
Transformers
Safetensors
English
Chinese
k2_horizon
k2-horizon
0.9b
dense
reasoning
knowledge-distillation
ifm
conversational
custom_code
Instructions to use IFM/K2-Horizon-0.9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use IFM/K2-Horizon-0.9B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="IFM/K2-Horizon-0.9B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("IFM/K2-Horizon-0.9B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use IFM/K2-Horizon-0.9B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "IFM/K2-Horizon-0.9B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "IFM/K2-Horizon-0.9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/IFM/K2-Horizon-0.9B
- SGLang
How to use IFM/K2-Horizon-0.9B 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 "IFM/K2-Horizon-0.9B" \ --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": "IFM/K2-Horizon-0.9B", "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 "IFM/K2-Horizon-0.9B" \ --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": "IFM/K2-Horizon-0.9B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use IFM/K2-Horizon-0.9B with Docker Model Runner:
docker model run hf.co/IFM/K2-Horizon-0.9B
Upload config.json to rl-mopd
Browse files- config.json +88 -0
config.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"K2HorizonForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"auto_map": {
|
| 8 |
+
"AutoConfig": "configuration_k2_horizon.K2HorizonConfig",
|
| 9 |
+
"AutoModel": "modeling_k2_horizon.K2HorizonModel",
|
| 10 |
+
"AutoModelForCausalLM": "modeling_k2_horizon.K2HorizonForCausalLM"
|
| 11 |
+
},
|
| 12 |
+
"bos_token_id": 0,
|
| 13 |
+
"decoder_sparse_step": 1,
|
| 14 |
+
"dtype": "float32",
|
| 15 |
+
"eos_token_id": 1,
|
| 16 |
+
"head_dim": 64,
|
| 17 |
+
"hidden_act": "silu",
|
| 18 |
+
"hidden_size": 1536,
|
| 19 |
+
"initializer_range": 0.02,
|
| 20 |
+
"intermediate_size": 5120,
|
| 21 |
+
"layernorm_num_groups": 1,
|
| 22 |
+
"max_position_embeddings": 131072,
|
| 23 |
+
"mlp_only_layers": [
|
| 24 |
+
0,
|
| 25 |
+
1,
|
| 26 |
+
2,
|
| 27 |
+
3,
|
| 28 |
+
4,
|
| 29 |
+
5,
|
| 30 |
+
6,
|
| 31 |
+
7,
|
| 32 |
+
8,
|
| 33 |
+
9,
|
| 34 |
+
10,
|
| 35 |
+
11,
|
| 36 |
+
12,
|
| 37 |
+
13,
|
| 38 |
+
14,
|
| 39 |
+
15,
|
| 40 |
+
16,
|
| 41 |
+
17,
|
| 42 |
+
18,
|
| 43 |
+
19,
|
| 44 |
+
20,
|
| 45 |
+
21,
|
| 46 |
+
22,
|
| 47 |
+
23,
|
| 48 |
+
24,
|
| 49 |
+
25,
|
| 50 |
+
26,
|
| 51 |
+
27
|
| 52 |
+
],
|
| 53 |
+
"model_type": "k2_horizon",
|
| 54 |
+
"moe_gate_bias": false,
|
| 55 |
+
"moe_intermediate_size": 0,
|
| 56 |
+
"norm_topk_prob": true,
|
| 57 |
+
"num_attention_heads": 32,
|
| 58 |
+
"num_experts": 0,
|
| 59 |
+
"num_experts_per_tok": 0,
|
| 60 |
+
"num_hidden_layers": 28,
|
| 61 |
+
"num_key_value_heads": 8,
|
| 62 |
+
"num_shared_experts": 0,
|
| 63 |
+
"original_max_position_embeddings": 8192,
|
| 64 |
+
"output_router_logits": false,
|
| 65 |
+
"pad_token_id": 64255,
|
| 66 |
+
"query_key_norm": false,
|
| 67 |
+
"rms_norm_eps": 1e-06,
|
| 68 |
+
"rope_head_dim": 64,
|
| 69 |
+
"rope_parameters": {
|
| 70 |
+
"attention_factor": 1.2772588722239782,
|
| 71 |
+
"beta_fast": 128.0,
|
| 72 |
+
"beta_slow": 4.0,
|
| 73 |
+
"factor": 16.0,
|
| 74 |
+
"original_max_position_embeddings": 8192,
|
| 75 |
+
"rope_type": "yarn",
|
| 76 |
+
"truncate": true
|
| 77 |
+
},
|
| 78 |
+
"rope_theta": 1000000.0,
|
| 79 |
+
"router_aux_loss_coef": 0.001,
|
| 80 |
+
"router_scaling_factor": null,
|
| 81 |
+
"router_score_func": "sigmoid",
|
| 82 |
+
"sliding_window": null,
|
| 83 |
+
"tie_word_embeddings": false,
|
| 84 |
+
"transformers_version": "4.57.1",
|
| 85 |
+
"use_cache": true,
|
| 86 |
+
"use_sliding_window": false,
|
| 87 |
+
"vocab_size": 64256
|
| 88 |
+
}
|