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") - 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
A few reproducible observations from the current K2-Horizon public artifacts
#11
by Sahalk7 - opened
Hi Hector / K2 team,
After the previous issue was fixed, I kept looking through the current public K2-Horizon files and found a few more things that I think are worth flagging.
These are separate from the content-handling issue that was just fixed.
- XML tool-call rendering
In the xml / xml_typed tool-call formats, I can make two different tool-call argument structures render to the exact same prompt text. I reproduced this with valid tool names and the same tool schema on both sides. - Some schema information disappears in markdown/XML
Root additionalProperties and patternProperties can be accepted by the template but not actually shown in the markdown/XML tool presentation.
I also found a related case where Pydantic generates propertyNames with a $ref, but markdown/XML only show the $ref pointer and not the referenced enum values. JSON keeps the full information. - Tools without parameters raise
If a function tool simply omits the parameters field, the K2 template raises a TemplateError.
Using "parameters": {} works normally.
The reason I thought this was worth mentioning is that the OpenAI function-definition format allows parameters to be omitted for functions with no parameters. - Small vLLM documentation mismatch in the 0.9B appendix
The 0.9B APPENDIX.md example reads:
reasoning_content
but current vLLM exposes that response field as:
reasoning
so the example can read an empty value with current vLLM.
I tested these using the public templates/source files only. No model inference or live server testing was involved.
I have small repro cases, the exact revisions/hashes I checked, and controls for each one, so I’m happy to post them here if useful.
Also, thanks again for fixing the previous issue — it was really nice to see the feedback actually make it into the project.
For completeness, I'm adding the full technical note below with the exact revisions, reproductions, controls and scope boundaries I used for these findings.