shieldstackllc commited on
Commit
af9bfb1
·
verified ·
1 Parent(s): 290cea7

Add MiniMax-M2.5 REAP-19 MLX 8-bit quantization

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 +70 -0
  3. chat_template.jinja +159 -0
  4. config.json +615 -0
  5. configuration_minimax_m2.py +200 -0
  6. generation_config.json +8 -0
  7. model-00001-of-00047.safetensors +3 -0
  8. model-00002-of-00047.safetensors +3 -0
  9. model-00003-of-00047.safetensors +3 -0
  10. model-00004-of-00047.safetensors +3 -0
  11. model-00005-of-00047.safetensors +3 -0
  12. model-00006-of-00047.safetensors +3 -0
  13. model-00007-of-00047.safetensors +3 -0
  14. model-00008-of-00047.safetensors +3 -0
  15. model-00009-of-00047.safetensors +3 -0
  16. model-00010-of-00047.safetensors +3 -0
  17. model-00011-of-00047.safetensors +3 -0
  18. model-00012-of-00047.safetensors +3 -0
  19. model-00013-of-00047.safetensors +3 -0
  20. model-00014-of-00047.safetensors +3 -0
  21. model-00015-of-00047.safetensors +3 -0
  22. model-00016-of-00047.safetensors +3 -0
  23. model-00017-of-00047.safetensors +3 -0
  24. model-00018-of-00047.safetensors +3 -0
  25. model-00019-of-00047.safetensors +3 -0
  26. model-00020-of-00047.safetensors +3 -0
  27. model-00021-of-00047.safetensors +3 -0
  28. model-00022-of-00047.safetensors +3 -0
  29. model-00023-of-00047.safetensors +3 -0
  30. model-00024-of-00047.safetensors +3 -0
  31. model-00025-of-00047.safetensors +3 -0
  32. model-00026-of-00047.safetensors +3 -0
  33. model-00027-of-00047.safetensors +3 -0
  34. model-00028-of-00047.safetensors +3 -0
  35. model-00029-of-00047.safetensors +3 -0
  36. model-00030-of-00047.safetensors +3 -0
  37. model-00031-of-00047.safetensors +3 -0
  38. model-00032-of-00047.safetensors +3 -0
  39. model-00033-of-00047.safetensors +3 -0
  40. model-00034-of-00047.safetensors +3 -0
  41. model-00035-of-00047.safetensors +3 -0
  42. model-00036-of-00047.safetensors +3 -0
  43. model-00037-of-00047.safetensors +3 -0
  44. model-00038-of-00047.safetensors +3 -0
  45. model-00039-of-00047.safetensors +3 -0
  46. model-00040-of-00047.safetensors +3 -0
  47. model-00041-of-00047.safetensors +3 -0
  48. model-00042-of-00047.safetensors +3 -0
  49. model-00043-of-00047.safetensors +3 -0
  50. model-00044-of-00047.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,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: mit
