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") - 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
Structured OpenAI user content-parts are silently dropped by chat_template
Hi K2 team,
During an independent review of the public K2 Horizon artifacts, I found a reproducible chat-template behavior that may be useful to flag.
When a user message uses OpenAI-style content parts:
[{"role": "user",
"content": [{"type": "text", "text": "UNIQUE_SENTINEL"}]}]
I used two matched controls:
Control 1 — plain user string: preserved
[{"role": "user", "content": "UNIQUE_SENTINEL"}]
Control 2 — identical structured content in the tool branch: preserved
[{"role": "tool",
"content": [{"type": "text", "text": "UNIQUE_SENTINEL"}]}]
I reproduced the behavior on both distinct K2 Horizon chat-template implementations. In the frozen CPU-only reproduction, the structured-user loss produces no Python warning, logging record, or stderr output. No model weights or inference are required.
I also checked serving-path reachability rather than assuming it: with the pinned vLLM content-format detector used in the reproduction, the K2 templates resolve to openai, so structured content reaches the template rather than being flattened to a string first.
Minimal reproduction:
from transformers import AutoTokenizer
tok = AutoTokenizer.from_pretrained(
"IFM/K2-Horizon-0.9B",
trust_remote_code=False
)
S = "UNIQUE_SENTINEL"
plain = [{"role": "user", "content": S}]
parts = [{"role": "user",
"content": [{"type": "text", "text": S}]}]
print(tok.apply_chat_template(
plain, tokenize=False, add_generation_prompt=True))
print(tok.apply_chat_template(
parts, tokenize=False, add_generation_prompt=True))
The first contains the sentinel; the second renders an empty user turn.
I am treating this specifically as a chat-template/integration observation, not a model-quality issue, and I am not making any claim about intent. If structured content is intentionally unsupported for user messages, an explicit error or documentation note may be preferable to silent content loss.
I have a frozen reproduction package with exact template hashes, revisions, captured outputs and the pinned vLLM source if it would be useful.
Thanks,
Sahal AlKubaisi