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
Hyperparameters Used During Training Are Not Documented
The hyperparameters used during the various stages of training are not fully documented. While the LR can be recovered from the W&B dashboard, others such as weight decay, etc. cannot.
Would it be possible to provide these either in the model card or elsewhere?
Hi, @AnOnlineUser78 ,
Yes indeed. I checked our code it is a little bit unclear too. Since the process is a bit complicated, we need to share a little more on data, master script etc to complete it without making it hard to read.
We are just wrapping up the paper, which should have a lot more details. However, I do agree we need to provide a table somewhere.
@junchen01 @onenoc @desaifan-mbzuai , suggestions on how we can structure this?
Thanks for raising this, and sorry for the gap: for K2-Horizon-0.9B, pretraining used a global batch size of 8,388,608 tokens for 600,000 steps (~5.03T tokens) with peak LR 8e-4, 3,000 warmup steps, and weight decay 0.1, followed by two context-extension stages (stage1, peak LR 2e-4, weight decay 0.1; stage2: peak LR 5e-5, weight decay 0.06), both with RoPE base 1M, and we’ll add all of this to the model card along with the coming paper.
Thanks @chen11003 -- I had added a comment to an 375B-A32B model discussion with the same question. Could you possibly share the same statistics for that model?
Thanks to the team for releasing such an open model!