Text Generation
Transformers
Safetensors
English
k2_horizon
k2-horizon
32b
dense
open-weights
ifm
conversational
custom_code
Instructions to use IFM/K2-Horizon-32B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use IFM/K2-Horizon-32B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="IFM/K2-Horizon-32B", 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-32B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use IFM/K2-Horizon-32B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "IFM/K2-Horizon-32B" # 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-32B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/IFM/K2-Horizon-32B
- SGLang
How to use IFM/K2-Horizon-32B 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-32B" \ --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-32B", "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-32B" \ --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-32B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use IFM/K2-Horizon-32B with Docker Model Runner:
docker model run hf.co/IFM/K2-Horizon-32B
Upload config.json to mid_5
Browse files- config.json +120 -0
config.json
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"K2HorizonForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"attention_gate_func": null,
|
| 8 |
+
"auto_map": {
|
| 9 |
+
"AutoConfig": "configuration_k2_horizon.K2HorizonConfig",
|
| 10 |
+
"AutoModel": "modeling_k2_horizon.K2HorizonModel",
|
| 11 |
+
"AutoModelForCausalLM": "modeling_k2_horizon.K2HorizonForCausalLM"
|
| 12 |
+
},
|
| 13 |
+
"bos_token_id": 0,
|
| 14 |
+
"decoder_sparse_step": 1,
|
| 15 |
+
"dtype": "bfloat16",
|
| 16 |
+
"eos_token_id": 1,
|
| 17 |
+
"head_dim": 128,
|
| 18 |
+
"hidden_act": "silu",
|
| 19 |
+
"hidden_size": 5120,
|
| 20 |
+
"initializer_range": 0.02,
|
| 21 |
+
"intermediate_size": 26624,
|
| 22 |
+
"layernorm_num_groups": 4,
|
| 23 |
+
"max_position_embeddings": 524288,
|
| 24 |
+
"mlp_only_layers": [
|
| 25 |
+
0,
|
| 26 |
+
1,
|
| 27 |
+
2,
|
| 28 |
+
3,
|
| 29 |
+
4,
|
| 30 |
+
5,
|
| 31 |
+
6,
|
| 32 |
+
7,
|
| 33 |
+
8,
|
| 34 |
+
9,
|
| 35 |
+
10,
|
| 36 |
+
11,
|
| 37 |
+
12,
|
| 38 |
+
13,
|
| 39 |
+
14,
|
| 40 |
+
15,
|
| 41 |
+
16,
|
| 42 |
+
17,
|
| 43 |
+
18,
|
| 44 |
+
19,
|
| 45 |
+
20,
|
| 46 |
+
21,
|
| 47 |
+
22,
|
| 48 |
+
23,
|
| 49 |
+
24,
|
| 50 |
+
25,
|
| 51 |
+
26,
|
| 52 |
+
27,
|
| 53 |
+
28,
|
| 54 |
+
29,
|
| 55 |
+
30,
|
| 56 |
+
31,
|
| 57 |
+
32,
|
| 58 |
+
33,
|
| 59 |
+
34,
|
| 60 |
+
35,
|
| 61 |
+
36,
|
| 62 |
+
37,
|
| 63 |
+
38,
|
| 64 |
+
39,
|
| 65 |
+
40,
|
| 66 |
+
41,
|
| 67 |
+
42,
|
| 68 |
+
43,
|
| 69 |
+
44,
|
| 70 |
+
45,
|
| 71 |
+
46,
|
| 72 |
+
47,
|
| 73 |
+
48,
|
| 74 |
+
49,
|
| 75 |
+
50,
|
| 76 |
+
51,
|
| 77 |
+
52,
|
| 78 |
+
53,
|
| 79 |
+
54,
|
| 80 |
+
55,
|
| 81 |
+
56,
|
| 82 |
+
57,
|
| 83 |
+
58,
|
| 84 |
+
59,
|
| 85 |
+
60,
|
| 86 |
+
61,
|
| 87 |
+
62,
|
| 88 |
+
63
|
| 89 |
+
],
|
| 90 |
+
"model_type": "k2_horizon",
|
| 91 |
+
"moe_gate_bias": false,
|
| 92 |
+
"moe_intermediate_size": 0,
|
| 93 |
+
"mova_num_experts": 0,
|
| 94 |
+
"mova_num_experts_per_tok": 0,
|
| 95 |
+
"norm_topk_prob": true,
|
| 96 |
+
"num_attention_heads": 64,
|
| 97 |
+
"num_experts": 0,
|
| 98 |
+
"num_experts_per_tok": 0,
|
| 99 |
+
"num_hidden_layers": 64,
|
| 100 |
+
"num_key_value_heads": 8,
|
| 101 |
+
"num_shared_experts": 0,
|
| 102 |
+
"output_router_logits": false,
|
| 103 |
+
"pad_token_id": null,
|
| 104 |
+
"query_key_norm": false,
|
| 105 |
+
"rms_norm_eps": 1e-06,
|
| 106 |
+
"rope_head_dim": 128,
|
| 107 |
+
"rope_parameters": {
|
| 108 |
+
"rope_theta": 10000000.0,
|
| 109 |
+
"rope_type": "default"
|
| 110 |
+
},
|
| 111 |
+
"router_aux_loss_coef": 0.001,
|
| 112 |
+
"router_scaling_factor": 1.0,
|
| 113 |
+
"router_score_func": "sigmoid",
|
| 114 |
+
"sliding_window": null,
|
| 115 |
+
"tie_word_embeddings": false,
|
| 116 |
+
"transformers_version": "5.13.0",
|
| 117 |
+
"use_cache": true,
|
| 118 |
+
"use_sliding_window": false,
|
| 119 |
+
"vocab_size": 250624
|
| 120 |
+
}
|