danielhanchen commited on
Commit
9990294
·
verified ·
1 Parent(s): b25efaf

Upload folder using huggingface_hub

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 +1 -0
  2. README.md +341 -0
  3. added_tokens.json +28 -0
  4. chat_template.jinja +145 -0
  5. config.json +216 -0
  6. configuration_mimo_v2_flash.py +109 -0
  7. merges.txt +0 -0
  8. model.safetensors.index.json +0 -0
  9. model_0.safetensors +3 -0
  10. model_1.safetensors +3 -0
  11. model_10.safetensors +3 -0
  12. model_10_linear_fc1.safetensors +3 -0
  13. model_10_linear_fc2.safetensors +3 -0
  14. model_11.safetensors +3 -0
  15. model_11_linear_fc1.safetensors +3 -0
  16. model_11_linear_fc2.safetensors +3 -0
  17. model_12.safetensors +3 -0
  18. model_12_linear_fc1.safetensors +3 -0
  19. model_12_linear_fc2.safetensors +3 -0
  20. model_13.safetensors +3 -0
  21. model_13_linear_fc1.safetensors +3 -0
  22. model_13_linear_fc2.safetensors +3 -0
  23. model_14.safetensors +3 -0
  24. model_14_linear_fc1.safetensors +3 -0
  25. model_14_linear_fc2.safetensors +3 -0
  26. model_15.safetensors +3 -0
  27. model_15_linear_fc1.safetensors +3 -0
  28. model_15_linear_fc2.safetensors +3 -0
  29. model_16.safetensors +3 -0
  30. model_16_linear_fc1.safetensors +3 -0
  31. model_16_linear_fc2.safetensors +3 -0
  32. model_17.safetensors +3 -0
  33. model_17_linear_fc1.safetensors +3 -0
  34. model_17_linear_fc2.safetensors +3 -0
  35. model_18.safetensors +3 -0
  36. model_18_linear_fc1.safetensors +3 -0
  37. model_18_linear_fc2.safetensors +3 -0
  38. model_19.safetensors +3 -0
  39. model_19_linear_fc1.safetensors +3 -0
  40. model_19_linear_fc2.safetensors +3 -0
  41. model_1_linear_fc1.safetensors +3 -0
  42. model_1_linear_fc2.safetensors +3 -0
  43. model_2.safetensors +3 -0
  44. model_20.safetensors +3 -0
  45. model_20_linear_fc1.safetensors +3 -0
  46. model_20_linear_fc2.safetensors +3 -0
  47. model_21.safetensors +3 -0
  48. model_21_linear_fc1.safetensors +3 -0
  49. model_21_linear_fc2.safetensors +3 -0
  50. model_22.safetensors +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* 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
 
 
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
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - unsloth
4
+ base_model:
5
+ - XiaomiMiMo/MiMo-V2-Flash
6
+ license: mit
7
+ library_name: transformers
8
+ ---
9
+ > [!NOTE]
10
+ > Includes Unsloth **chat template fixes**! <br> For `llama.cpp`, use `--jinja`
11
+ >
12
+
13
+ <div>
14
+ <p style="margin-top: 0;margin-bottom: 0;">
15
+ <em><a href="https://docs.unsloth.ai/basics/unsloth-dynamic-v2.0-gguf">Unsloth Dynamic 2.0</a> achieves superior accuracy & outperforms other leading quants.</em>
16
+ </p>
17
+ <div style="display: flex; gap: 5px; align-items: center; ">
18
+ <a href="https://github.com/unslothai/unsloth/">
19
+ <img src="https://github.com/unslothai/unsloth/raw/main/images/unsloth%20new%20logo.png" width="133">
20
+ </a>
21
+ <a href="https://discord.gg/unsloth">
22
+ <img src="https://github.com/unslothai/unsloth/raw/main/images/Discord%20button.png" width="173">
23
+ </a>
24
+ <a href="https://docs.unsloth.ai/">
25
+ <img src="https://raw.githubusercontent.com/unslothai/unsloth/refs/heads/main/images/documentation%20green%20button.png" width="143">
26
+ </a>
27
+ </div>
28
+ </div>
29
+
30
+
31
+ <br/><br/>
32
+
33
+ <div align="center">
34
+ <picture>
35
+ <source srcset="https://github.com/XiaomiMiMo/MiMo-V2-Flash/raw/main/figures/Xiaomi_MiMo_darkmode.png?raw=true" media="(prefers-color-scheme: dark)">
36
+ <img src="https://github.com/XiaomiMiMo/MiMo-V2-Flash/raw/main/figures/Xiaomi_MiMo.png?raw=true" width="60%" alt="Xiaomi-MiMo" />
37
+ </picture>
38
+ </div>
39
+
40
+ <br/>
41
+
42
+ <div align="center" style="line-height: 1;">
43
+ |
44
+ <a href="https://huggingface.co/XiaomiMiMo/MiMo-V2-Flash" target="_blank">🤗 HuggingFace</a>
45
+ &nbsp;|
46
+ <a href="https://github.com/XiaomiMiMo/MiMo-V2-Flash/blob/main/paper.pdf" target="_blank">📔 Technical Report </a>
47
+ &nbsp;|
48
+ <a href="https://mimo.xiaomi.com/blog/mimo-v2-flash" target="_blank">📰 Blog </a>
49
+ &nbsp;|
50
+ <br/><br/>
51
+ <strong>Play around!</strong> &nbsp;
52
+ <a href="https://aistudio.xiaomimimo.com" target="_blank">🗨️ Xiaomi MiMo Studio </a>
53
+ &nbsp;
54
+ <a href="https://platform.xiaomimimo.com/" target="_blank">🎨 Xiaomi MiMo API Platform </a>
55
+ </div>
56
+ <br/>
57
+
58
+ # MiMo-V2-Flash
59
+
60
+ **MiMo-V2-Flash** is a Mixture-of-Experts (MoE) language model with **309B total parameters** and **15B active parameters**. Designed for high-speed reasoning and agentic workflows, it utilizes a novel hybrid attention architecture and Multi-Token Prediction (MTP) to achieve state-of-the-art performance while significantly reducing inference costs.
61
+
62
+ <p align="center">
63
+ <img width="80%" src="https://github.com/XiaomiMiMo/MiMo-V2-Flash/raw/main/figures/MiMo-v2-flash-performance.jpg?raw=true">
64
+ </p>
65
+
66
+ -----
67
+
68
+ ## 1. Introduction
69
+
70
+ MiMo-V2-Flash creates a new balance between long-context modeling capability and inference efficiency. Key features include:
71
+
72
+ * **Hybrid Attention Architecture**: Interleaves Sliding Window Attention (SWA) and Global Attention (GA) with a 5:1 ratio and an aggressive 128-token window. This reduces KV-cache storage by nearly 6x while maintaining long-context performance via learnable **attention sink bias**.
73
+ * **Multi-Token Prediction (MTP)**: Equipped with a lightweight MTP module (0.33B params/block) using dense FFNs. This triples output speed during inference and will be good to accelerates rollout in RL training.
74
+ * **Efficient Pre-Training**: Trained on 27T tokens using FP8 mixed precision and native 32k seq length. The context window supports up to 256k length.
75
+ * **Agentic Capabilities**: Post-training utilizes Multi-Teacher On-Policy Distillation (MOPD) and large-scale agentic RL, achieving superior performance on **SWE-Bench** and complex reasoning tasks.
76
+
77
+ -----
78
+
79
+ ## 2. Model Downloads
80
+
81
+ | Model | Total Params | Active Params | Context Length | Download |
82
+ | :--------------------- | :----------: | :-----------: | :------------: | :-------------------------------------------------------------------: |
83
+ | **MiMo-V2-Flash-Base** | 309B | 15B | 256k | [🤗 HuggingFace](https://huggingface.co/XiaomiMiMo/MiMo-V2-Flash-Base) |
84
+ | **MiMo-V2-Flash** | 309B | 15B | 256k | [🤗 HuggingFace](https://huggingface.co/XiaomiMiMo/MiMo-V2-Flash) |
85
+
86
+ > [!IMPORTANT]
87
+ > We also open-source the 3-layer MTP weights to foster community research.
88
+
89
+ -----
90
+
91
+ ## 3. Evaluation Results
92
+
93
+ ### Base Model Evaluation
94
+
95
+ MiMo-V2-Flash-Base demonstrates strong performance across standard benchmarks, surpassing models with significantly larger parameter counts.
96
+
97
+ | Category | Benchmark | Setting/Length | MiMo-V2-Flash Base | Kimi-K2 Base | DeepSeek-V3.1 Base | DeepSeek-V3.2 Exp Base |
98
+ | :--------------- | :---------------------- | :------------- | :----------------: | :-------------: | :----------------: | :--------------------: |
99
+ | **Params** | **#Activated / #Total** | - | **15B / 309B** | **32B / 1043B** | **37B / 671B** | **37B / 671B** |
100
+ | **General** | BBH | 3-shot | 88.5 | 88.7 | 88.2 | 88.7 |
101
+ | | MMLU | 5-shot | 86.7 | 87.8 | 87.4 | 87.8 |
102
+ | | MMLU-Redux | 5-shot | 90.6 | 90.2 | 90.0 | 90.4 |
103
+ | | MMLU-Pro | 5-shot | 73.2 | 69.2 | 58.8 | 62.1 |
104
+ | | DROP | 3-shot | 84.7 | 83.6 | 86.3 | 86.6 |
105
+ | | ARC-Challenge | 25-shot | 95.9 | 96.2 | 95.6 | 95.5 |
106
+ | | HellaSwag | 10-shot | 88.5 | 94.6 | 89.2 | 89.4 |
107
+ | | WinoGrande | 5-shot | 83.8 | 85.3 | 85.9 | 85.6 |
108
+ | | TriviaQA | 5-shot | 80.3 | 85.1 | 83.5 | 83.9 |
109
+ | | GPQA-Diamond | 5-shot | 55.1 | 48.1 | 51.0 | 52.0 |
110
+ | | SuperGPQA | 5-shot | 41.1 | 44.7 | 42.3 | 43.6 |
111
+ | | SimpleQA | 5-shot | 20.6 | 35.3 | 26.3 | 27.0 |
112
+ | **Math** | GSM8K | 8-shot | 92.3 | 92.1 | 91.4 | 91.1 |
113
+ | | MATH | 4-shot | 71.0 | 70.2 | 62.6 | 62.5 |
114
+ | | AIME 24&25 | 2-shot | 35.3 | 31.6 | 21.6 | 24.8 |
115
+ | **Code** | HumanEval+ | 1-shot | 70.7 | 84.8 | 64.6 | 67.7 |
116
+ | | MBPP+ | 3-shot | 71.4 | 73.8 | 72.2 | 69.8 |
117
+ | | CRUXEval-I | 1-shot | 67.5 | 74.0 | 62.1 | 63.9 |
118
+ | | CRUXEval-O | 1-shot | 79.1 | 83.5 | 76.4 | 74.9 |
119
+ | | MultiPL-E HumanEval | 0-shot | 59.5 | 60.5 | 45.9 | 45.7 |
120
+ | | MultiPL-E MBPP | 0-shot | 56.7 | 58.8 | 52.5 | 50.6 |
121
+ | | BigCodeBench | 0-shot | 70.1 | 61.7 | 63.0 | 62.9 |
122
+ | | LiveCodeBench v6 | 1-shot | 30.8 | 26.3 | 24.8 | 24.9 |
123
+ | | SWE-Bench (AgentLess) | 3-shot | 30.8 | 28.2 | 24.8 | 9.4* |
124
+ | **Chinese** | C-Eval | 5-shot | 87.9 | 92.5 | 90.0 | 91.0 |
125
+ | | CMMLU | 5-shot | 87.4 | 90.9 | 88.8 | 88.9 |
126
+ | | C-SimpleQA | 5-shot | 61.5 | 77.6 | 70.9 | 68.0 |
127
+ | **Multilingual** | GlobalMMLU | 5-shot | 76.6 | 80.7 | 81.9 | 82.0 |
128
+ | | INCLUDE | 5-shot | 71.4 | 75.3 | 77.2 | 77.2 |
129
+ | **Long Context** | NIAH-Multi | 32K | 99.3 | 99.8 | 99.7 | 85.6* |
130
+ | | | 64K | 99.9 | 100.0 | 98.6 | 85.9* |
131
+ | | | 128K | 98.6 | 99.5 | 97.2 | 94.3* |
132
+ | | | 256K | 96.7 | - | - | - |
133
+ | | GSM-Infinite Hard | 16K | 37.7 | 34.6 | 41.5 | 50.4 |
134
+ | | | 32K | 33.7 | 26.1 | 38.8 | 45.2 |
135
+ | | | 64K | 31.5 | 16.0 | 34.7 | 32.6 |
136
+ | | | 128K | 29.0 | 8.8 | 28.7 | 25.7 |
137
+
138
+ > \* indicates the model may fail to follow the prompt or format.
139
+
140
+ ### Post-training Model Evaluation
141
+
142
+ Following our Post-Training Paradigm with MOPD and Agentic RL, the model achieves SOTA reasoning and agentic performance.
143
+
144
+
145
+
146
+ | Benchmark | MiMo-V2 Flash | Kimi-K2 Thinking | DeepSeek-V3.2 Thinking | Gemini-3.0 Pro | Claude Sonnet 4.5 | GPT-5 High |
147
+ | :----------------------------- | :-----------: | :--------------: | :--------------------: | :------------: | :---------------: | :--------: |
148
+ | **Reasoning** | | | | | | |
149
+ | MMLU-Pro | 84.9 | 84.6 | 85.0 | 90.1 | 88.2 | 87.5 |
150
+ | GPQA-Diamond | 83.7 | 84.5 | 82.4 | 91.9 | 83.4 | 85.7 |
151
+ | HLE (no tools) | 22.1 | 23.9 | 25.1 | 37.5 | 13.7 | 26.3 |
152
+ | AIME 2025 | 94.1 | 94.5 | 93.1 | 95.0 | 87.0 | 94.6 |
153
+ | HMMT Feb. 2025 | 84.4 | 89.4 | 92.5 | 97.5 | 79.2 | 88.3 |
154
+ | LiveCodeBench-v6 | 80.6 | 83.1 | 83.3 | 90.7 | 64.0 | 84.5 |
155
+ | **General Writing** | | | | | | |
156
+ | Arena-Hard (Hard Prompt) | 54.1 | 71.9 | 53.4 | 72.6 | 63.3 | 71.9 |
157
+ | Arena-Hard (Creative Writing) | 86.2 | 80.1 | 88.8 | 93.6 | 76.7 | 92.2 |
158
+ | **Long Context** | | | | | | |
159
+ | LongBench V2 | 60.6 | 45.1 | 58.4 | 65.6 | 61.8 | - |
160
+ | MRCR | 45.7 | 44.2 | 55.5 | 89.7 | 55.4 | - |
161
+ | **Code Agent** | | | | | | |
162
+ | SWE-Bench Verified | 73.4 | 71.3 | 73.1 | 76.2 | 77.2 | 74.9 |
163
+ | SWE-Bench Multilingual | 71.7 | 61.1 | 70.2 | - | 68.0 | 55.3 |
164
+ | Terminal-Bench Hard | 30.5 | 30.6 | 35.4 | 39.0 | 33.3 | 30.5 |
165
+ | Terminal-Bench 2.0 | 38.5 | 35.7 | 46.4 | 54.2 | 42.8 | 35.2 |
166
+ | **General Agent** | | | | | | |
167
+ | BrowseComp | 45.4 | - | 51.4 | - | 24.1 | 54.9 |
168
+ | BrowseComp (w/ Context Manage) | 58.3 | 60.2 | 67.6 | 59.2 | - | - |
169
+ | \\(\tau^2\\)-Bench | 80.3 | 74.3 | 80.3 | 85.4 | 84.7 | 80.2 |
170
+
171
+ -----
172
+
173
+ ## 4. Model Architecture
174
+
175
+ <p align="center">
176
+ <img width="80%" src="https://github.com/XiaomiMiMo/MiMo-V2-Flash/raw/main/figures/MiMo-v2-flash-arch.png?raw=true">
177
+ </p>
178
+
179
+ ### Hybrid Sliding Window Attention
180
+
181
+ MiMo-V2-Flash addresses the quadratic complexity of long contexts by interleaving Local Sliding Window Attention (SWA) and Global Attention (GA).
182
+
183
+ * **Configuration**: Stacks of \\(M=8\\) hybrid blocks. Each block contains \\(N=5\\) SWA layers followed by 1 GA layer.
184
+ * **Efficiency**: SWA layers use a window size of 128 tokens, reducing KV cache significantly.
185
+ * **Sink Bias**: Learnable attention sink bias is applied to maintain performance despite the aggressive window size.
186
+
187
+ ### Lightweight Multi-Token Prediction (MTP)
188
+
189
+ Unlike traditional speculative decoding, our MTP module is natively integrated for training and inference.
190
+
191
+ * **Structure**: Uses a dense FFN (instead of MoE) and SWA (instead of GA) to keep the parameter count low (0.33B per block).
192
+ * **Performance**: Facilitates self-speculative decoding, tripling generation speed and mitigating GPU idleness during small-batch RL training.
193
+
194
+ -----
195
+
196
+ ## 5. Post-Training Technical Highlights
197
+
198
+ MiMo-V2-Flash leverages a post-training pipeline designed to maximize reasoning and agentic capabilities through innovative distillation and reinforcement learning strategies.
199
+
200
+ ### 5.1 Multi-Teacher On-Policy Distillation (MOPD)
201
+
202
+ We introduce **Multi-Teacher On-Policy Distillation (MOPD)**, a new paradigm that formulates knowledge distillation as a reinforcement learning process.
203
+ * **Dense Token-Level Guidance**: Unlike methods relying on sparse sequence-level feedback, MOPD utilizes domain-specific expert models (teachers) to provide supervision at every token position.
204
+ * **On-Policy Optimization**: The student model learns from its own generated responses rather than a fixed dataset. This eliminates exposure bias and ensures smaller, more stable gradient updates.
205
+ * **Inherent Reward Robustness**: Rewards are derived from the distribution divergence between student and teacher, making the process naturally resistant to reward hacking.
206
+
207
+ ### 5.2 Scaling Agentic RL
208
+
209
+ We significantly scale up the agentic training environments to improve intelligence and generalization.
210
+ * **Massive Code Agent Environments**: We utilize real-world GitHub issues to create over 100,000 verifiable tasks. Our automated pipeline maintains a Kubernetes cluster capable of running over 10,000 concurrent pods with a 70% environment setup success rate.
211
+ * **Multimodal Verifier for WebDev**: For web development tasks, we employ a vision-based verifier that evaluates code execution via recorded videos rather than static screenshots. This reduces visual hallucination and ensures functional correctness.
212
+ * **Cross-Domain Generalization**: Our experiments show that large-scale RL training on code agents effectively generalizes to other domains, boosting performance in Math and General Agent tasks.
213
+
214
+ ### 5.3 Advanced RL Infrastructure
215
+
216
+ To support high-throughput RL training for large-scale MoE models, we implemented several infrastructure optimizations on top of SGLang and Megatron-LM.
217
+ * **Rollout Routing Replay (R3)**: Addresses numerical precision inconsistencies in MoE routing between inference and training. R3 reuses the exact routed experts from rollout during the training pass, ensuring consistency with negligible overhead.
218
+ * **Request-Level Prefix Cache**: In multi-turn agent training, this cache stores KV states and routed experts from prior turns. It avoids re-computation and ensures sampling consistency across turns.
219
+ * **Fine-Grained Data Scheduler**: We extend the rollout engine to schedule fine-grained sequences instead of micro-batches. Combined with partial rollout, this significantly reduces GPU idleness caused by long-tail stragglers.
220
+ * **Toolbox & Tool Manager**: A two-layer design using Ray actor pools to handle resource contention. It eliminates cold-start delays for tool execution and isolates task logic from system policies.
221
+
222
+ -----
223
+
224
+ ## 6. Inference & Deployment
225
+
226
+ MiMo-V2-Flash supports FP8 mixed precision inference. We recommend using **SGLang** for optimal performance.
227
+
228
+ ### Quick Start with SGLang
229
+
230
+ ```bash
231
+ pip install sglang
232
+
233
+ # Launch server
234
+ python3 -m sglang.launch_server \
235
+ --model-path XiaomiMiMo/MiMo-V2-Flash \
236
+ --served-model-name mimo-v2-flash \
237
+ --pp-size 1 \
238
+ --dp-size 2 \
239
+ --enable-dp-attention \
240
+ --tp-size 8 \
241
+ --moe-a2a-backend deepep \
242
+ --page-size 1 \
243
+ --host 0.0.0.0 \
244
+ --port 9001 \
245
+ --trust-remote-code \
246
+ --mem-fraction-static 0.75 \
247
+ --max-running-requests 128 \
248
+ --chunked-prefill-size 16384 \
249
+ --reasoning-parser qwen3 \
250
+ --tool-call-parser mimo \
251
+ --context-length 262144 \
252
+ --attention-backend fa3 \
253
+ --speculative-algorithm EAGLE \
254
+ --speculative-num-steps 3 \
255
+ --speculative-eagle-topk 1 \
256
+ --speculative-num-draft-tokens 4 \
257
+ --enable-mtp
258
+
259
+ # Send request
260
+ curl -i http://localhost:9001/v1/chat/completions \
261
+ -H 'Content-Type:application/json' \
262
+ -d '{
263
+ "messages" : [{
264
+ "role": "user",
265
+ "content": "Nice to meet you MiMo"
266
+ }],
267
+ "model": "mimo-v2-flash",
268
+ "max_tokens": 4096,
269
+ "temperature": 0.8,
270
+ "top_p": 0.95,
271
+ "stream": true,
272
+ "chat_template_kwargs": {
273
+ "enable_thinking": true
274
+ }
275
+ }'
276
+ ```
277
+
278
+ ### Notifications
279
+
280
+ #### 1. System prompt
281
+
282
+ > [!IMPORTANT]
283
+ > The following system prompts are **HIGHLY** recommended, please choose from English and Chinese version.
284
+
285
+ English
286
+
287
+ ```plaintext
288
+ You are MiMo, an AI assistant developed by Xiaomi.
289
+
290
+ Today's date: {date} {week}. Your knowledge cutoff date is December 2024.
291
+ ```
292
+
293
+ Chinese
294
+
295
+ ```plaintext
296
+ 你是MiMo(中文名称也是MiMo),是小米公司研发的AI智能助手。
297
+
298
+ 今天的日期:{date} {week},你���知识截止日期是2024年12月。
299
+ ```
300
+
301
+ #### 2. Sampling parameters
302
+
303
+ > [!IMPORTANT]
304
+ > Recommended sampling parameters:
305
+ >
306
+ > `top_p=0.95`
307
+ >
308
+ > `temperature=0.8` for math, writing, web-dev
309
+ >
310
+ > `temperature=0.3` for agentic taks (e.g., vibe-coding, tool-use)
311
+
312
+ #### 3. Tool-use practice
313
+
314
+ > [!IMPORTANT]
315
+ > In the thinking mode with multi-turn tool calls, the model returns a `reasoning_content` field alongside `tool_calls`. To continue the conversation, the user must persist all history `reasoning_content` in the `messages` array of each subsequent request.
316
+
317
+ -----
318
+
319
+ ## 7. Citation
320
+
321
+ If you find our work helpful, please cite our technical report:
322
+
323
+ ```bibtex
324
+ @misc{mimo2025flash,
325
+ title={MiMo-V2-Flash Technical Report},
326
+ author={LLM-Core Xiaomi},
327
+ year={2025},
328
+ url={https://github.com/XiaomiMiMo/MiMo-V2-Flash/paper.pdf}
329
+ }
330
+ ```
331
+
332
+ ## 8. Contact
333
+
334
+ Please contact us at [mimo@xiaomi.com](mailto:mimo@xiaomi.com), join our WeChat group below or open an issue if you have any questions.
335
+
336
+ <p align="center">
337
+ <img src="https://github.com/XiaomiMiMo/MiMo-V2-Flash/raw/main/figures/wechat_group/wechat1.jpg?raw=true" width="20%" />
338
+ <img src="https://github.com/XiaomiMiMo/MiMo-V2-Flash/raw/main/figures/wechat_group/wechat2.jpg?raw=true" width="20%" />
339
+ <img src="https://github.com/XiaomiMiMo/MiMo-V2-Flash/raw/main/figures/wechat_group/wechat3.jpg?raw=true" width="20%" />
340
+ <img src="https://github.com/XiaomiMiMo/MiMo-V2-Flash/raw/main/figures/wechat_group/wechat4.jpg?raw=true" width="20%" />
341
+ </p>
added_tokens.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "</think>": 151668,
3
+ "</tool_call>": 151658,
4
+ "</tool_response>": 151666,
5
+ "<think>": 151667,
6
+ "<tool_call>": 151657,
7
+ "<tool_response>": 151665,
8
+ "<|box_end|>": 151649,
9
+ "<|box_start|>": 151648,
10
+ "<|endoftext|>": 151643,
11
+ "<|file_sep|>": 151664,
12
+ "<|fim_middle|>": 151660,
13
+ "<|fim_pad|>": 151662,
14
+ "<|fim_prefix|>": 151659,
15
+ "<|fim_suffix|>": 151661,
16
+ "<|im_end|>": 151645,
17
+ "<|im_start|>": 151644,
18
+ "<|image_pad|>": 151655,
19
+ "<|object_ref_end|>": 151647,
20
+ "<|object_ref_start|>": 151646,
21
+ "<|quad_end|>": 151651,
22
+ "<|quad_start|>": 151650,
23
+ "<|repo_name|>": 151663,
24
+ "<|video_pad|>": 151656,
25
+ "<|vision_end|>": 151653,
26
+ "<|vision_pad|>": 151654,
27
+ "<|vision_start|>": 151652
28
+ }
chat_template.jinja ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {# Unsloth template fixes #}
2
+ {%- if not add_generation_prompt is defined -%}
3
+ {%- set add_generation_prompt = false -%}
4
+ {%- endif -%}
5
+ {%- if not enable_thinking is defined -%}
6
+ {%- set enable_thinking = false -%}
7
+ {%- endif -%}
8
+ {%- if not keep_all_reasoning is defined -%}
9
+ {%- set keep_all_reasoning = false -%}
10
+ {%- endif -%}
11
+ {%- macro render_extra_keys(json_dict, handled_keys) -%}
12
+ {%- if json_dict is mapping %}
13
+ {%- for json_key in json_dict if json_key not in handled_keys %}
14
+ {%- if json_dict[json_key] is mapping or (json_dict[json_key] is sequence and json_dict[json_key] is not string) %}
15
+ {{- '\n<' ~ json_key ~ '>' ~ (json_dict[json_key] | tojson | safe) ~ '</' ~ json_key ~ '>' }}
16
+ {%- else %}
17
+ {{-'\n<' ~ json_key ~ '>' ~ (json_dict[json_key] | string) ~ '</' ~ json_key ~ '>' }}
18
+ {%- endif %}
19
+ {%- endfor %}
20
+ {%- endif %}
21
+ {%- endmacro -%}
22
+ {%- if messages[0]["role"] == "system" %}
23
+ {%- set system_message = messages[0]["content"] %}
24
+ {%- set loop_messages = messages[1:] %}
25
+ {%- else %}
26
+ {%- set loop_messages = messages %}
27
+ {%- endif %}
28
+ {%- set ns = namespace(last_user_index=-1) %}
29
+ {%- for m in loop_messages %}
30
+ {%- if m.role == 'user' %}
31
+ {%- set ns.last_user_index = loop.index0 -%}
32
+ {%- endif %}
33
+ {%- endfor %}
34
+ {%- if not tools is defined %}
35
+ {%- set tools = [] %}
36
+ {%- endif %}
37
+ {%- if system_message is defined %}
38
+ {{- "<|im_start|>system\n" + system_message }}
39
+ {%- else %}
40
+ {{- "<|im_start|>system\nYou are MiMo, a helpful AI assistant engineered by Xiaomi." }}
41
+ {%- endif %}
42
+ {%- if tools is iterable and tools | length > 0 %}
43
+ {{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou have access to the following functions:\n\n" }}
44
+ {{- "<tools>" }}
45
+ {%- for tool in tools %}
46
+ {%- if tool.function is defined %}
47
+ {%- set tool = tool.function %}
48
+ {%- endif %}
49
+ {{- "\n<function>\n<name>" ~ tool.name ~ "</name>" }}
50
+ {%- if tool.description is defined %}
51
+ {{- '\n<description>' ~ (tool.description | trim) ~ '</description>' }}
52
+ {%- endif %}
53
+ {{- '\n<parameters>' }}
54
+ {%- if tool.parameters is defined and tool.parameters is mapping and tool.parameters.properties is defined and tool.parameters.properties is mapping %}
55
+ {%- for param_name, param_fields in tool.parameters.properties|items %}
56
+ {{- '\n<parameter>' }}
57
+ {{- '\n<name>' ~ param_name ~ '</name>' }}
58
+ {%- if param_fields.type is defined %}
59
+ {{- '\n<type>' ~ (param_fields.type | string) ~ '</type>' }}
60
+ {%- endif %}
61
+ {%- if param_fields.description is defined %}
62
+ {{- '\n<description>' ~ (param_fields.description | trim) ~ '</description>' }}
63
+ {%- endif %}
64
+ {%- set handled_keys = ['name', 'type', 'description'] %}
65
+ {{- render_extra_keys(param_fields, handled_keys) }}
66
+ {{- '\n</parameter>' }}
67
+ {%- endfor %}
68
+ {%- endif %}
69
+ {%- set handled_keys = ['type', 'properties'] %}
70
+ {{- render_extra_keys(tool.parameters, handled_keys) }}
71
+ {{- '\n</parameters>' }}
72
+ {%- set handled_keys = ['type', 'name', 'description', 'parameters'] %}
73
+ {{- render_extra_keys(tool, handled_keys) }}
74
+ {{- '\n</function>' }}
75
+ {%- endfor %}
76
+ {{- "\n</tools>" }}
77
+ {{- '\n\nFor each function call, output the function name and arguments in the following format:\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>value_1</parameter>\n<parameter=example_parameter_2>This is the value for the second parameter\nthat can span\nmultiple lines</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- DO NOT use function calls inside <think></think> tags.\n- The value enclosed between parameter tags is preserved exactly as-is, including newlines and spaces.\n</IMPORTANT>' }}
78
+ {%- endif %}
79
+ {{- '<|im_end|>' }}
80
+ {%- for message in loop_messages %}
81
+ {%- if message.content is string %}
82
+ {%- set content = message.content %}
83
+ {%- else %}
84
+ {%- set content = '' %}
85
+ {%- endif %}
86
+ {%- if message.role == "assistant" %}
87
+ {%- if message.reasoning_content is string %}
88
+ {%- set reasoning_content = message.reasoning_content %}
89
+ {%- else %}
90
+ {%- set reasoning_content = '' %}
91
+ {%- if '</think>' in content %}
92
+ {%- set reasoning_content = content.split('</think>')[0].split('<think>')[-1] %}
93
+ {%- set content = content.split('</think>')[-1] %}
94
+ {%- endif %}
95
+ {%- endif %}
96
+ {%- if (keep_all_reasoning or loop.index0 > ns.last_user_index) and reasoning_content -%}
97
+ {{- '<|im_start|>' + message.role + '\n<think>' + reasoning_content + '</think>' + content }}
98
+ {%- else %}
99
+ {{- '<|im_start|>' + message.role + '\n<think></think>' + content }}
100
+ {%- endif %}
101
+ {%- if message.tool_calls is defined and message.tool_calls is iterable and message.tool_calls | length > 0 %}
102
+ {%- for tool_call in message.tool_calls %}
103
+ {%- if tool_call.function is defined %}
104
+ {%- set tool_call = tool_call.function %}
105
+ {%- endif %}
106
+ {{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
107
+ {%- if tool_call.arguments is defined %}{%- if tool_call.arguments is mapping %}
108
+ {%- for args_name, args_value in tool_call.arguments|items %}
109
+ {{- '<parameter=' + args_name + '>' }}
110
+ {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
111
+ {{- args_value }}
112
+ {{- '</parameter>\n' }}
113
+ {%- endfor %}{%- endif %}
114
+ {%- endif %}
115
+ {{- '</function>\n</tool_call>' }}
116
+ {%- endfor %}
117
+ {%- endif %}
118
+ {{- '<|im_end|>' }}
119
+ {%- elif message.role == "user" or message.role == "system"%}
120
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' }}
121
+ {%- elif message.role == "tool" %}
122
+ {%- if loop.previtem and loop.previtem.role != "tool" %}
123
+ {{- '<|im_start|>tool\n' }}
124
+ {%- endif %}
125
+ {{- '<tool_response>\n' }}
126
+ {{- message.content }}
127
+ {{- '\n</tool_response>\n' }}
128
+ {%- if not loop.last and loop.nextitem.role != "tool" %}
129
+ {{- '<|im_end|>' }}
130
+ {%- elif loop.last %}
131
+ {{- '<|im_end|>' }}
132
+ {%- endif %}
133
+ {%- else %}
134
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' }}
135
+ {%- endif %}
136
+ {%- endfor %}
137
+ {%- if add_generation_prompt %}
138
+ {{- '<|im_start|>assistant\n' }}
139
+ {%- if not enable_thinking -%}
140
+ {{- '<think></think>' -}}
141
+ {%- else -%}
142
+ {{- '' -}}
143
+ {%- endif -%}
144
+ {%- endif %}
145
+ {# Copyright 2025-present Unsloth. Apache 2.0 License. #}
config.json ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_full_attention_sink_bias": false,
3
+ "add_swa_attention_sink_bias": true,
4
+ "architectures": [
5
+ "MiMoV2FlashForCausalLM"
6
+ ],
7
+ "attention_bias": false,
8
+ "attention_chunk_size": 128,
9
+ "attention_dropout": 0.0,
10
+ "attention_value_scale": 0.707,
11
+ "auto_map": {
12
+ "AutoConfig": "configuration_mimo_v2_flash.MiMoV2FlashConfig",
13
+ "AutoModel": "modeling_mimo_v2_flash.MiMoV2FlashModel",
14
+ "AutoModelForCausalLM": "modeling_mimo_v2_flash.MiMoV2FlashForCausalLM"
15
+ },
16
+ "torch_dtype": "bfloat16",
17
+ "head_dim": 192,
18
+ "hidden_act": "silu",
19
+ "hidden_size": 4096,
20
+ "hybrid_block_size": null,
21
+ "hybrid_layer_pattern": [
22
+ 0,
23
+ 1,
24
+ 1,
25
+ 1,
26
+ 1,
27
+ 0,
28
+ 1,
29
+ 1,
30
+ 1,
31
+ 1,
32
+ 1,
33
+ 0,
34
+ 1,
35
+ 1,
36
+ 1,
37
+ 1,
38
+ 1,
39
+ 0,
40
+ 1,
41
+ 1,
42
+ 1,
43
+ 1,
44
+ 1,
45
+ 0,
46
+ 1,
47
+ 1,
48
+ 1,
49
+ 1,
50
+ 1,
51
+ 0,
52
+ 1,
53
+ 1,
54
+ 1,
55
+ 1,
56
+ 1,
57
+ 0,
58
+ 1,
59
+ 1,
60
+ 1,
61
+ 1,
62
+ 1,
63
+ 0,
64
+ 1,
65
+ 1,
66
+ 1,
67
+ 1,
68
+ 1,
69
+ 0
70
+ ],
71
+ "initializer_range": 0.02,
72
+ "intermediate_size": 16384,
73
+ "layernorm_epsilon": 1e-05,
74
+ "max_position_embeddings": 262144,
75
+ "moe_intermediate_size": 2048,
76
+ "moe_layer_freq": [
77
+ 0,
78
+ 1,
79
+ 1,
80
+ 1,
81
+ 1,
82
+ 1,
83
+ 1,
84
+ 1,
85
+ 1,
86
+ 1,
87
+ 1,
88
+ 1,
89
+ 1,
90
+ 1,
91
+ 1,
92
+ 1,
93
+ 1,
94
+ 1,
95
+ 1,
96
+ 1,
97
+ 1,
98
+ 1,
99
+ 1,
100
+ 1,
101
+ 1,
102
+ 1,
103
+ 1,
104
+ 1,
105
+ 1,
106
+ 1,
107
+ 1,
108
+ 1,
109
+ 1,
110
+ 1,
111
+ 1,
112
+ 1,
113
+ 1,
114
+ 1,
115
+ 1,
116
+ 1,
117
+ 1,
118
+ 1,
119
+ 1,
120
+ 1,
121
+ 1,
122
+ 1,
123
+ 1,
124
+ 1
125
+ ],
126
+ "n_group": 1,
127
+ "n_routed_experts": 256,
128
+ "n_shared_experts": null,
129
+ "norm_topk_prob": true,
130
+ "num_attention_heads": 64,
131
+ "num_experts_per_tok": 8,
132
+ "num_hidden_layers": 48,
133
+ "num_key_value_heads": 4,
134
+ "pad_token_id": 151654,
135
+ "partial_rotary_factor": 0.334,
136
+ "quantization_config": {
137
+ "activation_scheme": "dynamic",
138
+ "fmt": "e4m3",
139
+ "ignored_layers": [
140
+ "model.layers.0.self_attn.o_proj",
141
+ "model.layers.1.self_attn.o_proj",
142
+ "model.layers.2.self_attn.o_proj",
143
+ "model.layers.3.self_attn.o_proj",
144
+ "model.layers.4.self_attn.o_proj",
145
+ "model.layers.5.self_attn.o_proj",
146
+ "model.layers.6.self_attn.o_proj",
147
+ "model.layers.7.self_attn.o_proj",
148
+ "model.layers.8.self_attn.o_proj",
149
+ "model.layers.9.self_attn.o_proj",
150
+ "model.layers.10.self_attn.o_proj",
151
+ "model.layers.11.self_attn.o_proj",
152
+ "model.layers.12.self_attn.o_proj",
153
+ "model.layers.13.self_attn.o_proj",
154
+ "model.layers.14.self_attn.o_proj",
155
+ "model.layers.15.self_attn.o_proj",
156
+ "model.layers.16.self_attn.o_proj",
157
+ "model.layers.17.self_attn.o_proj",
158
+ "model.layers.18.self_attn.o_proj",
159
+ "model.layers.19.self_attn.o_proj",
160
+ "model.layers.20.self_attn.o_proj",
161
+ "model.layers.21.self_attn.o_proj",
162
+ "model.layers.22.self_attn.o_proj",
163
+ "model.layers.23.self_attn.o_proj",
164
+ "model.layers.24.self_attn.o_proj",
165
+ "model.layers.25.self_attn.o_proj",
166
+ "model.layers.26.self_attn.o_proj",
167
+ "model.layers.27.self_attn.o_proj",
168
+ "model.layers.28.self_attn.o_proj",
169
+ "model.layers.29.self_attn.o_proj",
170
+ "model.layers.30.self_attn.o_proj",
171
+ "model.layers.31.self_attn.o_proj",
172
+ "model.layers.32.self_attn.o_proj",
173
+ "model.layers.33.self_attn.o_proj",
174
+ "model.layers.34.self_attn.o_proj",
175
+ "model.layers.35.self_attn.o_proj",
176
+ "model.layers.36.self_attn.o_proj",
177
+ "model.layers.37.self_attn.o_proj",
178
+ "model.layers.38.self_attn.o_proj",
179
+ "model.layers.39.self_attn.o_proj",
180
+ "model.layers.40.self_attn.o_proj",
181
+ "model.layers.41.self_attn.o_proj",
182
+ "model.layers.42.self_attn.o_proj",
183
+ "model.layers.43.self_attn.o_proj",
184
+ "model.layers.44.self_attn.o_proj",
185
+ "model.layers.45.self_attn.o_proj",
186
+ "model.layers.46.self_attn.o_proj",
187
+ "model.layers.47.self_attn.o_proj",
188
+ "model.decoder.self_attn.o_proj"
189
+ ],
190
+ "packed_modules_mapping": {},
191
+ "quant_method": "fp8",
192
+ "weight_block_size": [
193
+ 128,
194
+ 128
195
+ ]
196
+ },
197
+ "rope_scaling": null,
198
+ "rope_theta": 5000000,
199
+ "routed_scaling_factor": null,
200
+ "scoring_func": "sigmoid",
201
+ "sliding_window": 128,
202
+ "sliding_window_size": 128,
203
+ "swa_head_dim": 192,
204
+ "swa_num_attention_heads": 64,
205
+ "swa_num_key_value_heads": 8,
206
+ "swa_rope_theta": 10000,
207
+ "swa_v_head_dim": 128,
208
+ "tie_word_embeddings": false,
209
+ "topk_group": 1,
210
+ "topk_method": "noaux_tc",
211
+ "transformers_version": "4.57.3",
212
+ "unsloth_fixed": true,
213
+ "use_cache": true,
214
+ "v_head_dim": 128,
215
+ "vocab_size": 152576
216
+ }
configuration_mimo_v2_flash.py ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ #
3
+ # Copyright 2025 Xiaomi Corporation.
4
+ # Copyright 2025 The HuggingFace Inc. team.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ from transformers.configuration_utils import PretrainedConfig
19
+ from transformers.modeling_rope_utils import rope_config_validation
20
+ from transformers.utils import logging
21
+
22
+
23
+ logger = logging.get_logger(__name__)
24
+
25
+
26
+ class MiMoV2FlashConfig(PretrainedConfig):
27
+
28
+ model_type = ""
29
+ keys_to_ignore_at_inference = ["past_key_values"]
30
+
31
+ # Default tensor parallel plan for base model `Hybrid`
32
+ base_model_tp_plan = {
33
+ "layers.*.self_attn.q_proj": "colwise",
34
+ "layers.*.self_attn.k_proj": "colwise",
35
+ "layers.*.self_attn.v_proj": "colwise",
36
+ "layers.*.self_attn.o_proj": "rowwise",
37
+ "layers.*.mlp.gate_proj": "colwise",
38
+ "layers.*.mlp.up_proj": "colwise",
39
+ "layers.*.mlp.down_proj": "rowwise",
40
+ }
41
+ base_model_pp_plan = {
42
+ "embed_tokens": (["input_ids"], ["inputs_embeds"]),
43
+ "layers": (["hidden_states", "attention_mask"], ["hidden_states"]),
44
+ "norm": (["hidden_states"], ["hidden_states"]),
45
+ }
46
+
47
+ attribute_map = {
48
+ "num_local_experts": "n_routed_experts",
49
+ }
50
+
51
+ def __init__(
52
+ self,
53
+ vocab_size=151936,
54
+ hidden_size=4096,
55
+ intermediate_size=22016,
56
+ num_hidden_layers=32,
57
+ num_attention_heads=32,
58
+ num_key_value_heads=32,
59
+ hidden_act="silu",
60
+ max_position_embeddings=32768,
61
+ initializer_range=0.02,
62
+ layernorm_epsilon=1e-6,
63
+ use_cache=True,
64
+ tie_word_embeddings=False,
65
+ rope_theta=10000.0,
66
+ rope_scaling=None,
67
+ attention_dropout=0.0,
68
+ hybrid_block_size=None,
69
+ hybrid_layer_pattern=None,
70
+ partial_rotary_factor=1.0,
71
+ **kwargs,
72
+ ):
73
+ self.vocab_size = vocab_size
74
+ self.max_position_embeddings = max_position_embeddings
75
+ self.hidden_size = hidden_size
76
+ self.intermediate_size = intermediate_size
77
+ self.num_hidden_layers = num_hidden_layers
78
+ self.num_attention_heads = num_attention_heads
79
+
80
+ # for backward compatibility
81
+ if num_key_value_heads is None:
82
+ num_key_value_heads = num_attention_heads
83
+
84
+ self.num_key_value_heads = num_key_value_heads
85
+ self.hidden_act = hidden_act
86
+ self.initializer_range = initializer_range
87
+ self.layernorm_epsilon = layernorm_epsilon
88
+ self.use_cache = use_cache
89
+ self.rope_theta = rope_theta
90
+ self.rope_scaling = rope_scaling
91
+ self.attention_dropout = attention_dropout
92
+
93
+ if hybrid_block_size is not None and hybrid_layer_pattern is None:
94
+ hybrid_layer_pattern = [0 if ((i + 1) % hybrid_block_size == 0) else 1 for i in range(num_hidden_layers)]
95
+ self.hybrid_block_size = hybrid_block_size
96
+ self.hybrid_layer_pattern = hybrid_layer_pattern
97
+
98
+ self.partial_rotary_factor = partial_rotary_factor
99
+
100
+ # Validate the correctness of rotary position embeddings parameters
101
+ # BC: if there is a 'type' field, move it to 'rope_type'.
102
+ if self.rope_scaling is not None and "type" in self.rope_scaling:
103
+ self.rope_scaling["rope_type"] = self.rope_scaling["type"]
104
+ rope_config_validation(self)
105
+
106
+ super().__init__(
107
+ tie_word_embeddings=tie_word_embeddings,
108
+ **kwargs,
109
+ )
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
model_0.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a38e69fd84e5dbeb007a1e999bc186cf2ee5ab4d380a2255662e9dfe62ac3c2c
3
+ size 324091032
model_1.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac9b00d805466265c6cc7208958532d2819c3d6b73e8a551cbe71f1196ef6675
3
+ size 132154312
model_10.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:15a76d7cd96b8f855072b0b9b2eb2ef323f45605eab9942d1962f3b189d9ae38
3
+ size 132154328
model_10_linear_fc1.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b79a6754a6ceffd3b1164847e6371fe94f74cd44b9f8a177976dff8fb25f6ada
3
+ size 4296144144
model_10_linear_fc2.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a103d7e8de4de8af339e4c0bf2f5595e86901e78586acf66278067033bcf8005
3
+ size 2148072376
model_11.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d34f5fc039a11df7686fed6a46f6f43e5241a49dd8e4df1b959ae3b512d889c5
3
+ size 126910184
model_11_linear_fc1.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c73f4786cc52b659e8e8c0693b8f1c70d14f6982618136b9b797c3f0a52bb5a5
3
+ size 4296144144
model_11_linear_fc2.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4dab8f4037d40cd5389e1e10d7f7cd68e3c46e12a84bcb82ea8c5281457d226d
3
+ size 2148072376
model_12.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bb75be363c969bc2487049d654b47418f453f8080a89eb510be9d5bd57c9620b
3
+ size 132154328
model_12_linear_fc1.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37471f00a836b669b73cdb4ae7445cfb4f9ceb9b29af8869eb8f872e2a1aa780
3
+ size 4296144144
model_12_linear_fc2.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c5e4e58c71850df727cf05d9d6ca8897f2f2dd379bfe76d401eea957b95437df
3
+ size 2148072376
model_13.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:744ba55216e1d1f8651770266130e3a1d4d62f06fbc076c6f739c8279c7274ed
3
+ size 132154328
model_13_linear_fc1.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4822f5647729e1d6056f7947c8369f798a437dd214272e89913666646c6a96b2
3
+ size 4296144144
model_13_linear_fc2.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9b2c3678c75f8d2a677db292a0c7dd8f2480c8d0ebe52ef45370f87dd047dc19
3
+ size 2148072376
model_14.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:44c395ec24de044119c8ebe9e361e5e40323feb8e57607386c0369522a343432
3
+ size 132154328
model_14_linear_fc1.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a52d904947cd7c257e3d83ddb70d6afdbb50eb7cf777331f27fd5b34ffe0b1eb
3
+ size 4296144144
model_14_linear_fc2.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f5c2b2dcecae4df308f2f41e2b79813414de2736012e147897baad21a5a57960
3
+ size 2148072376
model_15.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9dcccb45364d69afab25fb0837befdb80a13257a7491bdd3ba6b83b3c5a1555d
3
+ size 132154328
model_15_linear_fc1.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e44d6af2fe49e8c00c207b6e5ef5cd2078413b0dde93571f7c67d65ed8129393
3
+ size 4296144144
model_15_linear_fc2.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0ec6cc6353c6d9b0553b2363845a9c3153a8157edbe1d4c51b8f10c69fc26b7e
3
+ size 2148072376
model_16.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:61e250132d8f4f753d1ee7d5cbffce109bac0e419685757781417d500d0bcc87
3
+ size 132154328
model_16_linear_fc1.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5103440d890826c0bd1ca685e5447633a4a6e95668766b35b5898aa59f30b5a0
3
+ size 4296144144
model_16_linear_fc2.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:554bf20e506b7ccd94e277375e2632868a19d8d7186d4cb565a5118751e3d409
3
+ size 2148072376
model_17.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3cbfd9461946facfe56dfdf14222aa8a4a3d8b19ef4c32b1c814f1b42cbee113
3
+ size 126910184
model_17_linear_fc1.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:db89055cc8a6649d8d36da0541558c272c87cc8fdbe88dc01767d85b4c99d41a
3
+ size 4296144144
model_17_linear_fc2.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2340276698490a892d23223513e58dc476018d6e8681f07665860ec8f1c78e98
3
+ size 2148072376
model_18.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a277cf00ce1bc93147ca00f4f5fe09a72ac9ed27973e9a87960494d6ef90908a
3
+ size 132154328
model_18_linear_fc1.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:66dc68b04fb2c373ec9e01ba385bf454eee731e050b4f9990b78ec3292a8b366
3
+ size 4296144144
model_18_linear_fc2.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cbaeb46c35c2a22594c14b11264a2a91c93d1be3f8247336321a558309150d03
3
+ size 2148072376
model_19.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9b6dc3861aa3176eda4cae4b82cb4a347bfb2bbddad7245202f6eff5ee89e7c9
3
+ size 132154328
model_19_linear_fc1.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:edccbc22110f574a7c7510f11d092877b73292dd1394e91aab2d7c77bf8eec81
3
+ size 4296144144
model_19_linear_fc2.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f94702133c7733209ee97d077053e368ba6e218bab7ae243538ecff6b37ee2a5
3
+ size 2148072376
model_1_linear_fc1.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:de58f252388fc33c62a3cc709d98996d0d56c9046068f22aa6e9d7861294e579
3
+ size 4296143120
model_1_linear_fc2.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0614837e791547d06388dc9395913f93fb6d188dbc11800b6bbf62ca0fb4ba09
3
+ size 2148071864
model_2.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:63ea731b8fe60181264e89e23b6f7ae43616353b2ceb843a9194806b424c7fcf
3
+ size 132154312
model_20.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dd223a5ce5bcc4cc542314eb435cc6dc4b366a7c5411e471ffaad21f6ac7b5b7
3
+ size 132154328
model_20_linear_fc1.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e98dab38464b91238ebbc7dcb720a879f466b1d9eaadb817b31b123df0e8ef46
3
+ size 4296144144
model_20_linear_fc2.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:02f8a73128df2222145285bfcb4c77544ddabcb94dbe403d8dcfa5c817329b5f
3
+ size 2148072376
model_21.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6920b442fa917d285ef417cb5ae4d09d8b716412e04c31e128bd717957b62bda
3
+ size 132154328
model_21_linear_fc1.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb5c8084d033a24f337305341e1de627e3dfd164225d04c7b3de6fb668e2bc6a
3
+ size 4296144144
model_21_linear_fc2.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d3cb86f8ebd086fdc2c055a68f70c7b9855e0eb9abce5f6fd8b5df87ccc2dc3a
3
+ size 2148072376
model_22.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:97cc9a1d9da89630968e326e20c28da8fa8a662830b26479df5b893328fc89d2
3
+ size 132154328