Instructions to use LLM360/K2-Think with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LLM360/K2-Think with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LLM360/K2-Think") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("LLM360/K2-Think") model = AutoModelForCausalLM.from_pretrained("LLM360/K2-Think") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use LLM360/K2-Think with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LLM360/K2-Think" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LLM360/K2-Think", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/LLM360/K2-Think
- SGLang
How to use LLM360/K2-Think 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 "LLM360/K2-Think" \ --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": "LLM360/K2-Think", "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 "LLM360/K2-Think" \ --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": "LLM360/K2-Think", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use LLM360/K2-Think with Docker Model Runner:
docker model run hf.co/LLM360/K2-Think
please add api key and base url
#7
by asd12d21 - opened
README.md
CHANGED
|
@@ -49,7 +49,7 @@ print(outputs[0]["generated_text"][-1])
|
|
| 49 |
---
|
| 50 |
|
| 51 |
# Evaluation & Performance
|
| 52 |
-
Detailed evaluation results are reported in out [Tech Report](https://
|
| 53 |
|
| 54 |
## Benchmarks (pass\@1, average over 16 runs)
|
| 55 |
|
|
@@ -71,7 +71,7 @@ We deploy K2-THINK on Cerebras Wafer-Scale Engine (WSE) systems, leveraging the
|
|
| 71 |
| Platform | Throughput (tokens/sec) | Example: 32k-token response (time) |
|
| 72 |
| --------------------------------- | ----------------------: | ---------------------------------: |
|
| 73 |
| **Cerebras WSE (our deployment)** | **\~2,000** | **\~16 s** |
|
| 74 |
-
| Typical
|
| 75 |
|
| 76 |
---
|
| 77 |
|
|
@@ -88,20 +88,30 @@ Aggregated across four safety dimensions (**Safety-4**):
|
|
| 88 |
| **Safety-4 Macro (avg)** | **0.75** |
|
| 89 |
|
| 90 |
---
|
| 91 |
-
|
| 92 |
# Terms of Use
|
| 93 |
|
| 94 |
-
|
|
|
|
| 95 |
|
| 96 |
-
1. **
|
| 97 |
-
|
|
|
|
| 98 |
|
| 99 |
-
2. **
|
| 100 |
-
|
| 101 |
-
-
|
|
|
|
| 102 |
|
| 103 |
3. **No Warranty**
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
---
|
| 106 |
|
| 107 |
# Citation
|
|
|
|
| 49 |
---
|
| 50 |
|
| 51 |
# Evaluation & Performance
|
| 52 |
+
Detailed evaluation results are reported in out [Tech Report](https://k2think-about.pages.dev/assets/tech-report/K2-Think_Tech-Report.pdf)
|
| 53 |
|
| 54 |
## Benchmarks (pass\@1, average over 16 runs)
|
| 55 |
|
|
|
|
| 71 |
| Platform | Throughput (tokens/sec) | Example: 32k-token response (time) |
|
| 72 |
| --------------------------------- | ----------------------: | ---------------------------------: |
|
| 73 |
| **Cerebras WSE (our deployment)** | **\~2,000** | **\~16 s** |
|
| 74 |
+
| Typical **H100/H200** GPU setup | \~200 | \~160 s |
|
| 75 |
|
| 76 |
---
|
| 77 |
|
|
|
|
| 88 |
| **Safety-4 Macro (avg)** | **0.75** |
|
| 89 |
|
| 90 |
---
|
|
|
|
| 91 |
# Terms of Use
|
| 92 |
|
| 93 |
+
This model is released strictly for **research and educational purposes**.
|
| 94 |
+
By downloading, using, or interacting with this model, you agree to the following conditions:
|
| 95 |
|
| 96 |
+
1. **Research Only**
|
| 97 |
+
The model is provided as part of an academic and research project.
|
| 98 |
+
It is **not intended for commercial deployment** or production use without explicit permission.
|
| 99 |
|
| 100 |
+
2. **Prohibited Uses**
|
| 101 |
+
You may **not** use this model:
|
| 102 |
+
- For any **illegal, unlawful, or harmful activities**, including but not limited to generating or disseminating malicious content, engaging in fraud, violating privacy, or spreading misinformation.
|
| 103 |
+
- In applications that could directly cause **harm, injury, or safety risks** to individuals or society.
|
| 104 |
|
| 105 |
3. **No Warranty**
|
| 106 |
+
The model is provided **“as is” without warranties** of any kind.
|
| 107 |
+
The authors and institutions involved bear no responsibility for consequences arising from its use.
|
| 108 |
+
|
| 109 |
+
4. **Attribution**
|
| 110 |
+
When using or referencing the model in research, publications, or derivative works, proper **citation and attribution** to the authors and project must be given.
|
| 111 |
+
|
| 112 |
+
5. **Compliance**
|
| 113 |
+
You are responsible for ensuring that your use of the model complies with all **applicable laws, regulations, and ethical guidelines** in your jurisdiction.
|
| 114 |
+
|
| 115 |
---
|
| 116 |
|
| 117 |
# Citation
|