5
+ pipeline_tag: text-generation
6
+ tags:
7
+ - mlx
8
+ - mixture-of-experts
9
+ - moe
10
+ - pruning
11
+ - reap
12
+ - minimax
13
+ - 8bit
14
+ - quantized
15
+ - apple-silicon
16
+ library_name: mlx
17
+ base_model: Akicou/MiniMax-M2-5-REAP-19
18
+ ---
19
+
20
+ <p align="center">
21
+ <a href="https://vmlx.net">
22
+ <img src="vmlx-logo.png" alt="vMLX" width="120">
23
+ </a>
24
+ </p>
25
+
26
+ # MiniMax-M2.5 REAP-19 — MLX 8-bit
27
+
28
+ MLX 8-bit quantized version of [Akicou/MiniMax-M2-5-REAP-19](https://huggingface.co/Akicou/MiniMax-M2-5-REAP-19) for efficient local inference on Apple Silicon.
29
+
30
+ - **Quantization**: 8-bit (9.0 bits per weight, group size 64, affine mode)
31
+ - **Architecture**: MiniMax M2.5 MoE — 62 layers, 205 experts (REAP-pruned from 256), 8 active per token
32
+ - **Context**: 196K tokens
33
+ - **Size**: ~193 GB
34
+ - **Pruning**: 19% of experts removed via [REAP](https://github.com/CerebrasResearch/reap) (Router Expert Activation Pruning)
35
+
36
+ ## Usage
37
+
38
+ ```python
39
+ from mlx_lm import load, generate
40
+
41
+ model, tokenizer = load("shieldstackllc/MiniMax-M2-5-REAP-19-mlx-8bit")
42
+ response = generate(model, tokenizer, prompt="Hello!", verbose=True)
43
+ ```
44
+
45
+ Or with [vMLX](https://vmlx.net) for native macOS inference.
46
+
47
+ ## About
48
+
49
+ MiniMax-M2.5 is a large Mixture-of-Experts language model by MiniMax AI. This variant was pruned to 19% fewer experts by [Akicou](https://huggingface.co/Akicou) using REAP (Router Expert Activation Pruning), reducing model size and memory footprint while maintaining strong performance. MLX quantization by [vMLX](https://vmlx.net).
50
+
51
+ ## Also Available
52
+
53
+ - [MiniMax-M2.5-REAP-19 MLX 4-bit](https://huggingface.co/shieldstackllc/MiniMax-M2-5-REAP-19-mlx-4bit) (~97 GB) *(coming soon)*
54
+ - [MiniMax-M2.5-REAP-39 MLX 8-bit](https://huggingface.co/shieldstackllc/MiniMax-M2-5-REAP-39-mlx-8bit) (~138 GB)
55
+ - [MiniMax-M2.5-REAP-39 MLX 4-bit](https://huggingface.co/shieldstackllc/MiniMax-M2-5-REAP-39-mlx-4bit) (~73 GB)
56
+ - [MiniMax-M2.5-REAP-29 MLX 4-bit](https://huggingface.co/shieldstackllc/MiniMax-M2-5-REAP-29-mlx-4bit)
57
+
58
+ ## Made for vMLX
59
+
60
+ This model was converted and optimized for [vMLX](https://vmlx.net) — a free, open source macOS native MLX inference engine for Apple Silicon. Download vMLX to run this model locally with zero configuration.
61
+
62
+ ## Credits
63
+
64
+ - **Base model**: [MiniMaxAI/MiniMax-M2.5](https://huggingface.co/MiniMaxAI/MiniMax-M2.5) by MiniMax AI
65
+ - **REAP pruning**: [Akicou/MiniMax-M2-5-REAP-19](https://huggingface.co/Akicou/MiniMax-M2-5-REAP-19) by Akicou
66
+ - **MLX conversion**: [vMLX](https://vmlx.net) — Run AI locally on Mac. No compromises.
67
+
68
+ ## Contact
69
+
70
+ For questions, issues, or collaboration: **admin@vmlx.net**
chat_template.jinja ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {# ----------‑‑‑ special token variables ‑‑‑---------- #}
2
+ {%- set toolcall_begin_token = '<minimax:tool_call>' -%}
3
+ {%- set toolcall_end_token = '</minimax:tool_call>' -%}
4
+ {#- Tool Rendering Functions ============================================== -#}
5
+ {%- macro render_tool_namespace(namespace_name, tool_list) -%}
6
+ {%- for tool in tool_list -%}
7
+ <tool>{{ tool.function | tojson(ensure_ascii=False) }}</tool>
8
+ {% endfor -%}
9
+ {%- endmacro -%}
10
+ {%- macro visible_text(content) -%}
11
+ {%- if content is string -%}
12
+ {{ content }}
13
+ {%- elif content is iterable and content is not mapping -%}
14
+ {%- for item in content -%}
15
+ {%- if item is mapping and item.type == 'text' -%}
16
+ {{- item.text }}
17
+ {%- elif item is string -%}
18
+ {{- item }}
19
+ {%- endif -%}
20
+ {%- endfor -%}
21
+ {%- else -%}
22
+ {{- content }}
23
+ {%- endif -%}
24
+ {%- endmacro -%}
25
+ {#- System Message Construction ============================================ -#}
26
+ {%- macro build_system_message(system_message) -%}
27
+ {%- if system_message and system_message.content -%}
28
+ {{- visible_text(system_message.content) }}
29
+ {%- else -%}
30
+ {%- if model_identity is not defined -%}
31
+ {%- set model_identity = "You are a helpful assistant. Your name is MiniMax-M2.5 and is built by MiniMax." -%}
32
+ {%- endif -%}
33
+ {{- model_identity }}
34
+ {%- endif -%}
35
+
36
+ {#- Handle current_date -#}
37
+ {%- if system_message and system_message.current_date -%}
38
+ {{- '\n' ~ 'Current date: ' + system_message.current_date }}
39
+ {%- endif -%}
40
+ {#- Handle current_location -#}
41
+ {%- if system_message and system_message.current_location -%}
42
+ {{- '\n' ~ 'Current location: ' + system_message.current_location }}
43
+ {%- endif -%}
44
+ {%- endmacro -%}
45
+ {#- Main Template Logic ================================================= -#}
46
+ {#- Extract system message (only first message if it's system) -#}
47
+ {%- set system_message = none -%}
48
+ {%- set conversation_messages = messages -%}
49
+ {%- if messages and messages[0].role == "system" -%}
50
+ {%- set system_message = messages[0] -%}
51
+ {%- set conversation_messages = messages[1:] -%}
52
+ {%- endif -%}
53
+ {#- Get the last user message turn, for interleved thinking -#}
54
+ {%- set ns = namespace(last_user_index=-1) %}
55
+ {% for m in conversation_messages %}
56
+ {%- if m.role == 'user' %}
57
+ {% set ns.last_user_index = loop.index0 -%}
58
+ {%- endif %}
59
+ {%- endfor %}
60
+ {#- Render system message -#}
61
+ {{- ']~!b[' ~ ']~b]system' ~ '\n' }}
62
+ {{- build_system_message(system_message) }}
63
+ {#- Render tools if available -#}
64
+ {%- if tools -%}
65
+ {{- '\n\n' ~ '# Tools' ~ '\n' ~ 'You may call one or more tools to assist with the user query.\nHere are the tools available in JSONSchema format:' ~ '\n' }}
66
+ {{- '\n' ~ '<tools>' ~ '\n' }}
67
+ {{- render_tool_namespace("functions", tools) }}
68
+ {{- '</tools>' ~ '\n\n' }}
69
+ {{- 'When making tool calls, use XML format to invoke tools and pass parameters:' ~ '\n' }}
70
+ {{- '\n' ~ toolcall_begin_token }}
71
+ <invoke name="tool-name-1">
72
+ <parameter name="param-key-1">param-value-1</parameter>
73
+ <parameter name="param-key-2">param-value-2</parameter>
74
+ ...
75
+ </invoke>
76
+ {{- '\n' ~ toolcall_end_token }}
77
+ {%- endif -%}
78
+ {{- '[e~[\n' }}
79
+
80
+ {#- Render messages -#}
81
+ {%- set last_tool_call = namespace(name=none) -%}
82
+ {%- for message in conversation_messages -%}
83
+ {%- if message.role == 'assistant' -%}
84
+ {#- Only render reasoning_content if no user message follows -#}
85
+ {{- ']~b]ai' ~ '\n' }}
86
+
87
+ {%- set reasoning_content = '' %}
88
+ {%- set content = visible_text(message.content) %}
89
+ {%- if message.reasoning_content is string %}
90
+ {%- set reasoning_content = message.reasoning_content %}
91
+ {%- else %}
92
+ {%- if '</think>' in content %}
93
+ {%- set reasoning_content = content.split('</think>')[0].strip('\n').split('<think>')[-1].strip('\n') %}
94
+ {%- set content = content.split('</think>')[-1].strip('\n') %}
95
+ {%- endif %}
96
+ {%- endif %}
97
+ {%- if reasoning_content and loop.index0 > ns.last_user_index -%}
98
+ {{- '<think>' ~ '\n' ~ reasoning_content ~ '\n' ~ '</think>' ~ '\n\n' }}
99
+ {%- endif -%}
100
+ {%- if content -%}
101
+ {{- content }}
102
+ {%- endif -%}
103
+ {%- if message.tool_calls -%}
104
+ {{- '\n' ~ toolcall_begin_token ~ '\n' }}
105
+
106
+ {%- for tool_call in message.tool_calls -%}
107
+ {%- if tool_call.function %}
108
+ {%- set tool_call = tool_call.function %}
109
+ {%- endif %}
110
+ {{- '<invoke name="' + tool_call.name + '">' }}
111
+ {% set _args = tool_call.arguments %}
112
+ {%- for k, v in _args.items() %}
113
+ {{- '<parameter name="' + k + '">' }}
114
+ {{- v | tojson(ensure_ascii=False) if v is not string else v }}
115
+ {{- '</parameter>' }}
116
+ {% endfor %}
117
+ {{- '</invoke>' ~ '\n' }}
118
+ {%- endfor -%}
119
+
120
+ {{- toolcall_end_token}}
121
+ {%- set last_tool_call.name = message.tool_calls[-1].name -%}
122
+ {%- else -%}
123
+ {%- set last_tool_call.name = none -%}
124
+ {%- endif -%}
125
+ {{- '[e~[' ~ '\n' }}
126
+
127
+ {%- elif message.role == 'tool' -%}
128
+ {%- if last_tool_call.name is none -%}
129
+ {{- raise_exception("Message has tool role, but there was no previous assistant message with a tool call!") }}
130
+ {%- endif -%}
131
+ {%- if loop.first or (conversation_messages[loop.index0 - 1].role != 'tool') -%}
132
+ {{- ']~b]tool' }}
133
+ {%- endif -%}
134
+ {%- if message.content is string -%}
135
+ {{- '\n<response>' }}
136
+ {{- message.content }}
137
+ {{- '</response>' }}
138
+ {%- else -%}
139
+ {%- for tr in message.content -%}
140
+ {{- '\n<response>' }}
141
+ {{- tr.output if tr.output is defined else (tr.text if tr.type == 'text' and tr.text is defined else tr) }}
142
+ {{- '\n</response>' }}
143
+ {%- endfor -%}
144
+ {%- endif -%}
145
+ {%- if loop.last or (conversation_messages[loop.index0 + 1].role != 'tool') -%}
146
+ {{- '[e~[\n' -}}
147
+ {%- endif -%}
148
+
149
+ {%- elif message.role == 'user' -%}
150
+ {{- ']~b]user' ~ '\n' }}
151
+ {{- visible_text(message.content) }}
152
+ {{- '[e~[' ~ '\n' }}
153
+ {%- endif -%}
154
+ {%- endfor -%}
155
+
156
+ {#- Generation prompt -#}
157
+ {%- if add_generation_prompt -%}
158
+ {{- ']~b]ai' ~ '\n' ~ '<think>' ~ '\n' }}
159
+ {%- endif -%}
config.json ADDED
@@ -0,0 +1,615 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MiniMaxM2ForCausalLM"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "attn_type_list": [
7
+ 1,
8
+ 1,
9
+ 1,
10
+ 1,
11
+ 1,
12
+ 1,
13
+ 1,
14
+ 1,
15
+ 1,
16
+ 1,
17
+ 1,
18
+ 1,
19
+ 1,
20
+ 1,
21
+ 1,
22
+ 1,
23
+ 1,
24
+ 1,
25
+ 1,
26
+ 1,
27
+ 1,
28
+ 1,
29
+ 1,
30
+ 1,
31
+ 1,
32
+ 1,
33
+ 1,
34
+ 1,
35
+ 1,
36
+ 1,
37
+ 1,
38
+ 1,
39
+ 1,
40
+ 1,
41
+ 1,
42
+ 1,
43
+ 1,
44
+ 1,
45
+ 1,
46
+ 1,
47
+ 1,
48
+ 1,
49
+ 1,
50
+ 1,
51
+ 1,
52
+ 1,
53
+ 1,
54
+ 1,
55
+ 1,
56
+ 1,
57
+ 1,
58
+ 1,
59
+ 1,
60
+ 1,
61
+ 1,
62
+ 1,
63
+ 1,
64
+ 1,
65
+ 1,
66
+ 1,
67
+ 1,
68
+ 1
69
+ ],
70
+ "auto_map": {
71
+ "AutoConfig": "configuration_minimax_m2.MiniMaxM2Config",
72
+ "AutoModelForCausalLM": "modeling_minimax_m2.MiniMaxM2ForCausalLM"
73
+ },
74
+ "bos_token_id": 1,
75
+ "eos_token_id": 200020,
76
+ "head_dim": 128,
77
+ "hidden_act": "silu",
78
+ "hidden_size": 3072,
79
+ "initializer_range": 0.02,
80
+ "intermediate_size": 1536,
81
+ "max_position_embeddings": 196608,
82
+ "model_type": "minimax_m2",
83
+ "mtp_transformer_layers": 1,
84
+ "num_attention_heads": 48,
85
+ "num_experts_per_tok": 8,
86
+ "num_hidden_layers": 62,
87
+ "num_key_value_heads": 8,
88
+ "num_local_experts": 205,
89
+ "num_mtp_modules": 3,
90
+ "output_router_logits": false,
91
+ "partial_rotary_factor": 0.5,
92
+ "qk_norm_type": "per_layer",
93
+ "quantization": {
94
+ "group_size": 64,
95
+ "bits": 8,
96
+ "mode": "affine",
97
+ "model.layers.0.block_sparse_moe.gate": {
98
+ "group_size": 64,
99
+ "bits": 8
100
+ },
101
+ "model.layers.1.block_sparse_moe.gate": {
102
+ "group_size": 64,
103
+ "bits": 8
104
+ },
105
+ "model.layers.2.block_sparse_moe.gate": {
106
+ "group_size": 64,
107
+ "bits": 8
108
+ },
109
+ "model.layers.3.block_sparse_moe.gate": {
110
+ "group_size": 64,
111
+ "bits": 8
112
+ },
113
+ "model.layers.4.block_sparse_moe.gate": {
114
+ "group_size": 64,
115
+ "bits": 8
116
+ },
117
+ "model.layers.5.block_sparse_moe.gate": {
118
+ "group_size": 64,
119
+ "bits": 8
120
+ },
121
+ "model.layers.6.block_sparse_moe.gate": {
122
+ "group_size": 64,
123
+ "bits": 8
124
+ },
125
+ "model.layers.7.block_sparse_moe.gate": {
126
+ "group_size": 64,
127
+ "bits": 8
128
+ },
129
+ "model.layers.8.block_sparse_moe.gate": {
130
+ "group_size": 64,
131
+ "bits": 8
132
+ },
133
+ "model.layers.9.block_sparse_moe.gate": {
134
+ "group_size": 64,
135
+ "bits": 8
136
+ },
137
+ "model.layers.10.block_sparse_moe.gate": {
138
+ "group_size": 64,
139
+ "bits": 8
140
+ },
141
+ "model.layers.11.block_sparse_moe.gate": {
142
+ "group_size": 64,
143
+ "bits": 8
144
+ },
145
+ "model.layers.12.block_sparse_moe.gate": {
146
+ "group_size": 64,
147
+ "bits": 8
148
+ },
149
+ "model.layers.13.block_sparse_moe.gate": {
150
+ "group_size": 64,
151
+ "bits": 8
152
+ },
153
+ "model.layers.14.block_sparse_moe.gate": {
154
+ "group_size": 64,
155
+ "bits": 8
156
+ },
157
+ "model.layers.15.block_sparse_moe.gate": {
158
+ "group_size": 64,
159
+ "bits": 8
160
+ },
161
+ "model.layers.16.block_sparse_moe.gate": {
162
+ "group_size": 64,
163
+ "bits": 8
164
+ },
165
+ "model.layers.17.block_sparse_moe.gate": {
166
+ "group_size": 64,
167
+ "bits": 8
168
+ },
169
+ "model.layers.18.block_sparse_moe.gate": {
170
+ "group_size": 64,
171
+ "bits": 8
172
+ },
173
+ "model.layers.19.block_sparse_moe.gate": {
174
+ "group_size": 64,
175
+ "bits": 8
176
+ },
177
+ "model.layers.20.block_sparse_moe.gate": {
178
+ "group_size": 64,
179
+ "bits": 8
180
+ },
181
+ "model.layers.21.block_sparse_moe.gate": {
182
+ "group_size": 64,
183
+ "bits": 8
184
+ },
185
+ "model.layers.22.block_sparse_moe.gate": {
186
+ "group_size": 64,
187
+ "bits": 8
188
+ },
189
+ "model.layers.23.block_sparse_moe.gate": {
190
+ "group_size": 64,
191
+ "bits": 8
192
+ },
193
+ "model.layers.24.block_sparse_moe.gate": {
194
+ "group_size": 64,
195
+ "bits": 8
196
+ },
197
+ "model.layers.25.block_sparse_moe.gate": {
198
+ "group_size": 64,
199
+ "bits": 8
200
+ },
201
+ "model.layers.26.block_sparse_moe.gate": {
202
+ "group_size": 64,
203
+ "bits": 8
204
+ },
205
+ "model.layers.27.block_sparse_moe.gate": {
206
+ "group_size": 64,
207
+ "bits": 8
208
+ },
209
+ "model.layers.28.block_sparse_moe.gate": {
210
+ "group_size": 64,
211
+ "bits": 8
212
+ },
213
+ "model.layers.29.block_sparse_moe.gate": {
214
+ "group_size": 64,
215
+ "bits": 8
216
+ },
217
+ "model.layers.30.block_sparse_moe.gate": {
218
+ "group_size": 64,
219
+ "bits": 8
220
+ },
221
+ "model.layers.31.block_sparse_moe.gate": {
222
+ "group_size": 64,
223
+ "bits": 8
224
+ },
225
+ "model.layers.32.block_sparse_moe.gate": {
226
+ "group_size": 64,
227
+ "bits": 8
228
+ },
229
+ "model.layers.33.block_sparse_moe.gate": {
230
+ "group_size": 64,
231
+ "bits": 8
232
+ },
233
+ "model.layers.34.block_sparse_moe.gate": {
234
+ "group_size": 64,
235
+ "bits": 8
236
+ },
237
+ "model.layers.35.block_sparse_moe.gate": {
238
+ "group_size": 64,
239
+ "bits": 8
240
+ },
241
+ "model.layers.36.block_sparse_moe.gate": {
242
+ "group_size": 64,
243
+ "bits": 8
244
+ },
245
+ "model.layers.37.block_sparse_moe.gate": {
246
+ "group_size": 64,
247
+ "bits": 8
248
+ },
249
+ "model.layers.38.block_sparse_moe.gate": {
250
+ "group_size": 64,
251
+ "bits": 8
252
+ },
253
+ "model.layers.39.block_sparse_moe.gate": {
254
+ "group_size": 64,
255
+ "bits": 8
256
+ },
257
+ "model.layers.40.block_sparse_moe.gate": {
258
+ "group_size": 64,
259
+ "bits": 8
260
+ },
261
+ "model.layers.41.block_sparse_moe.gate": {
262
+ "group_size": 64,
263
+ "bits": 8
264
+ },
265
+ "model.layers.42.block_sparse_moe.gate": {
266
+ "group_size": 64,
267
+ "bits": 8
268
+ },
269
+ "model.layers.43.block_sparse_moe.gate": {
270
+ "group_size": 64,
271
+ "bits": 8
272
+ },
273
+ "model.layers.44.block_sparse_moe.gate": {
274
+ "group_size": 64,
275
+ "bits": 8
276
+ },
277
+ "model.layers.45.block_sparse_moe.gate": {
278
+ "group_size": 64,
279
+ "bits": 8
280
+ },
281
+ "model.layers.46.block_sparse_moe.gate": {
282
+ "group_size": 64,
283
+ "bits": 8
284
+ },
285
+ "model.layers.47.block_sparse_moe.gate": {
286
+ "group_size": 64,
287
+ "bits": 8
288
+ },
289
+ "model.layers.48.block_sparse_moe.gate": {
290
+ "group_size": 64,
291
+ "bits": 8
292
+ },
293
+ "model.layers.49.block_sparse_moe.gate": {
294
+ "group_size": 64,
295
+ "bits": 8
296
+ },
297
+ "model.layers.50.block_sparse_moe.gate": {
298
+ "group_size": 64,
299
+ "bits": 8
300
+ },
301
+ "model.layers.51.block_sparse_moe.gate": {
302
+ "group_size": 64,
303
+ "bits": 8
304
+ },
305
+ "model.layers.52.block_sparse_moe.gate": {
306
+ "group_size": 64,
307
+ "bits": 8
308
+ },
309
+ "model.layers.53.block_sparse_moe.gate": {
310
+ "group_size": 64,
311
+ "bits": 8
312
+ },
313
+ "model.layers.54.block_sparse_moe.gate": {
314
+ "group_size": 64,
315
+ "bits": 8
316
+ },
317
+ "model.layers.55.block_sparse_moe.gate": {
318
+ "group_size": 64,
319
+ "bits": 8
320
+ },
321
+ "model.layers.56.block_sparse_moe.gate": {
322
+ "group_size": 64,
323
+ "bits": 8
324
+ },
325
+ "model.layers.57.block_sparse_moe.gate": {
326
+ "group_size": 64,
327
+ "bits": 8
328
+ },
329
+ "model.layers.58.block_sparse_moe.gate": {
330
+ "group_size": 64,
331
+ "bits": 8
332
+ },
333
+ "model.layers.59.block_sparse_moe.gate": {
334
+ "group_size": 64,
335
+ "bits": 8
336
+ },
337
+ "model.layers.60.block_sparse_moe.gate": {
338
+ "group_size": 64,
339
+ "bits": 8
340
+ },
341
+ "model.layers.61.block_sparse_moe.gate": {
342
+ "group_size": 64,
343
+ "bits": 8
344
+ }
345
+ },
346
+ "quantization_config": {
347
+ "group_size": 64,
348
+ "bits": 8,
349
+ "mode": "affine",
350
+ "model.layers.0.block_sparse_moe.gate": {
351
+ "group_size": 64,
352
+ "bits": 8
353
+ },
354
+ "model.layers.1.block_sparse_moe.gate": {
355
+ "group_size": 64,
356
+ "bits": 8
357
+ },
358
+ "model.layers.2.block_sparse_moe.gate": {
359
+ "group_size": 64,
360
+ "bits": 8
361
+ },
362
+ "model.layers.3.block_sparse_moe.gate": {
363
+ "group_size": 64,
364
+ "bits": 8
365
+ },
366
+ "model.layers.4.block_sparse_moe.gate": {
367
+ "group_size": 64,
368
+ "bits": 8
369
+ },
370
+ "model.layers.5.block_sparse_moe.gate": {
371
+ "group_size": 64,
372
+ "bits": 8
373
+ },
374
+ "model.layers.6.block_sparse_moe.gate": {
375
+ "group_size": 64,
376
+ "bits": 8
377
+ },
378
+ "model.layers.7.block_sparse_moe.gate": {
379
+ "group_size": 64,
380
+ "bits": 8
381
+ },
382
+ "model.layers.8.block_sparse_moe.gate": {
383
+ "group_size": 64,
384
+ "bits": 8
385
+ },
386
+ "model.layers.9.block_sparse_moe.gate": {
387
+ "group_size": 64,
388
+ "bits": 8
389
+ },
390
+ "model.layers.10.block_sparse_moe.gate": {
391
+ "group_size": 64,
392
+ "bits": 8
393
+ },
394
+ "model.layers.11.block_sparse_moe.gate": {
395
+ "group_size": 64,
396
+ "bits": 8
397
+ },
398
+ "model.layers.12.block_sparse_moe.gate": {
399
+ "group_size": 64,
400
+ "bits": 8
401
+ },
402
+ "model.layers.13.block_sparse_moe.gate": {
403
+ "group_size": 64,
404
+ "bits": 8
405
+ },
406
+ "model.layers.14.block_sparse_moe.gate": {
407
+ "group_size": 64,
408
+ "bits": 8
409
+ },
410
+ "model.layers.15.block_sparse_moe.gate": {
411
+ "group_size": 64,
412
+ "bits": 8
413
+ },
414
+ "model.layers.16.block_sparse_moe.gate": {
415
+ "group_size": 64,
416
+ "bits": 8
417
+ },
418
+ "model.layers.17.block_sparse_moe.gate": {
419
+ "group_size": 64,
420
+ "bits": 8
421
+ },
422
+ "model.layers.18.block_sparse_moe.gate": {
423
+ "group_size": 64,
424
+ "bits": 8
425
+ },
426
+ "model.layers.19.block_sparse_moe.gate": {
427
+ "group_size": 64,
428
+ "bits": 8
429
+ },
430
+ "model.layers.20.block_sparse_moe.gate": {
431
+ "group_size": 64,
432
+ "bits": 8
433
+ },
434
+ "model.layers.21.block_sparse_moe.gate": {
435
+ "group_size": 64,
436
+ "bits": 8
437
+ },
438
+ "model.layers.22.block_sparse_moe.gate": {
439
+ "group_size": 64,
440
+ "bits": 8
441
+ },
442
+ "model.layers.23.block_sparse_moe.gate": {
443
+ "group_size": 64,
444
+ "bits": 8
445
+ },
446
+ "model.layers.24.block_sparse_moe.gate": {
447
+ "group_size": 64,
448
+ "bits": 8
449
+ },
450
+ "model.layers.25.block_sparse_moe.gate": {
451
+ "group_size": 64,
452
+ "bits": 8
453
+ },
454
+ "model.layers.26.block_sparse_moe.gate": {
455
+ "group_size": 64,
456
+ "bits": 8
457
+ },
458
+ "model.layers.27.block_sparse_moe.gate": {
459
+ "group_size": 64,
460
+ "bits": 8
461
+ },
462
+ "model.layers.28.block_sparse_moe.gate": {
463
+ "group_size": 64,
464
+ "bits": 8
465
+ },
466
+ "model.layers.29.block_sparse_moe.gate": {
467
+ "group_size": 64,
468
+ "bits": 8
469
+ },
470
+ "model.layers.30.block_sparse_moe.gate": {
471
+ "group_size": 64,
472
+ "bits": 8
473
+ },
474
+ "model.layers.31.block_sparse_moe.gate": {
475
+ "group_size": 64,
476
+ "bits": 8
477
+ },
478
+ "model.layers.32.block_sparse_moe.gate": {
479
+ "group_size": 64,
480
+ "bits": 8
481
+ },
482
+ "model.layers.33.block_sparse_moe.gate": {
483
+ "group_size": 64,
484
+ "bits": 8
485
+ },
486
+ "model.layers.34.block_sparse_moe.gate": {
487
+ "group_size": 64,
488
+ "bits": 8
489
+ },
490
+ "model.layers.35.block_sparse_moe.gate": {
491
+ "group_size": 64,
492
+ "bits": 8
493
+ },
494
+ "model.layers.36.block_sparse_moe.gate": {
495
+ "group_size": 64,
496
+ "bits": 8
497
+ },
498
+ "model.layers.37.block_sparse_moe.gate": {
499
+ "group_size": 64,
500
+ "bits": 8
501
+ },
502
+ "model.layers.38.block_sparse_moe.gate": {
503
+ "group_size": 64,
504
+ "bits": 8
505
+ },
506
+ "model.layers.39.block_sparse_moe.gate": {
507
+ "group_size": 64,
508
+ "bits": 8
509
+ },
510
+ "model.layers.40.block_sparse_moe.gate": {
511
+ "group_size": 64,
512
+ "bits": 8
513
+ },
514
+ "model.layers.41.block_sparse_moe.gate": {
515
+ "group_size": 64,
516
+ "bits": 8
517
+ },
518
+ "model.layers.42.block_sparse_moe.gate": {
519
+ "group_size": 64,
520
+ "bits": 8
521
+ },
522
+ "model.layers.43.block_sparse_moe.gate": {
523
+ "group_size": 64,
524
+ "bits": 8
525
+ },
526
+ "model.layers.44.block_sparse_moe.gate": {
527
+ "group_size": 64,
528
+ "bits": 8
529
+ },
530
+ "model.layers.45.block_sparse_moe.gate": {
531
+ "group_size": 64,
532
+ "bits": 8
533
+ },
534
+ "model.layers.46.block_sparse_moe.gate": {
535
+ "group_size": 64,
536
+ "bits": 8
537
+ },
538
+ "model.layers.47.block_sparse_moe.gate": {
539
+ "group_size": 64,
540
+ "bits": 8
541
+ },
542
+ "model.layers.48.block_sparse_moe.gate": {
543
+ "group_size": 64,
544
+ "bits": 8
545
+ },
546
+ "model.layers.49.block_sparse_moe.gate": {
547
+ "group_size": 64,
548
+ "bits": 8
549
+ },
550
+ "model.layers.50.block_sparse_moe.gate": {
551
+ "group_size": 64,
552
+ "bits": 8
553
+ },
554
+ "model.layers.51.block_sparse_moe.gate": {
555
+ "group_size": 64,
556
+ "bits": 8
557
+ },
558
+ "model.layers.52.block_sparse_moe.gate": {
559
+ "group_size": 64,
560
+ "bits": 8
561
+ },
562
+ "model.layers.53.block_sparse_moe.gate": {
563
+ "group_size": 64,
564
+ "bits": 8
565
+ },
566
+ "model.layers.54.block_sparse_moe.gate": {
567
+ "group_size": 64,
568
+ "bits": 8
569
+ },
570
+ "model.layers.55.block_sparse_moe.gate": {
571
+ "group_size": 64,
572
+ "bits": 8
573
+ },
574
+ "model.layers.56.block_sparse_moe.gate": {
575
+ "group_size": 64,
576
+ "bits": 8
577
+ },
578
+ "model.layers.57.block_sparse_moe.gate": {
579
+ "group_size": 64,
580
+ "bits": 8
581
+ },
582
+ "model.layers.58.block_sparse_moe.gate": {
583
+ "group_size": 64,
584
+ "bits": 8
585
+ },
586
+ "model.layers.59.block_sparse_moe.gate": {
587
+ "group_size": 64,
588
+ "bits": 8
589
+ },
590
+ "model.layers.60.block_sparse_moe.gate": {
591
+ "group_size": 64,
592
+ "bits": 8
593
+ },
594
+ "model.layers.61.block_sparse_moe.gate": {
595
+ "group_size": 64,
596
+ "bits": 8
597
+ }
598
+ },
599
+ "rms_norm_eps": 1e-06,
600
+ "rope_theta": 5000000,
601
+ "rotary_dim": 64,
602
+ "router_aux_loss_coef": 0.001,
603
+ "router_jitter_noise": 0.0,
604
+ "scoring_func": "sigmoid",
605
+ "shared_intermediate_size": 0,
606
+ "sliding_window": null,
607
+ "tie_word_embeddings": false,
608
+ "torch_dtype": "float32",
609
+ "transformers_version": "4.55.0",
610
+ "use_cache": false,
611
+ "use_mtp": true,
612
+ "use_qk_norm": true,
613
+ "use_routing_bias": true,
614
+ "vocab_size": 200064
615
+ }
configuration_minimax_m2.py ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
2
+ # This file was automatically generated from src/transformers/models/minimax_m2/modular_minimax_m2.py.
3
+ # Do NOT edit this file manually as any edits will be overwritten by the generation of
4
+ # the file from the modular. If any change should be done, please apply the change to the
5
+ # modular_minimax_m2.py file directly. One of our CI enforces this.
6
+ # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
7
+ # coding=utf-8
8
+ # Copyright 2025 the HuggingFace Team. All rights reserved.
9
+ #
10
+ # Licensed under the Apache License, Version 2.0 (the "License");
11
+ # you may not use this file except in compliance with the License.
12
+ # You may obtain a copy of the License at
13
+ #
14
+ # http://www.apache.org/licenses/LICENSE-2.0
15
+ #
16
+ # Unless required by applicable law or agreed to in writing, software
17
+ # distributed under the License is distributed on an "AS IS" BASIS,
18
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ # See the License for the specific language governing permissions and
20
+ # limitations under the License.
21
+
22
+
23
+ from transformers.configuration_utils import PretrainedConfig
24
+
25
+
26
+ class MiniMaxM2Config(PretrainedConfig):
27
+ r"""
28
+ This is the configuration class to store the configuration of a [`MiniMaxM2Model`]. It is used to instantiate an
29
+ MiniMaxM2 model according to the specified arguments, defining the model architecture. Instantiating a configuration
30
+ with the defaults will yield a similar configuration to that of the MiniMaxM2-7B-v0.1 or MiniMaxM2-7B-Instruct-v0.1.
31
+
32
+ [minimax_m2ai/MiniMaxM2-8x7B](https://huggingface.co/minimax_m2ai/MiniMaxM2-8x7B)
33
+ [minimax_m2ai/MiniMaxM2-7B-Instruct-v0.1](https://huggingface.co/minimax_m2ai/MiniMaxM2-7B-Instruct-v0.1)
34
+
35
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
36
+ documentation from [`PretrainedConfig`] for more information.
37
+
38
+
39
+ Args:
40
+ vocab_size (`int`, *optional*, defaults to 32000):
41
+ Vocabulary size of the MiniMaxM2 model. Defines the number of different tokens that can be represented by the
42
+ `inputs_ids` passed when calling [`MiniMaxM2Model`]
43
+ hidden_size (`int`, *optional*, defaults to 4096):
44
+ Dimension of the hidden representations.
45
+ intermediate_size (`int`, *optional*, defaults to 14336):
46
+ Dimension of the MLP representations.
47
+ num_hidden_layers (`int`, *optional*, defaults to 32):
48
+ Number of hidden layers in the Transformer encoder.
49
+ num_attention_heads (`int`, *optional*, defaults to 32):
50
+ Number of attention heads for each attention layer in the Transformer encoder.
51
+ num_key_value_heads (`int`, *optional*, defaults to 8):
52
+ This is the number of key_value heads that should be used to implement Grouped Query Attention. If
53
+ `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
54
+ `num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
55
+ converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
56
+ by meanpooling all the original heads within that group. For more details, check out [this
57
+ paper](https://huggingface.co/papers/2305.13245). If it is not specified, will default to `8`.
58
+ head_dim (`int`, *optional*, defaults to `hidden_size // num_attention_heads`):
59
+ The attention head dimension.
60
+ hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
61
+ The non-linear activation function (function or string) in the decoder.
62
+ max_position_embeddings (`int`, *optional*, defaults to `4096*32`):
63
+ The maximum sequence length that this model might ever be used with. MiniMaxM2's sliding window attention
64
+ allows sequence of up to 4096*32 tokens.
65
+ initializer_range (`float`, *optional*, defaults to 0.02):
66
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
67
+ rms_norm_eps (`float`, *optional*, defaults to 1e-05):
68
+ The epsilon used by the rms normalization layers.
69
+ use_cache (`bool`, *optional*, defaults to `True`):
70
+ Whether or not the model should return the last key/values attentions (not used by all models). Only
71
+ relevant if `config.is_decoder=True`.
72
+ pad_token_id (`int`, *optional*):
73
+ The id of the padding token.
74
+ bos_token_id (`int`, *optional*, defaults to 1):
75
+ The id of the "beginning-of-sequence" token.
76
+ eos_token_id (`int`, *optional*, defaults to 2):
77
+ The id of the "end-of-sequence" token.
78
+ tie_word_embeddings (`bool`, *optional*, defaults to `False`):
79
+ Whether the model's input and output word embeddings should be tied.
80
+ rope_theta (`float`, *optional*, defaults to 1000000.0):
81
+ The base period of the RoPE embeddings.
82
+ sliding_window (`int`, *optional*):
83
+ Sliding window attention window size. If not specified, will default to `4096`.
84
+ attention_dropout (`float`, *optional*, defaults to 0.0):
85
+ The dropout ratio for the attention probabilities.
86
+ num_experts_per_tok (`int`, *optional*, defaults to 2):
87
+ The number of experts to route per-token, can be also interpreted as the `top-k` routing
88
+ parameter
89
+ num_local_experts (`int`, *optional*, defaults to 8):
90
+ Number of experts per Sparse MLP layer.
91
+ output_router_logits (`bool`, *optional*, defaults to `False`):
92
+ Whether or not the router logits should be returned by the model. Enabling this will also
93
+ allow the model to output the auxiliary loss. See [here]() for more details
94
+ router_aux_loss_coef (`float`, *optional*, defaults to 0.001):
95
+ The aux loss factor for the total loss.
96
+ router_jitter_noise (`float`, *optional*, defaults to 0.0):
97
+ Amount of noise to add to the router.
98
+
99
+ ```python
100
+ >>> from transformers import MiniMaxM2Model, MiniMaxM2Config
101
+
102
+ >>> # Initializing a MiniMaxM2 7B style configuration
103
+ >>> configuration = MiniMaxM2Config()
104
+
105
+ >>> # Initializing a model from the MiniMaxM2 7B style configuration
106
+ >>> model = MiniMaxM2Model(configuration)
107
+
108
+ >>> # Accessing the model configuration
109
+ >>> configuration = model.config
110
+ ```"""
111
+
112
+ model_type = "minimax_m2"
113
+ keys_to_ignore_at_inference = ["past_key_values"]
114
+ base_model_tp_plan = {
115
+ "layers.*.self_attn.q_proj": "colwise",
116
+ "layers.*.self_attn.k_proj": "colwise",
117
+ "layers.*.self_attn.v_proj": "colwise",
118
+ "layers.*.self_attn.o_proj": "rowwise",
119
+ "layers.*.block_sparse_moe.gate": "colwise_rep", # we need to replicate here to correctly route experts
120
+ "layers.*.block_sparse_moe.experts.*.w1": "colwise",
121
+ "layers.*.block_sparse_moe.experts.*.w2": "rowwise",
122
+ "layers.*.block_sparse_moe.experts.*.w3": "colwise",
123
+ }
124
+ base_model_pp_plan = {
125
+ "embed_tokens": (["input_ids"], ["inputs_embeds"]),
126
+ "layers": (["hidden_states", "attention_mask"], ["hidden_states"]),
127
+ "norm": (["hidden_states"], ["hidden_states"]),
128
+ }
129
+
130
+ def __init__(
131
+ self,
132
+ vocab_size=32000,
133
+ hidden_size=4096,
134
+ intermediate_size=14336,
135
+ num_hidden_layers=32,
136
+ num_attention_heads=32,
137
+ num_key_value_heads=8,
138
+ head_dim=None,
139
+ hidden_act="silu",
140
+ max_position_embeddings=4096 * 32,
141
+ initializer_range=0.02,
142
+ rms_norm_eps=1e-5,
143
+ use_cache=True,
144
+ pad_token_id=None,
145
+ bos_token_id=1,
146
+ eos_token_id=2,
147
+ tie_word_embeddings=False,
148
+ rope_theta=1e6,
149
+ sliding_window=None,
150
+ attention_dropout=0.0,
151
+ num_experts_per_tok=2,
152
+ num_local_experts=8,
153
+ output_router_logits=False,
154
+ router_aux_loss_coef=0.001,
155
+ router_jitter_noise=0.0,
156
+ **kwargs,
157
+ ):
158
+ self.vocab_size = vocab_size
159
+ self.max_position_embeddings = max_position_embeddings
160
+ self.hidden_size = hidden_size
161
+ self.intermediate_size = intermediate_size
162
+ self.num_hidden_layers = num_hidden_layers
163
+ self.num_attention_heads = num_attention_heads
164
+ self.sliding_window = sliding_window
165
+
166
+ # for backward compatibility
167
+ if num_key_value_heads is None:
168
+ num_key_value_heads = num_attention_heads
169
+
170
+ self.num_key_value_heads = num_key_value_heads
171
+ self.hidden_act = hidden_act
172
+ self.initializer_range = initializer_range
173
+ self.rms_norm_eps = rms_norm_eps
174
+ self.use_cache = use_cache
175
+ self.rope_theta = rope_theta
176
+ self.attention_dropout = attention_dropout
177
+ self.head_dim = head_dim
178
+
179
+ self.num_experts_per_tok = num_experts_per_tok
180
+ self.num_local_experts = num_local_experts
181
+ self.output_router_logits = output_router_logits
182
+ self.router_aux_loss_coef = router_aux_loss_coef
183
+ self.router_jitter_noise = router_jitter_noise
184
+
185
+ self.use_qk_norm = kwargs.pop("use_qk_norm", False)
186
+ self.rotary_dim = kwargs.pop("rotary_dim", self.head_dim)
187
+ self.partial_rotary_factor = kwargs.pop("partial_rotary_factor", 1)
188
+ if self.head_dim is not None:
189
+ self.partial_rotary_factor = self.rotary_dim / self.head_dim
190
+
191
+ super().__init__(
192
+ pad_token_id=pad_token_id,
193
+ bos_token_id=bos_token_id,
194
+ eos_token_id=eos_token_id,
195
+ tie_word_embeddings=tie_word_embeddings,
196
+ **kwargs,
197
+ )
198
+
199
+
200
+ __all__ = ["MiniMaxM2Config"]
generation_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 200019,
3
+ "do_sample": true,
4
+ "eos_token_id": 200020,
5
+ "top_k": 40,
6
+ "top_p": 0.95,
7
+ "transformers_version": "4.55.0"
8
+ }
model-00001-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0af84c1315e762a853df6c0ddf9ae1e324be4d944e1c8623a34f93ff9d0be1d6
3
+ size 5144918686
model-00002-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4f4cb2c0bdecfefb098764637476a025694f60a64b669603891a2c3f24f5c14c
3
+ size 4403212872
model-00003-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:edea02071c91757bd593a3aa7d37b949b24b40bf19b59fd1eb5cde454619a6a0
3
+ size 4453522880
model-00004-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:098cd680035e619bd7c5901541f14bc4b52c2251ff3623bf2bdfcc6ee627333c
3
+ size 4403212884
model-00005-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1ee406d028d1616470b4d3e6a722cd4e711edc3ff6182ce02a5dfeb32599d22e
3
+ size 4403212880
model-00006-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:93bb9e930406b2241af083af91e0b460ba5bdd203d1b2e15182fce4be9eeea51
3
+ size 4453522892
model-00007-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ab31cf841c8eac3d3d4ea27e57bdd763f026af3b41f8d0834a72995ca9359494
3
+ size 4403212882
model-00008-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:052bd92e887d75d806b1833a171b7fd73e3a8f36d691ab41a036b514789424da
3
+ size 4403212901
model-00009-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:27e93c2046732e9af1d430c329251982827749d9d68c8b72a5e058401674bf1b
3
+ size 4453522928
model-00010-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:631bca98d0373d80e503d8e0f8626a142db00757b50e9e9f28c681d9fe88165e
3
+ size 4403212916
model-00011-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b127be5050978a86038a139b06ec79070c84214180a73ef33236eb0e99fcc68e
3
+ size 4403212890
model-00012-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2eb5a6454df478904589182755d184be2d6a5ba732aba2ec016c1c1dc459649f
3
+ size 4453522924
model-00013-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ab990c393b4c390aee05e21fb4f198043c93a7f881ae284ecc03d86de1d0860
3
+ size 4403212844
model-00014-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b6977f53c5d9d7526c2faf25e8903c5c8cd85a6a3e85c6b83c658f5be052f35f
3
+ size 4403212908
model-00015-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5c6be4e92fba402feb918419aac9bf2c4e0af4cda980b09fc5660c951fd93582
3
+ size 4453522932
model-00016-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:77d780e6a475af8147a974d95a4928fe3719d1fb2fa4871438405d7be59dd03c
3
+ size 4403212916
model-00017-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:709bea7ae8fa7fce5ac7e3e222a510e8553471f4d6fc03702002aac1fbad0aa1
3
+ size 4403212910
model-00018-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c15ced78f1b7b1b5e30902b6b1d9a86a15f657b691fee945799700aba80e289
3
+ size 4453522926
model-00019-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d2aa63fadf9895e6518ed81024c1711abd986d3b353a01301ac14b05342b78bd
3
+ size 4403212840
model-00020-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:485f352292c1c8de3796b0e73fda4eb195fe80d4601f9545edc69e64ebfaa9aa
3
+ size 4403212910
model-00021-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37d42baac941869768cf434c5f1e262a9117b79835df9f8ac10354480a17517c
3
+ size 4453522902
model-00022-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:eb2e29f3d8538b32c8b70018c175fb2412d14b824462d5642283217f635066a8
3
+ size 4403212916
model-00023-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:afeecbfbc25f18764c1a3c3cd7f8641f5c5fd933d105a54d73789b83e0a95faa
3
+ size 4403212906
model-00024-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bd56188e0b75c0ff9d6e3ef1bcc21fdc143179bc1c57f9c0df7270aff5a8e366
3
+ size 4453522938
model-00025-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0a47b219b2272445d67ff5bb62479e7cedb01f3f99b1dfbc53691191f074742b
3
+ size 4403212892
model-00026-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:96f18cebccdd4b4e65e64998b3bc974bf1ed47a9cacd60e7bd87d3e9357302c6
3
+ size 4403212908
model-00027-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b4aa491b0a7b7d63bf25fc62874f98fa40025be6e303e9b324cd4ba4ac3e629
3
+ size 4453522918
model-00028-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a02aa377ac6b45adf9f49458455da7d4a73e81faee8cda7df48f92b9378d767
3
+ size 4403212888
model-00029-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3331082c0cc502989acf887be40ed9a429de0d32fa54ab8b32cd423bf441eb0e
3
+ size 4403212888
model-00030-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3d4e459ed36052bba7526ba40a5700ec2ae96209786ee27156665c04f52245a7
3
+ size 4453522944
model-00031-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9448213bbdf10f2c7aa0240901e630e01553401c52761dd10d007eeac2dd680b
3
+ size 4403212916
model-00032-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a99d6a86a281cce93deaf44261a4e28c69bbaf97da22111a9c38ec843e83e32a
3
+ size 4403212908
model-00033-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cdec44dcd9c2ea8e59ed8b7db8e135ede7981b10e328f19699644b49d4ffdb04
3
+ size 4453522922
model-00034-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:666fec83971b83f05fcbcca2c9e5619242d318259f7896ad32e410892d53dc69
3
+ size 4403212908
model-00035-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bedf966b38598a4f1b62c985453cca43c6c7fa821ffa867255ecf0a421393675
3
+ size 4403212910
model-00036-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6f50fcadf9089c4b79c506e2e87415f7bcf98cf1186ea951d1c468d1fc6048ba
3
+ size 4453522928
model-00037-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4813eb6f826dccd737fcbbceee31fe8c4da6bb4c5443d02508c531c1c62c50be
3
+ size 4403212866
model-00038-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e691957e88a713744bd1eddcf4b654d4e68c739a809860c62a4f1057d67fd698
3
+ size 4403212908
model-00039-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:13f6314f96b05379fa24d576fc97e77504018609f5745643e1b79826584b655e
3
+ size 4453522946
model-00040-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4bd6a76b769739ae6a7a7fdc23f5930bdf4331bc80ec33bbba77dc7c2a3dca46
3
+ size 4403212914
model-00041-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a7b3e3f65eefb69e843261846ee095d544a152a2cde3d87d0656fcff92689384
3
+ size 4403212908
model-00042-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c53f944da79f017ed08ca23d4d859b3d724d0e37559da757bdc8129f3bc3f4e7
3
+ size 4453522944
model-00043-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:57abaa3b1016c0815a2673c9eb71537594cdf97f2c46679060aa514155e1f575
3
+ size 4403212916
model-00044-of-00047.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5a85758657da4fdd9ebd37be199a456007a348340819ab13c96c01d400ea270c
3
+ size 4403212908