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)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("IFM/K2-Horizon-0.9B", trust_remote_code=True, device_map="auto") - Inference
- 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
Commit History
Yesterday
-
Update README.md
Verified signaturec4f92a0
3 days ago
-
Fix `output_hidden_states` / `attentions` returning None (missing `@capture_outputs`) (#8)
- Add @capture_outputs to K2HorizonModel.forward so output_hidden_states works (11f653a2e9081d57367c3f4a0fb9921ed3a54656) - Record attentions from K2HorizonMoVAAttention layers too (e0cb9221fc00f4df48d13dd96350213e4fd021ee) Co-authored-by: Léon Simmons <Avicennasis@users.noreply.huggingface.co>9f3d124
10 days ago
-
Fix: add the missing @capture_outputs decorator (output_hidden_states is None)
Fixes the issue reported in discussion #6. `K2HorizonModel.forward` carries `@auto_docstring` but not `@capture_outputs`, so `output_hidden_states=True` returns `None` (any tool that reads the residual stream per layer fails). Adding the decorator plus the import makes `outputs.hidden_states` a tuple of len `num_hidden_layers + 1`; greedy decoding is unchanged. Verified on 0.9B: 29 states (28 layers + 1), `[0]` == embeddings and `[-1]` == `last_hidden_state`; generation byte-identical with and without the decorator. The change is the same for every full-model repo in the family (the file is byte-identical across sizes). (#9) - Fix: add the missing @capture_outputs decorator (output_hidden_states is None) (86715a07e5fe195ecf46f1fbd6ff85d53b73cf6c) Co-authored-by: Léon Simmons <Avicennasis@users.noreply.huggingface.co>d50881f
16 days ago
-
Align chat_template.jinja (#15)
- Align chat_template.jinja (965705d6576e836de74457d5a38ea8a5e1841016) Co-authored-by: Aaryamonvikram Singh <aaryamonvikram@users.noreply.huggingface.co>7c75f2f -
Removal of redundant chat templates (#14)
- Removal of redundant chat templates (82687b6294204b7fe5e91d9a10f098276b76106c) Co-authored-by: Aaryamonvikram Singh <aaryamonvikram@users.noreply.huggingface.co>f7bbede
30 days ago
-
Support OpenAI-style text content lists (#10)
- Support OpenAI-style text content lists (3e311d5c7f6aa7b7dd9f0e3af65578ab60d7e6ae) Co-authored-by: Seungwook Han <hanseungwook@users.noreply.huggingface.co>383cb66
-
Promote checkpoint rl-mopd_249 to main
HF release automation76db896 -
Fix typo and wording.
Verified signature108340d
-
Release artifacts updated.
Verified signaturefa7f5de
-
Delete files migration_manifest.json validation.json with huggingface_hub
Verified signature6fbc54f
-
Add a note on ckpt usage
Verified signature309fc17
-
Update model card
Verified signature6436b72 -
Update model card
Verified signaturea9e364e
-
Preserve checkpoint history: rl_stem
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.9fa6faa -
Publish checkpoint rl_stem
HF release automationHF-Main-Only-Checkpoint: 1acd705e -
Preserve checkpoint history: rl_if
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.ddbe3c9 -
Publish checkpoint rl_if
HF release automationHF-Main-Only-Checkpoint: 1be908c0 -
Preserve checkpoint history: rl_code2
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.fb59197 -
Publish checkpoint rl_code2
HF release automationHF-Main-Only-Checkpoint: 149b919a -
Preserve checkpoint history: rl_math2b
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.69bcdbf -
Publish checkpoint rl_math2b
HF release automationHF-Main-Only-Checkpoint: 1c1e52cd -
Preserve checkpoint history: rl_math2a
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.6fa6461 -
Publish checkpoint rl_math2a
HF release automationHF-Main-Only-Checkpoint: 10d0a126
-
Preserve checkpoint history: rl_code1
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.092a2c5 -
Publish checkpoint rl_code1
HF release automationHF-Main-Only-Checkpoint: 18c9b1ad -
Preserve checkpoint history: rl_math1
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.ce6e8d0 -
Publish checkpoint rl_math1
HF release automationHF-Main-Only-Checkpoint: 1f7c200e
-
Update ckpt progress
Verified signatured0a0fa2
-
Update README.md
Verified signaturefix license40b7742 -
Fix words to be accurate
Verified signaturec58113b -
Preserve checkpoint history: rl_rl-merged
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.6ac3c9f -
Preserve checkpoint history: rl-mopd_249
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.312356f -
Preserve checkpoint history: mid_2_5000
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.08a5947 -
Preserve checkpoint history: mid_2_10000
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.95607e8 -
Preserve checkpoint history: mid_2_15000
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.763a1d2 -
Preserve checkpoint history: mid_2_20000
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.6da49fa -
Preserve checkpoint history: mid_2_25000
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.7988f4c -
Preserve checkpoint history: mid_2_30000
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.3048fc5 -
Preserve checkpoint history: mid_2_35000
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.43a22e8 -
Preserve checkpoint history: mid_2_40000
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.effff8f -
Preserve checkpoint history: mid_2_45000
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.125fb36 -
Preserve checkpoint history: mid_2_47684
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.75e9db5 -
Preserve checkpoint history: mid_1_50000
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.aed6997 -
Preserve checkpoint history: mid_1_55000
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.9b5121a -
Preserve checkpoint history: mid_1_60000
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.6a8c7f1 -
Preserve checkpoint history: mid_1_65000
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.2238bf2 -
Preserve checkpoint history: mid_1_70000
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.d6c4954 -
Preserve checkpoint history: mid_1_75000
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.3feb7e1 -
Preserve checkpoint history: pretrain_500000
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.757516c -
Preserve checkpoint history: pretrain_510000
HF release automationHF-Content-Preserving-Merge: 1 Main file tree intentionally unchanged.4356ff4