mjkmain commited on
Commit
547fa40
·
verified ·
1 Parent(s): 18173bf

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +41 -0
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`: