lsw825 commited on
Commit
652f5f9
·
0 Parent(s):

initial commit

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +41 -0
  2. LICENSE +0 -0
  3. README.md +275 -0
  4. THIRD_PARTY_NOTICES.md +47 -0
  5. chat_template.jinja +96 -0
  6. config.json +150 -0
  7. configuration_deepseek.py +212 -0
  8. docs/deploy_guidance.md +95 -0
  9. docs/tool_call_guidance.md +258 -0
  10. figures/Base-Evaluation.png +3 -0
  11. figures/banner.png +3 -0
  12. figures/kimi-logo.png +3 -0
  13. generation_config.json +4 -0
  14. model-00001-of-000062.safetensors +3 -0
  15. model-00002-of-000062.safetensors +3 -0
  16. model-00003-of-000062.safetensors +3 -0
  17. model-00004-of-000062.safetensors +3 -0
  18. model-00005-of-000062.safetensors +3 -0
  19. model-00006-of-000062.safetensors +3 -0
  20. model-00007-of-000062.safetensors +3 -0
  21. model-00008-of-000062.safetensors +3 -0
  22. model-00009-of-000062.safetensors +3 -0
  23. model-00010-of-000062.safetensors +3 -0
  24. model-00011-of-000062.safetensors +3 -0
  25. model-00012-of-000062.safetensors +3 -0
  26. model-00013-of-000062.safetensors +3 -0
  27. model-00014-of-000062.safetensors +3 -0
  28. model-00015-of-000062.safetensors +3 -0
  29. model-00016-of-000062.safetensors +3 -0
  30. model-00017-of-000062.safetensors +3 -0
  31. model-00018-of-000062.safetensors +3 -0
  32. model-00019-of-000062.safetensors +3 -0
  33. model-00020-of-000062.safetensors +3 -0
  34. model-00021-of-000062.safetensors +3 -0
  35. model-00022-of-000062.safetensors +3 -0
  36. model-00023-of-000062.safetensors +3 -0
  37. model-00024-of-000062.safetensors +3 -0
  38. model-00025-of-000062.safetensors +3 -0
  39. model-00026-of-000062.safetensors +3 -0
  40. model-00027-of-000062.safetensors +3 -0
  41. model-00028-of-000062.safetensors +3 -0
  42. model-00029-of-000062.safetensors +3 -0
  43. model-00030-of-000062.safetensors +3 -0
  44. model-00031-of-000062.safetensors +3 -0
  45. model-00032-of-000062.safetensors +3 -0
  46. model-00033-of-000062.safetensors +3 -0
  47. model-00034-of-000062.safetensors +3 -0
  48. model-00035-of-000062.safetensors +3 -0
  49. model-00036-of-000062.safetensors +3 -0
  50. model-00037-of-000062.safetensors +3 -0
.gitattributes ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ model.safetensors.index.json filter=lfs diff=lfs merge=lfs -text
37
+ figures/Base-Evaluation.png filter=lfs diff=lfs merge=lfs -text
38
+ figures/banner.png filter=lfs diff=lfs merge=lfs -text
39
+ figures/kimi-logo.png filter=lfs diff=lfs merge=lfs -text
40
+ figures/* filter=lfs diff=lfs merge=lfs -text
41
+ *.png filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
File without changes
README.md ADDED
@@ -0,0 +1,275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: modified-mit
4
+ library_name: transformers
5
+ ---
6
+ <div align="center">
7
+ <picture>
8
+ <img src="figures/kimi-logo.png" width="30%" alt="Kimi K2: Open Agentic Intellignece">
9
+ </picture>
10
+ </div>
11
+ <hr>
12
+
13
+ <div align="center" style="line-height:1">
14
+ <a href="https://www.kimi.com" target="_blank"><img alt="Chat" src="https://img.shields.io/badge/🤖%20Chat-Kimi%20K2-ff6b6b?color=1783ff&logoColor=white"/></a>
15
+ <a href="https://github.com/moonshotai/Kimi-K2"><img alt="github" src="https://img.shields.io/badge/🤖%20Github-Kimi%20K2-ff6b6b?color=1783ff&logoColor=white"/></a>
16
+ <a href="https://www.moonshot.ai" target="_blank"><img alt="Homepage" src="https://img.shields.io/badge/Homepage-Moonshot%20AI-white?logo=Kimi&logoColor=white"/></a>
17
+ </div>
18
+
19
+ <div align="center" style="line-height: 1;">
20
+ <a href="https://huggingface.co/moonshotai" target="_blank"><img alt="Hugging Face" src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Moonshot%20AI-ffc107?color=ffc107&logoColor=white"/></a>
21
+ <a href="https://twitter.com/kimi_moonshot" target="_blank"><img alt="Twitter Follow" src="https://img.shields.io/badge/Twitter-Kimi.ai-white?logo=x&logoColor=white"/></a>
22
+ <a href="https://discord.gg/TYU2fdJykW" target="_blank"><img alt="Discord" src="https://img.shields.io/badge/Discord-Kimi.ai-white?logo=discord&logoColor=white"/></a>
23
+ </div>
24
+ <div align="center" style="line-height: 1;">
25
+ <a href="https://huggingface.co/moonshotai/Kimi-K2-Thinking/blob/main/LICENSE"><img alt="License" src="https://img.shields.io/badge/License-Modified_MIT-f5de53?&color=f5de53"/></a>
26
+ </div>
27
+
28
+ <p align="center">
29
+ <b>📰&nbsp;&nbsp;<a href="https://moonshotai.github.io/Kimi-K2-Thinking/">Tech Blog</a></b>
30
+ </p>
31
+
32
+
33
+ ## 1. Model Introduction
34
+
35
+ Kimi K2 Thinking is the latest, most capable version of open-source thinking model. Starting with Kimi K2, we built it as a thinking agent that reasons step-by-step while dynamically invoking tools. It sets a new state-of-the-art on Humanity's Last Exam (HLE), BrowseComp, and other benchmarks by dramatically scaling multi-turn reasoning depth and maintaining stable tool-use across 200–300 sequential calls. At the same time, K2 Thinking is a native INT4 quantization model with 256k context window, achieving lossless reductions in inference latency and GPU memory usage.
36
+
37
+ ### Key Features
38
+ - **Deep Thinking & Tool Orchestration**: End-to-end trained to interleave chain-of-thought reasoning with function calls, enabling autonomous research, coding, and writing workflows that last hundreds of steps without drift.
39
+ - **Native INT4 Quantization**: Quantization-Aware Training (QAT) is employed in post-training stage to achieve lossless 2x speed-up in low-latency mode.
40
+ - **Stable Long-Horizon Agency**: Maintains coherent goal-directed behavior across up to 200–300 consecutive tool invocations, surpassing prior models that degrade after 30–50 steps.
41
+
42
+
43
+ ## 2. Model Summary
44
+
45
+ <div align="center">
46
+
47
+
48
+ | | |
49
+ |:---:|:---:|
50
+ | **Architecture** | Mixture-of-Experts (MoE) |
51
+ | **Total Parameters** | 1T |
52
+ | **Activated Parameters** | 32B |
53
+ | **Number of Layers** (Dense layer included) | 61 |
54
+ | **Number of Dense Layers** | 1 |
55
+ | **Attention Hidden Dimension** | 7168 |
56
+ | **MoE Hidden Dimension** (per Expert) | 2048 |
57
+ | **Number of Attention Heads** | 64 |
58
+ | **Number of Experts** | 384 |
59
+ | **Selected Experts per Token** | 8 |
60
+ | **Number of Shared Experts** | 1 |
61
+ | **Vocabulary Size** | 160K |
62
+ | **Context Length** | 256K |
63
+ | **Attention Mechanism** | MLA |
64
+ | **Activation Function** | SwiGLU |
65
+ </div>
66
+
67
+ ## 3. Evaluation Results
68
+
69
+ **Reasoning Tasks**
70
+ | Benchmark | Setting | K2 Thinking | GPT-5 | Claude Sonnet 4.5 (Thinking) | K2 0905 | DeepSeek-V3.2 | Grok-4 |
71
+ |:----------|:--------|------------:|------:|----------------------------:|--------:|--------------:|-------:|
72
+ | **HLE (Text-only)** | no tools | 23.9 | 26.3 | 19.8* | 7.9 | 19.8 | 25.4 |
73
+ | | w/ tools | 44.9 | 35.2 | 32* | 21.7 | 20.3* | 38.6 |
74
+ | | heavy | 51 | 42 | N/A | N/A | N/A | 50.7 |
75
+ | **AIME25** | no tools | 94.5 | 94.6 | 87 | 51 | 89.3 | 91.7 |
76
+ | | w/ python | 99.1 | 99.6 | 100 | 75.2 | 58.1* | 98.8 |
77
+ | | heavy | 100 | 100 | N/A | N/A | N/A | 100 |
78
+ | **HMMT25** | no tools | 89.4 | 93.3 | 74.6* | 38.8 | 83.6 | 90 |
79
+ | | w/ python | 95.1 | 96.7 | 88.8* | 70.4 | 49.5* | 93.9 |
80
+ | | heavy | 97.5 | 100 | N/A | N/A | N/A | 96.7 |
81
+ | **IMO-AnswerBench** | no tools | 78.6 | 76.0* | 65.9* | 45.8 | 76.0* | 73.1 |
82
+ | **GPQA** | no tools | 84.5 | 85.7 | 83.4 | 74.2 | 79.9 | 87.5 |
83
+
84
+ **General Tasks**
85
+ | Benchmark | Setting | K2 Thinking | GPT-5 | Claude Sonnet 4.5 (Thinking) | K2 0905 | DeepSeek-V3.2 |
86
+ |:----------|:--------|------------:|------:|----------------------------:|--------:|--------------:|
87
+ | **MMLU-Pro** | no tools | 84.6 | 87.1 | 87.5 | 81.9 | 85 |
88
+ | **MMLU-Redux** | no tools | 94.4 | 95.3 | 95.6 | 92.7 | 93.7 |
89
+ | **Longform Writing** | no tools | 73.8 | 71.4 | 79.8 | 62.8 | 72.5 |
90
+ | **HealthBench** | no tools | 58 | 67.2 | 44.2 | 43.8 | 46.9 |
91
+
92
+ **Agentic Search Tasks**
93
+ | Benchmark | Setting | K2 Thinking | GPT-5 | Claude Sonnet 4.5 (Thinking) | K2 0905 | DeepSeek-V3.2 |
94
+ |:----------|:--------|------------:|------:|----------------------------:|--------:|--------------:|
95
+ | **BrowseComp** | w/ tools | 60.2 | 54.9 | 24.1 | 7.4 | 40.1 |
96
+ | **BrowseComp-ZH** | w/ tools | 62.3 | 63* | 42.4* | 22.2 | 47.9 |
97
+ | **Seal-0** | w/ tools | 56.3 | 51.4* | 53.4* | 25.2 | 38.5* |
98
+ | **Frames** | w/ tools | 87 | 86* | 85* | 58.1 | 80.2* |
99
+
100
+ **Coding Tasks**
101
+ | Benchmark | Setting | K2 Thinking | GPT-5 | Claude Sonnet 4.5 (Thinking) | K2 0905 | DeepSeek-V3.2 |
102
+ |:----------|:--------|------------:|------:|----------------------------:|--------:|--------------:|
103
+ | **SWE-bench Verified** | w/ tools | 71.3 | 74.9 | 77.2 | 69.2 | 67.8 |
104
+ | **SWE-bench Multilingual** | w/ tools | 61.1 | 55.3* | 68 | 55.9 | 57.9 |
105
+ | **Multi-SWE-bench** | w/ tools | 41.9 | 39.3* | 44.3 | 33.5 | 30.6 |
106
+ | **SciCode** | no tools | 44.8 | 42.9 | 44.7 | 30.7 | 37.7 |
107
+ | **LiveCodeBenchV6** | no tools | 83.1 | 87* | 64* | 56.1* | 74.1 |
108
+ | **OJ-Bench (cpp)** | no tools | 48.7 | 56.2* | 30.4* | 25.5* | 38.2* |
109
+ | **Terminal-Bench** | w/ simulated tools (JSON) | 47.1 | 43.8 | 51 | 44.5 | 37.7 |
110
+ <details>
111
+ <summary><b>Footnotes</b></summary>
112
+
113
+ 1. All benchmarks were evaluated at temperature = 1.0 and 256 k context length for k2-thinking, except for SciCode, for which we followed the official temperature setting of 0.0.
114
+
115
+ 2. For HLE (w/ tools) and the agentic-search benchmarks (BrowseComp, BrowseComp-zh, Frames, and Seal-0), k2-thinking was equipped with search, code-interpreter, and web-browsing tools. Any benchmark containing fewer than 300 questions was run 4 times independently and the average is reported (avg@4). The evaluation used o3-mini as judge, configured identically to the official HLE setting; judge prompts were taken verbatim from the official repository.
116
+
117
+ 3. We report the official scores for GPT-5 and Grok-4 on the HLE full set with tools. In our internal evaluation on the HLE text-only subset, GPT-5 scores 41.7 and Grok-4 scores 38.6(Grok-4's launch cited 41.0 on the text-only subset).For GPT-5's HLE w/o tool, we use the score from <a href="https://scale.com/leaderboard/humanitys_last_exam_text_only" target="_blank">Scale.ai</a>. The official GPT-5 HLE full set w/o tool is 24.8.
118
+
119
+ 4. On HLE, the maximum turn limit was 120, with a 48 k-token thinking budget per turn; on agentic-search tasks, the limit was 300 turns with a 24 k-token thinking budget per turn. When tool execution results cause the accumulated input to exceed the model's context limit (256k), we employ a simple context management strategy that hides all previous tool outputs.
120
+
121
+ 5. The web access to Hugging Face may lead to data leakage in certain benchmark tests, such as HLE. K2 Thinking can achieve a score of 51.3 on HLE without blocking Hugging Face. To ensure a fair and rigorous comparison, we blocked access to Hugging Face through search or web-browsing tools during testing to prevent potential data leakage.
122
+
123
+ 6. HLE (no tools), AIME25, HMMT25, and GPQA were capped at a 96k thinking-token budget, while IMO-Answer Bench, LiveCodeBench and OJ-Bench were capped at a 128k thinking-token budget. Longform Writing was capped at a 32k completion-token budget.
124
+
125
+ 7. For AIME and HMMT (no tools), we test 32 times and report the average over 32 runs (avg@32). For AIME and HMMT (with Python), we test 16 times and report the average over 16 runs (avg@16). For IMO-AnswerBench, we test 8 times and report the average over 8 runs (avg@8).
126
+
127
+ 8. IMO-AnswerBench: In the <a href="https://aclanthology.org/2025.emnlp-main.1794.pdf" target="_blank">benchmark paper</a>, GPT-5 scored 65.6. We re-evaluated GPT-5 with official API and obtained a score of 76.
128
+
129
+ 9. Terminal-Bench scores were obtained with the default agent framework (Terminus-2) and the provided JSON parser. For other coding tasks, the result was produced with our in-house evaluation harness. The harness is derived from SWE-agent, but we clamp the context windows of the Bash and Edit tools and rewrite the system prompt to match the task semantics. All reported scores of coding tasks are averaged over 5 independent runs.
130
+
131
+ 10. GPT-5, Claude-4.5-sonnet, Grok-4 results and DeepSeek-V3.2 results are quoted from the [GPT-5 post](https://openai.com/index/introducing-gpt-5/), [GPT-5 for Developers post](https://openai.com/index/introducing-gpt-5-for-developers/), [GPT-5 system card](https://openai.com/index/gpt-5-system-card/), [claude-sonnet-4-5 post](https://www.anthropic.com/news/claude-sonnet-4-5), [grok-4 post](https://x.ai/news/grok-4), [deepseek-v3.2 post](https://api-docs.deepseek.com/news/news250929), the [public Terminal-Bench leaderboard](https://www.tbench.ai/leaderboard) (Terminus-2), the [public Vals AI leaderboard](https://vals.ai/) and [artificialanalysis](https://artificialanalysis.ai/). Benchmarks for which no available public scores were re-tested under the same conditions used for k2 thinking and are marked with an asterisk(*).
132
+
133
+ 11. K2 Thinking Heavy Mode employs an efficient parallel strategy: it first rolls out eight trajectories simultaneously, then reflectively aggregates all outputs to generate the final result. Heavy mode for GPT-5 denotes the official GPT-5 Pro score.
134
+
135
+ </details>
136
+
137
+ ## 4. Native INT4 Quantization
138
+
139
+ Low-bit quantization is an effective way to reduce inference latency and GPU memory usage on large-scale inference servers. However, thinking models use excessive decoding lengths, and thus quantization often results in substantial performance drops.
140
+
141
+ To overcome this challenge, we adopt Quantization-Aware Training (QAT) during the post-training phase, applying INT4 weight-only quantization to the MoE components. It allows K2 Thinking to support native INT4 inference with a roughly 2x generation speed improvement while achieving state-of-the-art performance. All benchmark results are reported under INT4 precision.
142
+
143
+ The checkpoints are saved in compressed-tensors format, supported by most of mainstream inference engine. If you need the checkpoints in higher precision such as FP8 or BF16, you can refer to [official repo of compressed-tensors](https://github.com/vllm-project/compressed-tensors) to unpack the int4 weights and convert to any higher precision.
144
+
145
+ ## 5. Deployment
146
+ > [!Note]
147
+ > You can access K2 Thinking's API on https://platform.moonshot.ai , we provide OpenAI/Anthropic-compatible API for you.
148
+
149
+ Currently, Kimi-K2-Thinking is recommended to run on the following inference engines:
150
+
151
+ * vLLM
152
+ * SGLang
153
+ * KTransformers
154
+
155
+ Deployment examples can be found in the [Model Deployment Guide](docs/deploy_guidance.md).
156
+
157
+ ---
158
+
159
+ ## 6. Model Usage
160
+
161
+ ### Chat Completion
162
+
163
+ Once the local inference service is up, you can interact with it through the chat endpoint:
164
+
165
+ ```python
166
+ def simple_chat(client: OpenAI, model_name: str):
167
+ messages = [
168
+ {"role": "system", "content": "You are Kimi, an AI assistant created by Moonshot AI."},
169
+ {"role": "user", "content": [{"type": "text", "text": "Please give a brief self-introduction."}]},
170
+ ]
171
+ response = client.chat.completions.create(
172
+ model=model_name,
173
+ messages=messages,
174
+ stream=False,
175
+ temperature=1.0,
176
+ max_tokens=256
177
+ )
178
+ print(response.choices[0].message.content)
179
+ ```
180
+
181
+ > [!NOTE]
182
+ > The recommended temperature for Kimi-K2-Thinking is `temperature = 1.0`.
183
+ > If no special instructions are required, the system prompt above is a good default.
184
+
185
+ ---
186
+
187
+ ### Tool Calling
188
+
189
+ Kimi-K2-Thinking has the same tool calling settings as Kimi-K2-Instruct.
190
+
191
+ To enable them, you need to pass the list of available tools in each request, then the model will autonomously decide when and how to invoke them.
192
+
193
+ The following example demonstrates calling a weather tool end-to-end:
194
+
195
+ ```python
196
+ # Your tool implementation
197
+ def get_weather(city: str) -> dict:
198
+ return {"weather": "Sunny"}
199
+ # Tool schema definition
200
+ tools = [{
201
+ "type": "function",
202
+ "function": {
203
+ "name": "get_weather",
204
+ "description": "Retrieve current weather information. Call this when the user asks about the weather.",
205
+ "parameters": {
206
+ "type": "object",
207
+ "required": ["city"],
208
+ "properties": {
209
+ "city": {
210
+ "type": "string",
211
+ "description": "Name of the city"
212
+ }
213
+ }
214
+ }
215
+ }
216
+ }]
217
+ # Map tool names to their implementations
218
+ tool_map = {
219
+ "get_weather": get_weather
220
+ }
221
+ def tool_call_with_client(client: OpenAI, model_name: str):
222
+ messages = [
223
+ {"role": "system", "content": "You are Kimi, an AI assistant created by Moonshot AI."},
224
+ {"role": "user", "content": "What's the weather like in Beijing today? Use the tool to check."}
225
+ ]
226
+ finish_reason = None
227
+ while finish_reason is None or finish_reason == "tool_calls":
228
+ completion = client.chat.completions.create(
229
+ model=model_name,
230
+ messages=messages,
231
+ temperature=0.6,
232
+ tools=tools, # tool list defined above
233
+ tool_choice="auto"
234
+ )
235
+ choice = completion.choices[0]
236
+ finish_reason = choice.finish_reason
237
+ if finish_reason == "tool_calls":
238
+ messages.append(choice.message)
239
+ for tool_call in choice.message.tool_calls:
240
+ tool_call_name = tool_call.function.name
241
+ tool_call_arguments = json.loads(tool_call.function.arguments)
242
+ tool_function = tool_map[tool_call_name]
243
+ tool_result = tool_function(**tool_call_arguments)
244
+ print("tool_result:", tool_result)
245
+ messages.append({
246
+ "role": "tool",
247
+ "tool_call_id": tool_call.id,
248
+ "name": tool_call_name,
249
+ "content": json.dumps(tool_result)
250
+ })
251
+ print("-" * 100)
252
+ print(choice.message.content)
253
+ ```
254
+
255
+ The `tool_call_with_client` function implements the pipeline from user query to tool execution.
256
+ This pipeline requires the inference engine to support Kimi-K2’s native tool-parsing logic.
257
+ For more information, see the [Tool Calling Guide](docs/tool_call_guidance.md).
258
+
259
+ ---
260
+
261
+ ## 7. License
262
+
263
+ Both the code repository and the model weights are released under the [Modified MIT License](LICENSE).
264
+
265
+ ---
266
+
267
+ ## 8. Third Party Notices
268
+
269
+ See [THIRD PARTY NOTICES](THIRD_PARTY_NOTICES.md)
270
+
271
+ ---
272
+
273
+ ## 9. Contact Us
274
+
275
+ If you have any questions, please reach out at [[email protected]](mailto:[email protected]).
THIRD_PARTY_NOTICES.md ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # THIRD_PARTY_NOTICES
2
+
3
+ This file lists third-party software contained in Kimi-K2 along with their licenses, in compliance with the redistribution clauses of those licenses.
4
+
5
+ ---
6
+
7
+ ## 1. DeepSeek-V3
8
+
9
+ Our model archietecture is DeepSeek-V3-like. Some of modeling codes are copied from the source repository.
10
+
11
+ - **Source Repository**
12
+ https://huggingface.co/deepseek-ai/DeepSeek-V3
13
+
14
+ - **Files / Directories Used**
15
+ - configuration_deepseek.py
16
+ - modeling_deepseek.py
17
+
18
+ - **License Type**
19
+ MIT License
20
+
21
+ - **Copyright Notice**
22
+ Copyright (c) 2023 DeepSeek
23
+
24
+ - **Full License Text**
25
+ ```
26
+ MIT License
27
+
28
+ Copyright (c) 2023 DeepSeek
29
+
30
+ Permission is hereby granted, free of charge, to any person obtaining a copy
31
+ of this software and associated documentation files (the "Software"), to deal
32
+ in the Software without restriction, including without limitation the rights
33
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
34
+ copies of the Software, and to permit persons to whom the Software is
35
+ furnished to do so, subject to the following conditions:
36
+
37
+ The above copyright notice and this permission notice shall be included in all
38
+ copies or substantial portions of the Software.
39
+
40
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
41
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
42
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
43
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
44
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
45
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
46
+ SOFTWARE.
47
+ ```
chat_template.jinja ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- macro render_content(msg) -%}
2
+ {%- set c = msg.get('content') -%}
3
+ {%- if c is string -%}
4
+ {{ c }}
5
+ {%- elif c is not none -%}
6
+ {% for content in c -%}
7
+ {% if content['type'] == 'image' or 'image' in content or 'image_url' in content -%}
8
+ <|media_start|>image<|media_content|><|media_pad|><|media_end|>
9
+ {% else -%}
10
+ {{ content['text'] }}
11
+ {%- endif -%}
12
+ {%- endfor -%}
13
+ {%- endif -%}
14
+ {%- endmacro -%}
15
+
16
+ {% macro set_roles(message) -%}
17
+ {%- set role_name = message.get('name') or message['role'] -%}
18
+ {%- if message['role'] == 'user' -%}
19
+ <|im_user|>{{role_name}}<|im_middle|>
20
+ {%- elif message['role'] == 'assistant' -%}
21
+ <|im_assistant|>{{role_name}}<|im_middle|>
22
+ {%- else -%}
23
+ <|im_system|>{{role_name}}<|im_middle|>
24
+ {%- endif -%}
25
+ {%- endmacro -%}
26
+
27
+
28
+ {%- macro render_toolcalls(message) -%}
29
+ <|tool_calls_section_begin|>
30
+ {%- for tool_call in message['tool_calls'] -%}
31
+ {%- set formatted_id = tool_call['id'] -%}
32
+ <|tool_call_begin|>{{ formatted_id }}<|tool_call_argument_begin|>{% if tool_call['function']['arguments'] is string %}{{ tool_call['function']['arguments'] }}{% else %}{{ tool_call['function']['arguments'] | tojson }}{% endif %}<|tool_call_end|>
33
+ {%- endfor -%}
34
+ <|tool_calls_section_end|>
35
+ {%- endmacro -%}
36
+
37
+
38
+ {# Find last user msg #}
39
+ {%- set ns = namespace(last_user_idx=messages|length) -%}
40
+ {%- for idx in range(messages|length-1, -1, -1) -%}
41
+ {%- if messages[idx]['role'] == 'user' -%}
42
+ {%- set ns.last_user_idx = idx -%}
43
+ {%- break -%}
44
+ {%- endif -%}
45
+ {%- endfor -%}
46
+
47
+ {# split all messages into history & suffix #}
48
+ {%- set hist_msgs = messages[:ns.last_user_idx] -%}
49
+ {%- set suffix_msgs = messages[ns.last_user_idx:] -%}
50
+
51
+ {%- if tools -%}
52
+ <|im_system|>tool_declare<|im_middle|>{{ tools | tojson(separators=(',', ':')) }}<|im_end|>
53
+ {%- endif -%}
54
+
55
+ {%- for message in hist_msgs -%}
56
+ {%- if loop.first and messages[0]['role'] != 'system' -%}
57
+ <|im_system|>system<|im_middle|>You are Kimi, an AI assistant created by Moonshot AI.<|im_end|>
58
+ {%- endif -%}
59
+ {{set_roles(message)}}
60
+ {%- if message['role'] == 'assistant' -%}
61
+ ◁think▷◁/think▷{{render_content(message)}}
62
+ {%- if message.get('tool_calls') -%}
63
+ {{render_toolcalls(message)}}
64
+ {%- endif -%}
65
+ {%- elif message['role'] == 'tool' -%}
66
+ {%- set tool_call_id = message.tool_call_id -%}
67
+ ## Return of {{ tool_call_id }}
68
+ {{render_content(message)}}
69
+ {%- elif message['content'] is not none -%}
70
+ {{render_content(message)}}
71
+ {%- endif -%}
72
+ <|im_end|>
73
+ {%- endfor -%}
74
+
75
+ {%- for message in suffix_msgs -%}
76
+ {{set_roles(message)}}
77
+ {%- if message['role'] == 'assistant' -%}
78
+ {%- set rc = message.get('reasoning_content', '') -%}
79
+ ◁think▷{{rc}}◁/think▷{{render_content(message)}}
80
+ {%- if message.get('tool_calls') -%}
81
+ {{render_toolcalls(message)}}
82
+ {%- endif -%}
83
+ {%- elif message['role'] == 'tool' -%}
84
+ {%- set tool_call_id = message.tool_call_id -%}
85
+ ## Return of {{ tool_call_id }}
86
+ {{render_content(message)}}
87
+ {%- elif message['content'] is not none -%}
88
+ {{render_content(message)}}
89
+ {%- endif -%}
90
+ <|im_end|>
91
+ {%- endfor -%}
92
+
93
+
94
+ {%- if add_generation_prompt -%}
95
+ <|im_assistant|>assistant<|im_middle|>
96
+ {%- endif -%}
config.json ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_attn_implementation_autoset": false,
3
+ "_name_or_path": "",
4
+ "add_cross_attention": false,
5
+ "architectures": [
6
+ "DeepseekV3ForCausalLM"
7
+ ],
8
+ "attention_bias": false,
9
+ "attention_dropout": 0.0,
10
+ "auto_map": {
11
+ "AutoConfig": "configuration_deepseek.DeepseekV3Config",
12
+ "AutoModel": "modeling_deepseek.DeepseekV3Model",
13
+ "AutoModelForCausalLM": "modeling_deepseek.DeepseekV3ForCausalLM"
14
+ },
15
+ "aux_loss_alpha": 0.001,
16
+ "bad_words_ids": null,
17
+ "begin_suppress_tokens": null,
18
+ "bos_token_id": 163584,
19
+ "chunk_size_feed_forward": 0,
20
+ "cross_attention_hidden_size": null,
21
+ "decoder_start_token_id": null,
22
+ "diversity_penalty": 0.0,
23
+ "do_sample": false,
24
+ "early_stopping": false,
25
+ "encoder_no_repeat_ngram_size": 0,
26
+ "eos_token_id": 163585,
27
+ "ep_size": 1,
28
+ "exponential_decay_length_penalty": null,
29
+ "finetuning_task": null,
30
+ "first_k_dense_replace": 1,
31
+ "forced_bos_token_id": null,
32
+ "forced_eos_token_id": null,
33
+ "hidden_act": "silu",
34
+ "hidden_size": 7168,
35
+ "id2label": {
36
+ "0": "LABEL_0",
37
+ "1": "LABEL_1"
38
+ },
39
+ "initializer_range": 0.02,
40
+ "intermediate_size": 18432,
41
+ "is_decoder": false,
42
+ "is_encoder_decoder": false,
43
+ "kv_lora_rank": 512,
44
+ "label2id": {
45
+ "LABEL_0": 0,
46
+ "LABEL_1": 1
47
+ },
48
+ "length_penalty": 1.0,
49
+ "max_length": 20,
50
+ "max_position_embeddings": 262144,
51
+ "min_length": 0,
52
+ "model_type": "kimi_k2",
53
+ "moe_intermediate_size": 2048,
54
+ "moe_layer_freq": 1,
55
+ "n_group": 1,
56
+ "n_routed_experts": 384,
57
+ "n_shared_experts": 1,
58
+ "no_repeat_ngram_size": 0,
59
+ "norm_topk_prob": true,
60
+ "num_attention_heads": 64,
61
+ "num_beam_groups": 1,
62
+ "num_beams": 1,
63
+ "num_experts_per_tok": 8,
64
+ "num_hidden_layers": 61,
65
+ "num_key_value_heads": 64,
66
+ "num_nextn_predict_layers": 0,
67
+ "num_return_sequences": 1,
68
+ "output_attentions": false,
69
+ "output_hidden_states": false,
70
+ "output_scores": false,
71
+ "pad_token_id": 163839,
72
+ "prefix": null,
73
+ "pretraining_tp": 1,
74
+ "problem_type": null,
75
+ "pruned_heads": {},
76
+ "q_lora_rank": 1536,
77
+ "qk_nope_head_dim": 128,
78
+ "qk_rope_head_dim": 64,
79
+ "quantization_config": {
80
+ "config_groups": {
81
+ "group_0": {
82
+ "input_activations": null,
83
+ "output_activations": null,
84
+ "targets": [
85
+ "Linear"
86
+ ],
87
+ "weights": {
88
+ "actorder": null,
89
+ "block_structure": null,
90
+ "dynamic": false,
91
+ "group_size": 32,
92
+ "num_bits": 4,
93
+ "observer": "minmax",
94
+ "observer_kwargs": {},
95
+ "strategy": "group",
96
+ "symmetric": true,
97
+ "type": "int"
98
+ }
99
+ }
100
+ },
101
+ "format": "pack-quantized",
102
+ "ignore": [
103
+ "lm_head",
104
+ "re:.*self_attn.*",
105
+ "re:.*shared_experts.*",
106
+ "re:.*mlp\\.(gate|up|gate_up|down)_proj.*"
107
+ ],
108
+ "kv_cache_scheme": null,
109
+ "quant_method": "compressed-tensors",
110
+ "quantization_status": "compressed"
111
+ },
112
+ "remove_invalid_values": false,
113
+ "repetition_penalty": 1.0,
114
+ "return_dict": true,
115
+ "return_dict_in_generate": false,
116
+ "rms_norm_eps": 1e-05,
117
+ "rope_scaling": {
118
+ "beta_fast": 1.0,
119
+ "beta_slow": 1.0,
120
+ "factor": 64.0,
121
+ "mscale": 1.0,
122
+ "mscale_all_dim": 1.0,
123
+ "original_max_position_embeddings": 4096,
124
+ "type": "yarn"
125
+ },
126
+ "rope_theta": 50000.0,
127
+ "routed_scaling_factor": 2.827,
128
+ "scoring_func": "sigmoid",
129
+ "sep_token_id": null,
130
+ "seq_aux": true,
131
+ "suppress_tokens": null,
132
+ "task_specific_params": null,
133
+ "temperature": 1.0,
134
+ "tf_legacy_loss": false,
135
+ "tie_encoder_decoder": false,
136
+ "tie_word_embeddings": false,
137
+ "tokenizer_class": null,
138
+ "top_k": 50,
139
+ "top_p": 1.0,
140
+ "topk_group": 1,
141
+ "topk_method": "noaux_tc",
142
+ "torch_dtype": "bfloat16",
143
+ "torchscript": false,
144
+ "transformers_version": "4.51.3",
145
+ "typical_p": 1.0,
146
+ "use_bfloat16": false,
147
+ "use_cache": true,
148
+ "v_head_dim": 128,
149
+ "vocab_size": 163840
150
+ }
configuration_deepseek.py ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copy from https://huggingface.co/deepseek-ai/DeepSeek-V3/blob/main/configuration_deepseek.py
2
+
3
+ from transformers.configuration_utils import PretrainedConfig
4
+ from transformers.utils import logging
5
+
6
+ logger = logging.get_logger(__name__)
7
+
8
+ DEEPSEEK_PRETRAINED_CONFIG_ARCHIVE_MAP = {}
9
+ class DeepseekV3Config(PretrainedConfig):
10
+ r"""
11
+ This is the configuration class to store the configuration of a [`DeepseekV3Model`]. It is used to instantiate an DeepSeek
12
+ model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
13
+ defaults will yield a similar configuration to that of the DeepSeek-V3.
14
+
15
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
16
+ documentation from [`PretrainedConfig`] for more information.
17
+
18
+
19
+ Args:
20
+ vocab_size (`int`, *optional*, defaults to 129280):
21
+ Vocabulary size of the Deep model. Defines the number of different tokens that can be represented by the
22
+ `inputs_ids` passed when calling [`DeepseekV3Model`]
23
+ hidden_size (`int`, *optional*, defaults to 4096):
24
+ Dimension of the hidden representations.
25
+ intermediate_size (`int`, *optional*, defaults to 11008):
26
+ Dimension of the MLP representations.
27
+ moe_intermediate_size (`int`, *optional*, defaults to 1407):
28
+ Dimension of the MoE representations.
29
+ num_hidden_layers (`int`, *optional*, defaults to 32):
30
+ Number of hidden layers in the Transformer decoder.
31
+ num_nextn_predict_layers (`int`, *optional*, defaults to 1):
32
+ Number of nextn predict layers in the DeepSeekV3 Model.
33
+ num_attention_heads (`int`, *optional*, defaults to 32):
34
+ Number of attention heads for each attention layer in the Transformer decoder.
35
+ n_shared_experts (`int`, *optional*, defaults to None):
36
+ Number of shared experts, None means dense model.
37
+ n_routed_experts (`int`, *optional*, defaults to None):
38
+ Number of routed experts, None means dense model.
39
+ routed_scaling_factor (`float`, *optional*, defaults to 1.0):
40
+ Scaling factor or routed experts.
41
+ topk_method (`str`, *optional*, defaults to `gready`):
42
+ Topk method used in routed gate.
43
+ n_group (`int`, *optional*, defaults to None):
44
+ Number of groups for routed experts.
45
+ topk_group (`int`, *optional*, defaults to None):
46
+ Number of selected groups for each token(for each token, ensuring the selected experts is only within `topk_group` groups).
47
+ num_experts_per_tok (`int`, *optional*, defaults to None):
48
+ Number of selected experts, None means dense model.
49
+ moe_layer_freq (`int`, *optional*, defaults to 1):
50
+ The frequency of the MoE layer: one expert layer for every `moe_layer_freq - 1` dense layers.
51
+ first_k_dense_replace (`int`, *optional*, defaults to 0):
52
+ Number of dense layers in shallow layers(embed->dense->dense->...->dense->moe->moe...->lm_head).
53
+ \--k dense layers--/
54
+ norm_topk_prob (`bool`, *optional*, defaults to False):
55
+ Whether to normalize the weights of the routed experts.
56
+ scoring_func (`str`, *optional*, defaults to 'softmax'):
57
+ Method of computing expert weights.
58
+ aux_loss_alpha (`float`, *optional*, defaults to 0.001):
59
+ Auxiliary loss weight coefficient.
60
+ seq_aux = (`bool`, *optional*, defaults to True):
61
+ Whether to compute the auxiliary loss for each individual sample.
62
+ num_key_value_heads (`int`, *optional*):
63
+ This is the number of key_value heads that should be used to implement Grouped Query Attention. If
64
+ `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
65
+ `num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When
66
+ converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
67
+ by meanpooling all the original heads within that group. For more details checkout [this
68
+ paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to
69
+ `num_attention_heads`.
70
+ hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
71
+ The non-linear activation function (function or string) in the decoder.
72
+ max_position_embeddings (`int`, *optional*, defaults to 2048):
73
+ The maximum sequence length that this model might ever be used with.
74
+ initializer_range (`float`, *optional*, defaults to 0.02):
75
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
76
+ rms_norm_eps (`float`, *optional*, defaults to 1e-06):
77
+ The epsilon used by the rms normalization layers.
78
+ use_cache (`bool`, *optional*, defaults to `True`):
79
+ Whether or not the model should return the last key/values attentions (not used by all models). Only
80
+ relevant if `config.is_decoder=True`.
81
+ pad_token_id (`int`, *optional*):
82
+ Padding token id.
83
+ bos_token_id (`int`, *optional*, defaults to 1):
84
+ Beginning of stream token id.
85
+ eos_token_id (`int`, *optional*, defaults to 2):
86
+ End of stream token id.
87
+ pretraining_tp (`int`, *optional*, defaults to 1):
88
+ Experimental feature. Tensor parallelism rank used during pretraining. Please refer to [this
89
+ document](https://huggingface.co/docs/transformers/parallelism) to understand more about it. This value is
90
+ necessary to ensure exact reproducibility of the pretraining results. Please refer to [this
91
+ issue](https://github.com/pytorch/pytorch/issues/76232).
92
+ tie_word_embeddings (`bool`, *optional*, defaults to `False`):
93
+ Whether to tie weight embeddings
94
+ rope_theta (`float`, *optional*, defaults to 10000.0):
95
+ The base period of the RoPE embeddings.
96
+ rope_scaling (`Dict`, *optional*):
97
+ Dictionary containing the scaling configuration for the RoPE embeddings. Currently supports two scaling
98
+ strategies: linear and dynamic. Their scaling factor must be a float greater than 1. The expected format is
99
+ `{"type": strategy name, "factor": scaling factor}`. When using this flag, don't update
100
+ `max_position_embeddings` to the expected new maximum.
101
+ attention_bias (`bool`, defaults to `False`, *optional*, defaults to `False`):
102
+ Whether to use a bias in the query, key, value and output projection layers during self-attention.
103
+ attention_dropout (`float`, *optional*, defaults to 0.0):
104
+ The dropout ratio for the attention probabilities.
105
+
106
+ ```python
107
+ >>> from transformers import DeepseekV3Model, DeepseekV3Config
108
+
109
+ >>> # Initializing a Deepseek-V3 style configuration
110
+ >>> configuration = DeepseekV3Config()
111
+
112
+ >>> # Accessing the model configuration
113
+ >>> configuration = model.config
114
+ ```"""
115
+
116
+ model_type = "deepseek_v3"
117
+ keys_to_ignore_at_inference = ["past_key_values"]
118
+
119
+ def __init__(
120
+ self,
121
+ vocab_size=129280,
122
+ hidden_size=7168,
123
+ intermediate_size=18432,
124
+ moe_intermediate_size = 2048,
125
+ num_hidden_layers=61,
126
+ num_nextn_predict_layers=1,
127
+ num_attention_heads=128,
128
+ num_key_value_heads=128,
129
+ n_shared_experts = 1,
130
+ n_routed_experts = 256,
131
+ ep_size = 1,
132
+ routed_scaling_factor = 2.5,
133
+ kv_lora_rank = 512,
134
+ q_lora_rank = 1536,
135
+ qk_rope_head_dim = 64,
136
+ v_head_dim = 128,
137
+ qk_nope_head_dim = 128,
138
+ topk_method = 'noaux_tc',
139
+ n_group = 8,
140
+ topk_group = 4,
141
+ num_experts_per_tok = 8,
142
+ moe_layer_freq = 1,
143
+ first_k_dense_replace = 3,
144
+ norm_topk_prob = True,
145
+ scoring_func = 'sigmoid',
146
+ aux_loss_alpha = 0.001,
147
+ seq_aux = True,
148
+ hidden_act="silu",
149
+ max_position_embeddings=4096,
150
+ initializer_range=0.02,
151
+ rms_norm_eps=1e-6,
152
+ use_cache=True,
153
+ pad_token_id=None,
154
+ bos_token_id=0,
155
+ eos_token_id=1,
156
+ pretraining_tp=1,
157
+ tie_word_embeddings=False,
158
+ rope_theta=10000.0,
159
+ rope_scaling=None,
160
+ attention_bias=False,
161
+ attention_dropout=0.0,
162
+ **kwargs,
163
+ ):
164
+ self.vocab_size = vocab_size
165
+ self.max_position_embeddings = max_position_embeddings
166
+ self.hidden_size = hidden_size
167
+ self.intermediate_size = intermediate_size
168
+ self.moe_intermediate_size = moe_intermediate_size
169
+ self.num_hidden_layers = num_hidden_layers
170
+ self.num_nextn_predict_layers = num_nextn_predict_layers
171
+ self.num_attention_heads = num_attention_heads
172
+ self.n_shared_experts = n_shared_experts
173
+ self.n_routed_experts = n_routed_experts
174
+ self.ep_size = ep_size
175
+ self.routed_scaling_factor = routed_scaling_factor
176
+ self.kv_lora_rank = kv_lora_rank
177
+ self.q_lora_rank = q_lora_rank
178
+ self.qk_rope_head_dim = qk_rope_head_dim
179
+ self.v_head_dim = v_head_dim
180
+ self.qk_nope_head_dim = qk_nope_head_dim
181
+ self.topk_method = topk_method
182
+ self.n_group = n_group
183
+ self.topk_group = topk_group
184
+ self.num_experts_per_tok = num_experts_per_tok
185
+ self.moe_layer_freq = moe_layer_freq
186
+ self.first_k_dense_replace = first_k_dense_replace
187
+ self.norm_topk_prob = norm_topk_prob
188
+ self.scoring_func = scoring_func
189
+ self.aux_loss_alpha = aux_loss_alpha
190
+ self.seq_aux = seq_aux
191
+ # for backward compatibility
192
+ if num_key_value_heads is None:
193
+ num_key_value_heads = num_attention_heads
194
+
195
+ self.num_key_value_heads = num_key_value_heads
196
+ self.hidden_act = hidden_act
197
+ self.initializer_range = initializer_range
198
+ self.rms_norm_eps = rms_norm_eps
199
+ self.pretraining_tp = pretraining_tp
200
+ self.use_cache = use_cache
201
+ self.rope_theta = rope_theta
202
+ self.rope_scaling = rope_scaling
203
+ self.attention_bias = attention_bias
204
+ self.attention_dropout = attention_dropout
205
+
206
+ super().__init__(
207
+ pad_token_id=pad_token_id,
208
+ bos_token_id=bos_token_id,
209
+ eos_token_id=eos_token_id,
210
+ tie_word_embeddings=tie_word_embeddings,
211
+ **kwargs,
212
+ )
docs/deploy_guidance.md ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Kimi-K2-Thinking Deployment Guide
2
+
3
+ > [!Note]
4
+ > This guide only provides some examples of deployment commands for Kimi-K2-Thinking, which may not be the optimal configuration. Since inference engines are still being updated frequenty, please continue to follow the guidance from their homepage if you want to achieve better inference performance.
5
+
6
+
7
+ ## vLLM Deployment
8
+
9
+ The smallest deployment unit for Kimi-K2 INT4 weights with 256k seqlen on mainstream H200 platform is a cluster with 8 GPUs with Tensor Parallel (TP).
10
+ Running parameters for this environment are provided below. For other parallelism strategies, please refer to updates of official documents.
11
+
12
+ Nightly version is needed for reasoning parser.
13
+
14
+ ### Tensor Parallelism
15
+
16
+ Here is a sample launch command with TP=8:
17
+
18
+ ``` bash
19
+
20
+ # node 0:
21
+ vllm serve $MODEL_PATH \
22
+ --served-model-name kimi-k2-thinking \
23
+ --trust-remote-code \
24
+ --tensor-parallel-size 8 \
25
+ --enable-auto-tool-choice \
26
+ --max-num-batched-tokens 32768 \
27
+ --tool-call-parser kimi_k2 \
28
+ --reasoning-parser kimi_k2
29
+ ```
30
+
31
+ **Key parameter notes:**
32
+ - `--enable-auto-tool-choice`: Required when enabling tool usage.
33
+ - `--tool-call-parser kimi_k2`: Required when enabling tool usage.
34
+ - `--reasoning-parser kimi_k2`: Required for correctly processing reasoning content.
35
+ - `--max-num-batched-tokens 32768`: Using chunk prefill to reduce peak memory usage.
36
+
37
+
38
+ ## SGLang Deployment
39
+
40
+ Similarly, here are the examples using TP in SGLang for Deployment.
41
+
42
+ Nightly version is needed for reasoning parser.
43
+
44
+
45
+ ### Tensor Parallelism
46
+
47
+ Here is the simple example code to run TP8 on H200 in a sigle node:
48
+
49
+ ``` bash
50
+ # Node 0
51
+ python -m sglang.launch_server --model-path $MODEL_PATH --tp 8 --trust-remote-code --tool-call-parser kimi_k2 --reasoning_parser kimi_k2
52
+ ```
53
+
54
+ **Key parameter notes:**
55
+ - `--tool-call-parser kimi_k2`: Required when enabling tool usage.
56
+ - `--reasoning_parser kimi_k2`: Required for correctly processing reasoning content.
57
+
58
+
59
+ ## KTransformers Deployment
60
+
61
+ ### Environments
62
+ 1. Follow the official SGLang installation guide to install SGLang:
63
+
64
+ ``` bash
65
+ pip install "sglang[all]"
66
+ ```
67
+ 2. Install KTransformers CPU Kernels
68
+
69
+ The KTransformers CPU kernels (kt-kernel) provide AMX-optimized computation for hybrid inference, for detailed installation instructions and troubleshooting, refer to [the official kt-kernel installation guide](https://github.com/kvcache-ai/ktransformers/blob/main/kt-kernel/README.md).
70
+
71
+ 3. Download Model
72
+
73
+ Download the official KIMI weights as GPU weights.
74
+ Download the AMX INT4 quantized weights provided by Approaching AI [coming soon] as CPU weights.
75
+
76
+ ### Inference
77
+
78
+ ``` bash
79
+ python -m sglang.launch_server --host 0.0.0.0 --port 60000 --model /mnt/data3/models/Kimi-K2-Thinking/ --kt-amx-weight-path /mnt/data3/models/Kimi-K2-Instruct-CPU-weight/ --kt-cpuinfer 56 --kt-threadpool-count 2 --kt-num-gpu-experts 200 --kt-amx-method AMXINT4 --attention-backend triton --trust-remote-code --mem-fraction-static 0.98 --chunked-prefill-size 4096 --max-running-requests 37 --max-total-tokens 37000 --enable-mixed-chunk --tensor-parallel-size 8 --enable-p2p-check --disable-shared-experts-fusion
80
+ ```
81
+ ``` bash
82
+ python ktransformers/server/main.py --model_path /path/to/K2 --gguf_path /path/to/K2 --cache_lens 30000
83
+ ```
84
+
85
+ To enable AMX optimization, run:
86
+
87
+ ``` bash
88
+ python ktransformers/server/main.py --model_path /path/to/K2 --gguf_path /path/to/K2 --cache_lens 30000 --optimize_config_path ktransformers/optimize/optimize_rules/DeepSeek-V3-Chat-fp8-linear-ggml-experts-serve-amx.yaml
89
+ ```
90
+
91
+ ## Others
92
+
93
+ Kimi-K2-Thinking reuses the `DeepSeekV3CausalLM` architecture and convert it's weight into proper shape to save redevelopment effort. To let inference engines distinguish it from DeepSeek-V3 and apply the best optimizations, we set `"model_type": "kimi_k2"` in `config.json`.
94
+
95
+ If you are using a framework that is not on the recommended list, you can still run the model by manually changing `model_type` to "deepseek_v3" in `config.json` as a temporary workaround. You may need to manually parse tool calls in case no tool call parser is available in your framework.
docs/tool_call_guidance.md ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Tool Calling
2
+ To enable the tool calling feature, you may need to set certain tool calling parser options when starting the service. See [deploy_guidance](./deploy_guidance.md) for details.
3
+ In Kimi-K2, a tool calling process includes:
4
+ - Passing function descriptions to Kimi-K2
5
+ - Kimi-K2 decides to make a function call and returns the necessary information for the function call to the user
6
+ - The user performs the function call, collects the call results, and passes the function call results to Kimi-K2
7
+ - Kimi-K2 continues to generate content based on the function call results until the model believes it has obtained sufficient information to respond to the user
8
+
9
+ ### Preparing Tools
10
+ Suppose we have a function `get_weather` that can query the weather conditions in real-time.
11
+ This function accepts a city name as a parameter and returns the weather conditions. We need to prepare a structured description for it so that Kimi-K2 can understand its functionality.
12
+
13
+ ```python
14
+ def get_weather(city):
15
+ return {"weather": "Sunny"}
16
+
17
+ # Collect the tool descriptions in tools
18
+ tools = [{
19
+ "type": "function",
20
+ "function": {
21
+ "name": "get_weather",
22
+ "description": "Get weather information. Call this tool when the user needs to get weather information",
23
+ "parameters": {
24
+ "type": "object",
25
+ "required": ["city"],
26
+ "properties": {
27
+ "city": {
28
+ "type": "string",
29
+ "description": "City name",
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }]
35
+
36
+ # Tool name->object mapping for easy calling later
37
+ tool_map = {
38
+ "get_weather": get_weather
39
+ }
40
+ ```
41
+ ### Chat with tools
42
+ We use `openai.OpenAI` to send messages to Kimi-K2 along with tool descriptions. Kimi-K2 will autonomously decide whether to use and how to use the provided tools.
43
+ If Kimi-K2 believes a tool call is needed, it will return a result with `finish_reason='tool_calls'`. At this point, the returned result includes the tool call information.
44
+ After calling tools with the provided information, we then need to append the tool call results to the chat history and continue calling Kimi-K2.
45
+ Kimi-K2 may need to call tools multiple times until the model believes the current results can answer the user's question. We should check `finish_reason` until it is not `tool_calls`.
46
+
47
+ The results obtained by the user after calling the tools should be added to `messages` with `role='tool'`.
48
+
49
+ ```python
50
+ import json
51
+ from openai import OpenAI
52
+ model_name='moonshotai/Kimi-K2-Instruct'
53
+ client = OpenAI(base_url=endpoint,
54
+ api_key='xxx')
55
+
56
+ messages = [
57
+ {"role": "user", "content": "What's the weather like in Beijing today? Let's check using the tool."}
58
+ ]
59
+ finish_reason = None
60
+ while finish_reason is None or finish_reason == "tool_calls":
61
+ completion = client.chat.completions.create(
62
+ model=model_name,
63
+ messages=messages,
64
+ temperature=0.3,
65
+ tools=tools,
66
+ tool_choice="auto",
67
+ )
68
+ choice = completion.choices[0]
69
+ finish_reason = choice.finish_reason
70
+ # Note: The finish_reason when tool calls end may vary across different engines, so this condition check needs to be adjusted accordingly
71
+ if finish_reason == "tool_calls":
72
+ messages.append(choice.message)
73
+ for tool_call in choice.message.tool_calls:
74
+ tool_call_name = tool_call.function.name
75
+ tool_call_arguments = json.loads(tool_call.function.arguments)
76
+ tool_function = tool_map[tool_call_name]
77
+ tool_result = tool_function(tool_call_arguments)
78
+ print("tool_result", tool_result)
79
+
80
+ messages.append({
81
+ "role": "tool",
82
+ "tool_call_id": tool_call.id,
83
+ "name": tool_call_name,
84
+ "content": json.dumps(tool_result),
85
+ })
86
+ print('-' * 100)
87
+ print(choice.message.content)
88
+ ```
89
+ ### Tool Calling in Streaming Mode
90
+ Tool calling can also be used in streaming mode. In this case, we need to collect the tool call information returned in the stream until we have a complete tool call. Please refer to the code below:
91
+
92
+ ```python
93
+ messages = [
94
+ {"role": "user", "content": "What's the weather like in Beijing today? Let's check using the tool."}
95
+ ]
96
+ finish_reason = None
97
+ msg = ''
98
+ while finish_reason is None or finish_reason == "tool_calls":
99
+ completion = client.chat.completions.create(
100
+ model=model_name,
101
+ messages=messages,
102
+ temperature=0.3,
103
+ tools=tools,
104
+ tool_choice="auto",
105
+ stream=True
106
+ )
107
+ tool_calls = []
108
+ for chunk in completion:
109
+ delta = chunk.choices[0].delta
110
+ if delta.content:
111
+ msg += delta.content
112
+ if delta.tool_calls:
113
+ for tool_call_chunk in delta.tool_calls:
114
+ if tool_call_chunk.index is not None:
115
+ # Extend the tool_calls list
116
+ while len(tool_calls) <= tool_call_chunk.index:
117
+ tool_calls.append({
118
+ "id": "",
119
+ "type": "function",
120
+ "function": {
121
+ "name": "",
122
+ "arguments": ""
123
+ }
124
+ })
125
+
126
+ tc = tool_calls[tool_call_chunk.index]
127
+
128
+ if tool_call_chunk.id:
129
+ tc["id"] += tool_call_chunk.id
130
+ if tool_call_chunk.function.name:
131
+ tc["function"]["name"] += tool_call_chunk.function.name
132
+ if tool_call_chunk.function.arguments:
133
+ tc["function"]["arguments"] += tool_call_chunk.function.arguments
134
+
135
+ finish_reason = chunk.choices[0].finish_reason
136
+ # Note: The finish_reason when tool calls end may vary across different engines, so this condition check needs to be adjusted accordingly
137
+ if finish_reason == "tool_calls":
138
+ for tool_call in tool_calls:
139
+ tool_call_name = tool_call['function']['name']
140
+ tool_call_arguments = json.loads(tool_call['function']['arguments'])
141
+ tool_function = tool_map[tool_call_name]
142
+ tool_result = tool_function(tool_call_arguments)
143
+ messages.append({
144
+ "role": "tool",
145
+ "tool_call_id": tool_call['id'],
146
+ "name": tool_call_name,
147
+ "content": json.dumps(tool_result),
148
+ })
149
+ # The text generated by the tool call is not the final version, reset msg
150
+ msg = ''
151
+
152
+ print(msg)
153
+ ```
154
+ ### Manually Parsing Tool Calls
155
+ The tool call requests generated by Kimi-K2 can also be parsed manually, which is especially useful when the service you are using does not provide a tool-call parser.
156
+ The tool call requests generated by Kimi-K2 are wrapped by `<|tool_calls_section_begin|>` and `<|tool_calls_section_end|>`,
157
+ with each tool call wrapped by `<|tool_call_begin|>` and `<|tool_call_end|>`. The tool ID and arguments are separated by `<|tool_call_argument_begin|>`.
158
+ The format of the tool ID is `functions.{func_name}:{idx}`, from which we can parse the function name.
159
+
160
+ Based on the above rules, we can directly post request to the completions interface and manually parse tool calls.
161
+
162
+ ```python
163
+ import requests
164
+ from transformers import AutoTokenizer
165
+ messages = [
166
+ {"role": "user", "content": "What's the weather like in Beijing today? Let's check using the tool."}
167
+ ]
168
+ msg = ''
169
+ tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
170
+ while True:
171
+ text = tokenizer.apply_chat_template(
172
+ messages,
173
+ tokenize=False,
174
+ tools=tools,
175
+ add_generation_prompt=True,
176
+ )
177
+ payload = {
178
+ "model": model_name,
179
+ "prompt": text,
180
+ "max_tokens": 512
181
+ }
182
+ response = requests.post(
183
+ f"{endpoint}/completions",
184
+ headers={"Content-Type": "application/json"},
185
+ json=payload,
186
+ stream=False,
187
+ )
188
+ raw_out = response.json()
189
+
190
+ raw_output = raw_out["choices"][0]["text"]
191
+ tool_calls = extract_tool_call_info(raw_output)
192
+ if len(tool_calls) == 0:
193
+ # No tool calls
194
+ msg = raw_output
195
+ break
196
+ else:
197
+ for tool_call in tool_calls:
198
+ tool_call_name = tool_call['function']['name']
199
+ tool_call_arguments = json.loads(tool_call['function']['arguments'])
200
+ tool_function = tool_map[tool_call_name]
201
+ tool_result = tool_function(tool_call_arguments)
202
+
203
+ messages.append({
204
+ "role": "tool",
205
+ "tool_call_id": tool_call['id'],
206
+ "name": tool_call_name,
207
+ "content": json.dumps(tool_result),
208
+ })
209
+ print('-' * 100)
210
+ print(msg)
211
+ ```
212
+ Here, `extract_tool_call_info` parses the model output and returns the model call information. A simple implementation would be:
213
+ ```python
214
+ def extract_tool_call_info(tool_call_rsp: str):
215
+ if '<|tool_calls_section_begin|>' not in tool_call_rsp:
216
+ # No tool calls
217
+ return []
218
+ import re
219
+ pattern = r"<\|tool_calls_section_begin\|>(.*?)<\|tool_calls_section_end\|>"
220
+
221
+ tool_calls_sections = re.findall(pattern, tool_call_rsp, re.DOTALL)
222
+
223
+ # Extract multiple tool calls
224
+ func_call_pattern = r"<\|tool_call_begin\|>\s*(?P<tool_call_id>[\w\.]+:\d+)\s*<\|tool_call_argument_begin\|>\s*(?P<function_arguments>.*?)\s*<\|tool_call_end\|>"
225
+ tool_calls = []
226
+ for match in re.findall(func_call_pattern, tool_calls_sections[0], re.DOTALL):
227
+ function_id, function_args = match
228
+ # function_id: functions.get_weather:0
229
+ function_name = function_id.split('.')[1].split(':')[0]
230
+ tool_calls.append(
231
+ {
232
+ "id": function_id,
233
+ "type": "function",
234
+ "function": {
235
+ "name": function_name,
236
+ "arguments": function_args
237
+ }
238
+ }
239
+ )
240
+ return tool_calls
241
+ ```
242
+
243
+ ## FAQ
244
+
245
+ #### Q1: I received special tokens like '<|tool_call_begin|>' in the 'content' field instead of a normal tool_call.
246
+
247
+ This indicates a tool-call crash, which most often occurs in multi-turn tool-calling scenarios due to incorrect tool-call ID. K2 expects the ID to follow the format `functions.func_name:idx`, where `functions` is a fixed string; `func_name` is the actual function name, like `get_weather`, and `idx` is a global counter that starts at 0 and increments with each function invocation.
248
+ Please check all tool-call IDs in the message list.
249
+
250
+
251
+ #### Q2: My tool-call ID is incorrect—how can I fix it?
252
+
253
+ First, make sure your code and chat template are up to date with the latest version from the Hugging Face repo.
254
+ If you're using vLLM or SGLang and they are generating random tool-call IDs, upgrade them to the latest release. For other frameworks, you must either parse the tool-call ID from the model output and set it correctly in the server-side response, or rewrite every tool-call ID according to the rules above on the client side before sending the messages to Kimi K2.
255
+
256
+ #### Q3: My tool call id is correct, but I still get crashed in multiturn tool call.
257
+
258
+ Please describe your situation in the [discussion](https://huggingface.co/moonshotai/Kimi-K2-Instruct-0905/discussions)
figures/Base-Evaluation.png ADDED

Git LFS Details

  • SHA256: d1d3ee49430417c17326c9def19264756a3bc0b0aa001e598d0e0d751ebf93f8
  • Pointer size: 131 Bytes
  • Size of remote file: 245 kB
figures/banner.png ADDED

Git LFS Details

  • SHA256: 380b39db25a6842cedaabad354a0a4929b617835094800124bba756c3b0e98f8
  • Pointer size: 131 Bytes
  • Size of remote file: 292 kB
figures/kimi-logo.png ADDED

Git LFS Details

  • SHA256: 4a80f64242bf907940765adc7bcf340c28dd83334b07c5503792a26495d1933b
  • Pointer size: 130 Bytes
  • Size of remote file: 88 kB
generation_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_length": 131072,
3
+ "eos_token_id": 163586
4
+ }
model-00001-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1b95d261d31fe9ecc1d0cd6c3ad6fb52191b689475a0acb5e17fa14703c416d4
3
+ size 995002080
model-00002-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1fb5ef3388d02b6ddb04ee8126b43794cb9730ee62757917126c3c3bd5615432
3
+ size 9808995784
model-00003-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b05696985be2980de1ef6e25288c86cf8527b2485b7806b49f6478ad0f22e47e
3
+ size 9808995784
model-00004-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e411c8ba5b1141e291cfec0ab8575abdc66405b7180346e2bcf0922e6ce03b70
3
+ size 9808995784
model-00005-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2fb30da4bc8ac8714e2505bc0f408f2de066fd1d3acf496565970995d1571d9a
3
+ size 9808995784
model-00006-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eace8de10915e5f79f611eae90b1f503fe74c02b8e5b172e76c44df089d5efee
3
+ size 9808995784
model-00007-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:055b814232e4316d2d91263cefd93c812877086c257d92ac5ab824173103be5e
3
+ size 9808995784
model-00008-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:af87dadc5413a8fcf30204a37acfff9df666df557aa5ef47ec311777a76f0e15
3
+ size 9808995784
model-00009-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3180accd136cce3bc614d89a28d799b1a6bcca998ebf6b663b0cc2043718b392
3
+ size 9808995784
model-00010-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f3885c59a40662088e37b4bee49cdd33428cd40ca18f165405cda7806f4931de
3
+ size 9808995784
model-00011-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eb7591448d508cccba625d4d02affd4f9a2c92517728e3bf2ae5e51214f31ac9
3
+ size 9808999256
model-00012-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:766eb3b51f5bf5aeb99f6a7c61f83b56516dc9fcc2b94a7cb9b999b23e7215dd
3
+ size 9808999256
model-00013-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ca1661d9843460f63870282cbbe22a68768a7d7bddf5a983a430249ed8e4724a
3
+ size 9808999256
model-00014-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:855acdcee579c79e463c9e3f2dd8a35b7ed0c4109c387e4a5780987e7c98d6a3
3
+ size 9808999256
model-00015-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7107908272365b31008c30e10f0b90f64e8fdc328ad7ba573c9a0eeea59bb550
3
+ size 9808999256
model-00016-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ca84d3d21a5fcde572ea00447a30fb6174107f9dcb13c994ba6540717056620c
3
+ size 9808999256
model-00017-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2f84512dd980f1c23b7ea2b81cd98cca4deae5df175f3903a4110c4573b75173
3
+ size 9808999256
model-00018-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:590d7f85ea053663cb7286dfb619f7a7d3b21ff69bd955f72c8014ca2236b643
3
+ size 9808999256
model-00019-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6695243bd3ce55705e384ef51be993ba6b881ddbff841510be7937141b05761d
3
+ size 9808999256
model-00020-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e84f956e805f92ba224da76e5adc8f4303e5b66b7ac82aa2b793517c0f7bb1a3
3
+ size 9808999256
model-00021-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8ed0c3abc1898eb36cacdcf152f6d22f244dd8f95ec3e597a406575ef936e12c
3
+ size 9808999256
model-00022-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:96ce2ddc9ff80d522e57437c123147066593e429523e1a24b0e5b134b8af5030
3
+ size 9808999256
model-00023-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bc62e7fcd8184cd45c046e2f92f2abde6009c160b7b0cd57da536af38e66d771
3
+ size 9808999256
model-00024-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bdc950d90d49057ba81e45ac440ac6ebd187701b43705d3b5a20d67ba0128d9b
3
+ size 9808999256
model-00025-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cb792b1d2591fda0a7b0ff0e5bf18841a2b1cd09ae075ae027923818f7bf1b5f
3
+ size 9808999256
model-00026-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a16fe7a9816d71e5927fc93e229aef8821a37ca2382700ef9878c4b72cb9ee34
3
+ size 9808999256
model-00027-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:149b930f77cad67a727fe66333ac16dc834300d6cc7a23a0df74c286c37f972c
3
+ size 9808999256
model-00028-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:10ef5c61dacb9c0390dd5e783a82d10bbaf25b1ff5d1cb2f1bbfe0a59b14d0cd
3
+ size 9808999256
model-00029-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f694289ad0f5c42dbcbcec326a8d2286f3b989e8c72a23c79cab8145ce4411d7
3
+ size 9808999256
model-00030-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3478d49b25e9b1964e55c095f87acdc742268ff1c343863b1b2c36d1a08cd941
3
+ size 9808999256
model-00031-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a537d379ca0382d20eb4ba04a19ffbb53d5387fc3c828cfb597135c4b61fc9d8
3
+ size 9808999256
model-00032-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4cd98998e2379b38f7ac412df3a1a129e1620cd3c76d97fa0366d92cad984c02
3
+ size 9808999256
model-00033-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:45a2dcd2e1ffd907e820d2721bfa53be572c0048d8c6d1a1c4de7039daacea91
3
+ size 9808999256
model-00034-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1cda7176b5651e3a3be960058f2e9ccdb965680c469a241b9169bcca7e861abf
3
+ size 9808999256
model-00035-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8fcd19675824aa0741579ecf437ffe37f6ee17a2064f58fb196f5b20bd587161
3
+ size 9808999256
model-00036-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3735102c0af02bf52a566bbe18a93622779eeec6329eec1fc87033d4a01dbe05
3
+ size 9808999256
model-00037-of-000062.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:562593af7257c91cdfc5662ab1c46d3f7bba61ffe0d233c9958f70e357c28466
3
+ size 9808999256