Instructions to use KORMo-Team/KORMo-10B-sft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KORMo-Team/KORMo-10B-sft with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="KORMo-Team/KORMo-10B-sft", 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("KORMo-Team/KORMo-10B-sft", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use KORMo-Team/KORMo-10B-sft with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "KORMo-Team/KORMo-10B-sft" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KORMo-Team/KORMo-10B-sft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/KORMo-Team/KORMo-10B-sft
- SGLang
How to use KORMo-Team/KORMo-10B-sft 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 "KORMo-Team/KORMo-10B-sft" \ --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": "KORMo-Team/KORMo-10B-sft", "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 "KORMo-Team/KORMo-10B-sft" \ --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": "KORMo-Team/KORMo-10B-sft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use KORMo-Team/KORMo-10B-sft with Docker Model Runner:
docker model run hf.co/KORMo-Team/KORMo-10B-sft
Update README.md
Browse files
README.md
CHANGED
|
@@ -148,6 +148,47 @@ response = tokenizer.decode(output_ids[0][inputs['input_ids'].shape[1]:], skip_s
|
|
| 148 |
print("Assistant:", response)
|
| 149 |
```
|
| 150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
## 🧠 Enabling Thinking Mode
|
| 152 |
|
| 153 |
If you want to enable the **thinking** mode, simply set `enable_thinking=True`:
|
|
|
|
| 148 |
print("Assistant:", response)
|
| 149 |
```
|
| 150 |
|
| 151 |
+
<details>
|
| 152 |
+
<summary>vLLM</summary>
|
| 153 |
+
|
| 154 |
+
```python
|
| 155 |
+
MODEL_ID = "KORMo-Team/KORMo-10B-sft"
|
| 156 |
+
ARCH = "KORMoForCausalLM"
|
| 157 |
+
|
| 158 |
+
_RENAME = {
|
| 159 |
+
"pre_attention_layernorm": "input_layernorm",
|
| 160 |
+
"pre_mlp_layernorm": "post_attention_layernorm",
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
def _remap_name(name: str) -> str:
|
| 164 |
+
for src, dst in _RENAME.items():
|
| 165 |
+
if src in name:
|
| 166 |
+
return name.replace(src, dst)
|
| 167 |
+
return name
|
| 168 |
+
|
| 169 |
+
def _build_class():
|
| 170 |
+
from vllm.model_executor.models.llama import LlamaForCausalLM
|
| 171 |
+
|
| 172 |
+
class KORMoForCausalLM(LlamaForCausalLM):
|
| 173 |
+
def load_weights(self, weights):
|
| 174 |
+
return super().load_weights(
|
| 175 |
+
(_remap_name(name), w) for name, w in weights
|
| 176 |
+
)
|
| 177 |
+
|
| 178 |
+
return KORMoForCausalLM
|
| 179 |
+
|
| 180 |
+
KORMoForCausalLM = _build_class()
|
| 181 |
+
|
| 182 |
+
def register_kormo():
|
| 183 |
+
from vllm import ModelRegistry
|
| 184 |
+
|
| 185 |
+
if ARCH not in ModelRegistry.get_supported_archs():
|
| 186 |
+
ModelRegistry.register_model(ARCH, "generation.kormo_vllm:KORMoForCausalLM")
|
| 187 |
+
```
|
| 188 |
+
|
| 189 |
+
</details>
|
| 190 |
+
|
| 191 |
+
|
| 192 |
## 🧠 Enabling Thinking Mode
|
| 193 |
|
| 194 |
If you want to enable the **thinking** mode, simply set `enable_thinking=True`:
|