tomkay commited on
Commit
d48f4d6
·
verified ·
1 Parent(s): 71bab09

Initial upload

Browse files
.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
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.7 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,2863 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "MiniMaxM2ForCausalLM"
4
+ ],
5
+ "attn_type_list": [
6
+ 1,
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
+ ],
69
+ "auto_map": {
70
+ "AutoConfig": "configuration_minimax_m2.MiniMaxM2Config",
71
+ "AutoModelForCausalLM": "modeling_minimax_m2.MiniMaxM2ForCausalLM"
72
+ },
73
+ "dtype": "bfloat16",
74
+ "eos_token_id": 200020,
75
+ "head_dim": 128,
76
+ "hidden_act": "silu",
77
+ "hidden_size": 3072,
78
+ "intermediate_size": 1536,
79
+ "max_position_embeddings": 196608,
80
+ "model_type": "minimax_m2",
81
+ "mtp_transformer_layers": 1,
82
+ "num_attention_heads": 48,
83
+ "num_experts_per_tok": 8,
84
+ "num_hidden_layers": 62,
85
+ "num_key_value_heads": 8,
86
+ "num_local_experts": 256,
87
+ "num_mtp_modules": 3,
88
+ "qk_norm_type": "per_layer",
89
+ "quantization": {
90
+ "group_size": 64,
91
+ "bits": 4,
92
+ "mode": "affine",
93
+ "model.embed_tokens": {
94
+ "group_size": 64,
95
+ "bits": 8
96
+ },
97
+ "model.layers.0.self_attn.q_proj": {
98
+ "group_size": 64,
99
+ "bits": 8
100
+ },
101
+ "model.layers.0.self_attn.k_proj": {
102
+ "group_size": 64,
103
+ "bits": 8
104
+ },
105
+ "model.layers.0.self_attn.v_proj": {
106
+ "group_size": 64,
107
+ "bits": 8
108
+ },
109
+ "model.layers.0.self_attn.o_proj": {
110
+ "group_size": 64,
111
+ "bits": 8
112
+ },
113
+ "model.layers.0.block_sparse_moe.switch_mlp.gate_proj": {
114
+ "group_size": 64,
115
+ "bits": 8
116
+ },
117
+ "model.layers.0.block_sparse_moe.switch_mlp.up_proj": {
118
+ "group_size": 64,
119
+ "bits": 8
120
+ },
121
+ "model.layers.0.block_sparse_moe.switch_mlp.down_proj": {
122
+ "group_size": 64,
123
+ "bits": 8
124
+ },
125
+ "model.layers.1.block_sparse_moe.switch_mlp.gate_proj": {
126
+ "group_size": 64,
127
+ "bits": 6
128
+ },
129
+ "model.layers.1.block_sparse_moe.switch_mlp.up_proj": {
130
+ "group_size": 64,
131
+ "bits": 6
132
+ },
133
+ "model.layers.1.block_sparse_moe.switch_mlp.down_proj": {
134
+ "group_size": 64,
135
+ "bits": 8
136
+ },
137
+ "model.layers.2.self_attn.q_proj": {
138
+ "group_size": 64,
139
+ "bits": 8
140
+ },
141
+ "model.layers.2.self_attn.k_proj": {
142
+ "group_size": 64,
143
+ "bits": 8
144
+ },
145
+ "model.layers.2.self_attn.v_proj": {
146
+ "group_size": 64,
147
+ "bits": 8
148
+ },
149
+ "model.layers.2.self_attn.o_proj": {
150
+ "group_size": 64,
151
+ "bits": 8
152
+ },
153
+ "model.layers.2.block_sparse_moe.switch_mlp.gate_proj": {
154
+ "group_size": 64,
155
+ "bits": 5
156
+ },
157
+ "model.layers.2.block_sparse_moe.switch_mlp.up_proj": {
158
+ "group_size": 64,
159
+ "bits": 6
160
+ },
161
+ "model.layers.2.block_sparse_moe.switch_mlp.down_proj": {
162
+ "group_size": 64,
163
+ "bits": 6
164
+ },
165
+ "model.layers.3.self_attn.q_proj": {
166
+ "group_size": 64,
167
+ "bits": 8
168
+ },
169
+ "model.layers.3.self_attn.v_proj": {
170
+ "group_size": 64,
171
+ "bits": 8
172
+ },
173
+ "model.layers.3.self_attn.o_proj": {
174
+ "group_size": 64,
175
+ "bits": 8
176
+ },
177
+ "model.layers.3.block_sparse_moe.switch_mlp.gate_proj": {
178
+ "group_size": 64,
179
+ "bits": 6
180
+ },
181
+ "model.layers.3.block_sparse_moe.switch_mlp.up_proj": {
182
+ "group_size": 64,
183
+ "bits": 5
184
+ },
185
+ "model.layers.3.block_sparse_moe.switch_mlp.down_proj": {
186
+ "group_size": 64,
187
+ "bits": 6
188
+ },
189
+ "model.layers.4.self_attn.q_proj": {
190
+ "group_size": 64,
191
+ "bits": 8
192
+ },
193
+ "model.layers.4.self_attn.k_proj": {
194
+ "group_size": 64,
195
+ "bits": 8
196
+ },
197
+ "model.layers.4.self_attn.o_proj": {
198
+ "group_size": 64,
199
+ "bits": 8
200
+ },
201
+ "model.layers.4.block_sparse_moe.switch_mlp.gate_proj": {
202
+ "group_size": 64,
203
+ "bits": 5
204
+ },
205
+ "model.layers.4.block_sparse_moe.switch_mlp.up_proj": {
206
+ "group_size": 64,
207
+ "bits": 4
208
+ },
209
+ "model.layers.4.block_sparse_moe.switch_mlp.down_proj": {
210
+ "group_size": 64,
211
+ "bits": 5
212
+ },
213
+ "model.layers.5.self_attn.q_proj": {
214
+ "group_size": 64,
215
+ "bits": 8
216
+ },
217
+ "model.layers.5.self_attn.k_proj": {
218
+ "group_size": 64,
219
+ "bits": 8
220
+ },
221
+ "model.layers.5.self_attn.o_proj": {
222
+ "group_size": 64,
223
+ "bits": 6
224
+ },
225
+ "model.layers.5.block_sparse_moe.switch_mlp.gate_proj": {
226
+ "group_size": 64,
227
+ "bits": 4
228
+ },
229
+ "model.layers.5.block_sparse_moe.switch_mlp.up_proj": {
230
+ "group_size": 64,
231
+ "bits": 4
232
+ },
233
+ "model.layers.5.block_sparse_moe.switch_mlp.down_proj": {
234
+ "group_size": 64,
235
+ "bits": 6
236
+ },
237
+ "model.layers.6.self_attn.q_proj": {
238
+ "group_size": 64,
239
+ "bits": 5
240
+ },
241
+ "model.layers.6.self_attn.k_proj": {
242
+ "group_size": 64,
243
+ "bits": 8
244
+ },
245
+ "model.layers.6.self_attn.v_proj": {
246
+ "group_size": 64,
247
+ "bits": 8
248
+ },
249
+ "model.layers.6.self_attn.o_proj": {
250
+ "group_size": 64,
251
+ "bits": 6
252
+ },
253
+ "model.layers.6.block_sparse_moe.switch_mlp.gate_proj": {
254
+ "group_size": 64,
255
+ "bits": 4
256
+ },
257
+ "model.layers.6.block_sparse_moe.switch_mlp.up_proj": {
258
+ "group_size": 64,
259
+ "bits": 4
260
+ },
261
+ "model.layers.6.block_sparse_moe.switch_mlp.down_proj": {
262
+ "group_size": 64,
263
+ "bits": 4
264
+ },
265
+ "model.layers.7.self_attn.q_proj": {
266
+ "group_size": 64,
267
+ "bits": 8
268
+ },
269
+ "model.layers.7.self_attn.k_proj": {
270
+ "group_size": 64,
271
+ "bits": 5
272
+ },
273
+ "model.layers.7.self_attn.v_proj": {
274
+ "group_size": 64,
275
+ "bits": 8
276
+ },
277
+ "model.layers.7.self_attn.o_proj": {
278
+ "group_size": 64,
279
+ "bits": 6
280
+ },
281
+ "model.layers.7.block_sparse_moe.switch_mlp.gate_proj": {
282
+ "group_size": 64,
283
+ "bits": 4
284
+ },
285
+ "model.layers.7.block_sparse_moe.switch_mlp.up_proj": {
286
+ "group_size": 64,
287
+ "bits": 5
288
+ },
289
+ "model.layers.7.block_sparse_moe.switch_mlp.down_proj": {
290
+ "group_size": 64,
291
+ "bits": 5
292
+ },
293
+ "model.layers.8.self_attn.q_proj": {
294
+ "group_size": 64,
295
+ "bits": 6
296
+ },
297
+ "model.layers.8.self_attn.k_proj": {
298
+ "group_size": 64,
299
+ "bits": 8
300
+ },
301
+ "model.layers.8.self_attn.v_proj": {
302
+ "group_size": 64,
303
+ "bits": 8
304
+ },
305
+ "model.layers.8.self_attn.o_proj": {
306
+ "group_size": 64,
307
+ "bits": 6
308
+ },
309
+ "model.layers.8.block_sparse_moe.switch_mlp.gate_proj": {
310
+ "group_size": 64,
311
+ "bits": 4
312
+ },
313
+ "model.layers.8.block_sparse_moe.switch_mlp.up_proj": {
314
+ "group_size": 64,
315
+ "bits": 3
316
+ },
317
+ "model.layers.8.block_sparse_moe.switch_mlp.down_proj": {
318
+ "group_size": 64,
319
+ "bits": 5
320
+ },
321
+ "model.layers.9.self_attn.q_proj": {
322
+ "group_size": 64,
323
+ "bits": 6
324
+ },
325
+ "model.layers.9.self_attn.k_proj": {
326
+ "group_size": 64,
327
+ "bits": 8
328
+ },
329
+ "model.layers.9.self_attn.v_proj": {
330
+ "group_size": 64,
331
+ "bits": 8
332
+ },
333
+ "model.layers.9.self_attn.o_proj": {
334
+ "group_size": 64,
335
+ "bits": 6
336
+ },
337
+ "model.layers.9.block_sparse_moe.switch_mlp.gate_proj": {
338
+ "group_size": 64,
339
+ "bits": 3
340
+ },
341
+ "model.layers.9.block_sparse_moe.switch_mlp.up_proj": {
342
+ "group_size": 64,
343
+ "bits": 3
344
+ },
345
+ "model.layers.9.block_sparse_moe.switch_mlp.down_proj": {
346
+ "group_size": 64,
347
+ "bits": 4
348
+ },
349
+ "model.layers.10.self_attn.q_proj": {
350
+ "group_size": 64,
351
+ "bits": 5
352
+ },
353
+ "model.layers.10.self_attn.k_proj": {
354
+ "group_size": 64,
355
+ "bits": 6
356
+ },
357
+ "model.layers.10.self_attn.v_proj": {
358
+ "group_size": 64,
359
+ "bits": 8
360
+ },
361
+ "model.layers.10.self_attn.o_proj": {
362
+ "group_size": 64,
363
+ "bits": 6
364
+ },
365
+ "model.layers.10.block_sparse_moe.switch_mlp.gate_proj": {
366
+ "group_size": 64,
367
+ "bits": 4
368
+ },
369
+ "model.layers.10.block_sparse_moe.switch_mlp.up_proj": {
370
+ "group_size": 64,
371
+ "bits": 3
372
+ },
373
+ "model.layers.10.block_sparse_moe.switch_mlp.down_proj": {
374
+ "group_size": 64,
375
+ "bits": 4
376
+ },
377
+ "model.layers.11.self_attn.q_proj": {
378
+ "group_size": 64,
379
+ "bits": 6
380
+ },
381
+ "model.layers.11.self_attn.k_proj": {
382
+ "group_size": 64,
383
+ "bits": 8
384
+ },
385
+ "model.layers.11.self_attn.o_proj": {
386
+ "group_size": 64,
387
+ "bits": 6
388
+ },
389
+ "model.layers.11.block_sparse_moe.switch_mlp.gate_proj": {
390
+ "group_size": 64,
391
+ "bits": 3
392
+ },
393
+ "model.layers.11.block_sparse_moe.switch_mlp.up_proj": {
394
+ "group_size": 64,
395
+ "bits": 3
396
+ },
397
+ "model.layers.11.block_sparse_moe.switch_mlp.down_proj": {
398
+ "group_size": 64,
399
+ "bits": 4
400
+ },
401
+ "model.layers.12.self_attn.q_proj": {
402
+ "group_size": 64,
403
+ "bits": 5
404
+ },
405
+ "model.layers.12.self_attn.k_proj": {
406
+ "group_size": 64,
407
+ "bits": 8
408
+ },
409
+ "model.layers.12.self_attn.v_proj": {
410
+ "group_size": 64,
411
+ "bits": 8
412
+ },
413
+ "model.layers.12.self_attn.o_proj": {
414
+ "group_size": 64,
415
+ "bits": 5
416
+ },
417
+ "model.layers.12.block_sparse_moe.switch_mlp.gate_proj": {
418
+ "group_size": 64,
419
+ "bits": 3
420
+ },
421
+ "model.layers.12.block_sparse_moe.switch_mlp.up_proj": {
422
+ "group_size": 64,
423
+ "bits": 3
424
+ },
425
+ "model.layers.12.block_sparse_moe.switch_mlp.down_proj": {
426
+ "group_size": 64,
427
+ "bits": 4
428
+ },
429
+ "model.layers.13.self_attn.q_proj": {
430
+ "group_size": 64,
431
+ "bits": 6
432
+ },
433
+ "model.layers.13.self_attn.k_proj": {
434
+ "group_size": 64,
435
+ "bits": 8
436
+ },
437
+ "model.layers.13.self_attn.v_proj": {
438
+ "group_size": 64,
439
+ "bits": 8
440
+ },
441
+ "model.layers.13.self_attn.o_proj": {
442
+ "group_size": 64,
443
+ "bits": 6
444
+ },
445
+ "model.layers.13.block_sparse_moe.switch_mlp.gate_proj": {
446
+ "group_size": 64,
447
+ "bits": 3
448
+ },
449
+ "model.layers.13.block_sparse_moe.switch_mlp.up_proj": {
450
+ "group_size": 64,
451
+ "bits": 3
452
+ },
453
+ "model.layers.13.block_sparse_moe.switch_mlp.down_proj": {
454
+ "group_size": 64,
455
+ "bits": 3
456
+ },
457
+ "model.layers.14.self_attn.q_proj": {
458
+ "group_size": 64,
459
+ "bits": 6
460
+ },
461
+ "model.layers.14.self_attn.k_proj": {
462
+ "group_size": 64,
463
+ "bits": 8
464
+ },
465
+ "model.layers.14.self_attn.v_proj": {
466
+ "group_size": 64,
467
+ "bits": 8
468
+ },
469
+ "model.layers.14.self_attn.o_proj": {
470
+ "group_size": 64,
471
+ "bits": 6
472
+ },
473
+ "model.layers.14.block_sparse_moe.switch_mlp.gate_proj": {
474
+ "group_size": 64,
475
+ "bits": 3
476
+ },
477
+ "model.layers.14.block_sparse_moe.switch_mlp.up_proj": {
478
+ "group_size": 64,
479
+ "bits": 3
480
+ },
481
+ "model.layers.14.block_sparse_moe.switch_mlp.down_proj": {
482
+ "group_size": 64,
483
+ "bits": 3
484
+ },
485
+ "model.layers.15.self_attn.q_proj": {
486
+ "group_size": 64,
487
+ "bits": 5
488
+ },
489
+ "model.layers.15.self_attn.k_proj": {
490
+ "group_size": 64,
491
+ "bits": 8
492
+ },
493
+ "model.layers.15.self_attn.v_proj": {
494
+ "group_size": 64,
495
+ "bits": 8
496
+ },
497
+ "model.layers.15.self_attn.o_proj": {
498
+ "group_size": 64,
499
+ "bits": 6
500
+ },
501
+ "model.layers.15.block_sparse_moe.switch_mlp.gate_proj": {
502
+ "group_size": 64,
503
+ "bits": 3
504
+ },
505
+ "model.layers.15.block_sparse_moe.switch_mlp.up_proj": {
506
+ "group_size": 64,
507
+ "bits": 3
508
+ },
509
+ "model.layers.15.block_sparse_moe.switch_mlp.down_proj": {
510
+ "group_size": 64,
511
+ "bits": 3
512
+ },
513
+ "model.layers.16.self_attn.q_proj": {
514
+ "group_size": 64,
515
+ "bits": 6
516
+ },
517
+ "model.layers.16.self_attn.k_proj": {
518
+ "group_size": 64,
519
+ "bits": 8
520
+ },
521
+ "model.layers.16.self_attn.v_proj": {
522
+ "group_size": 64,
523
+ "bits": 8
524
+ },
525
+ "model.layers.16.self_attn.o_proj": {
526
+ "group_size": 64,
527
+ "bits": 8
528
+ },
529
+ "model.layers.16.block_sparse_moe.switch_mlp.gate_proj": {
530
+ "group_size": 64,
531
+ "bits": 3
532
+ },
533
+ "model.layers.16.block_sparse_moe.switch_mlp.up_proj": {
534
+ "group_size": 64,
535
+ "bits": 3
536
+ },
537
+ "model.layers.16.block_sparse_moe.switch_mlp.down_proj": {
538
+ "group_size": 64,
539
+ "bits": 3
540
+ },
541
+ "model.layers.17.self_attn.q_proj": {
542
+ "group_size": 64,
543
+ "bits": 5
544
+ },
545
+ "model.layers.17.self_attn.k_proj": {
546
+ "group_size": 64,
547
+ "bits": 8
548
+ },
549
+ "model.layers.17.self_attn.v_proj": {
550
+ "group_size": 64,
551
+ "bits": 8
552
+ },
553
+ "model.layers.17.self_attn.o_proj": {
554
+ "group_size": 64,
555
+ "bits": 6
556
+ },
557
+ "model.layers.17.block_sparse_moe.switch_mlp.gate_proj": {
558
+ "group_size": 64,
559
+ "bits": 3
560
+ },
561
+ "model.layers.17.block_sparse_moe.switch_mlp.up_proj": {
562
+ "group_size": 64,
563
+ "bits": 3
564
+ },
565
+ "model.layers.17.block_sparse_moe.switch_mlp.down_proj": {
566
+ "group_size": 64,
567
+ "bits": 3
568
+ },
569
+ "model.layers.18.self_attn.q_proj": {
570
+ "group_size": 64,
571
+ "bits": 6
572
+ },
573
+ "model.layers.18.self_attn.k_proj": {
574
+ "group_size": 64,
575
+ "bits": 8
576
+ },
577
+ "model.layers.18.self_attn.v_proj": {
578
+ "group_size": 64,
579
+ "bits": 8
580
+ },
581
+ "model.layers.18.self_attn.o_proj": {
582
+ "group_size": 64,
583
+ "bits": 6
584
+ },
585
+ "model.layers.18.block_sparse_moe.switch_mlp.gate_proj": {
586
+ "group_size": 64,
587
+ "bits": 3
588
+ },
589
+ "model.layers.18.block_sparse_moe.switch_mlp.up_proj": {
590
+ "group_size": 64,
591
+ "bits": 3
592
+ },
593
+ "model.layers.18.block_sparse_moe.switch_mlp.down_proj": {
594
+ "group_size": 64,
595
+ "bits": 3
596
+ },
597
+ "model.layers.19.self_attn.q_proj": {
598
+ "group_size": 64,
599
+ "bits": 6
600
+ },
601
+ "model.layers.19.self_attn.k_proj": {
602
+ "group_size": 64,
603
+ "bits": 8
604
+ },
605
+ "model.layers.19.self_attn.v_proj": {
606
+ "group_size": 64,
607
+ "bits": 8
608
+ },
609
+ "model.layers.19.self_attn.o_proj": {
610
+ "group_size": 64,
611
+ "bits": 6
612
+ },
613
+ "model.layers.19.block_sparse_moe.switch_mlp.gate_proj": {
614
+ "group_size": 64,
615
+ "bits": 3
616
+ },
617
+ "model.layers.19.block_sparse_moe.switch_mlp.up_proj": {
618
+ "group_size": 64,
619
+ "bits": 3
620
+ },
621
+ "model.layers.19.block_sparse_moe.switch_mlp.down_proj": {
622
+ "group_size": 64,
623
+ "bits": 3
624
+ },
625
+ "model.layers.20.self_attn.q_proj": {
626
+ "group_size": 64,
627
+ "bits": 6
628
+ },
629
+ "model.layers.20.self_attn.k_proj": {
630
+ "group_size": 64,
631
+ "bits": 8
632
+ },
633
+ "model.layers.20.self_attn.v_proj": {
634
+ "group_size": 64,
635
+ "bits": 8
636
+ },
637
+ "model.layers.20.self_attn.o_proj": {
638
+ "group_size": 64,
639
+ "bits": 6
640
+ },
641
+ "model.layers.20.block_sparse_moe.switch_mlp.gate_proj": {
642
+ "group_size": 64,
643
+ "bits": 3
644
+ },
645
+ "model.layers.20.block_sparse_moe.switch_mlp.up_proj": {
646
+ "group_size": 64,
647
+ "bits": 3
648
+ },
649
+ "model.layers.20.block_sparse_moe.switch_mlp.down_proj": {
650
+ "group_size": 64,
651
+ "bits": 3
652
+ },
653
+ "model.layers.21.self_attn.q_proj": {
654
+ "group_size": 64,
655
+ "bits": 5
656
+ },
657
+ "model.layers.21.self_attn.k_proj": {
658
+ "group_size": 64,
659
+ "bits": 8
660
+ },
661
+ "model.layers.21.self_attn.v_proj": {
662
+ "group_size": 64,
663
+ "bits": 8
664
+ },
665
+ "model.layers.21.self_attn.o_proj": {
666
+ "group_size": 64,
667
+ "bits": 6
668
+ },
669
+ "model.layers.21.block_sparse_moe.switch_mlp.gate_proj": {
670
+ "group_size": 64,
671
+ "bits": 3
672
+ },
673
+ "model.layers.21.block_sparse_moe.switch_mlp.up_proj": {
674
+ "group_size": 64,
675
+ "bits": 3
676
+ },
677
+ "model.layers.21.block_sparse_moe.switch_mlp.down_proj": {
678
+ "group_size": 64,
679
+ "bits": 3
680
+ },
681
+ "model.layers.22.self_attn.q_proj": {
682
+ "group_size": 64,
683
+ "bits": 6
684
+ },
685
+ "model.layers.22.self_attn.k_proj": {
686
+ "group_size": 64,
687
+ "bits": 8
688
+ },
689
+ "model.layers.22.self_attn.v_proj": {
690
+ "group_size": 64,
691
+ "bits": 8
692
+ },
693
+ "model.layers.22.self_attn.o_proj": {
694
+ "group_size": 64,
695
+ "bits": 6
696
+ },
697
+ "model.layers.22.block_sparse_moe.switch_mlp.gate_proj": {
698
+ "group_size": 64,
699
+ "bits": 3
700
+ },
701
+ "model.layers.22.block_sparse_moe.switch_mlp.up_proj": {
702
+ "group_size": 64,
703
+ "bits": 3
704
+ },
705
+ "model.layers.22.block_sparse_moe.switch_mlp.down_proj": {
706
+ "group_size": 64,
707
+ "bits": 3
708
+ },
709
+ "model.layers.23.self_attn.q_proj": {
710
+ "group_size": 64,
711
+ "bits": 6
712
+ },
713
+ "model.layers.23.self_attn.k_proj": {
714
+ "group_size": 64,
715
+ "bits": 8
716
+ },
717
+ "model.layers.23.self_attn.v_proj": {
718
+ "group_size": 64,
719
+ "bits": 8
720
+ },
721
+ "model.layers.23.self_attn.o_proj": {
722
+ "group_size": 64,
723
+ "bits": 8
724
+ },
725
+ "model.layers.23.block_sparse_moe.switch_mlp.gate_proj": {
726
+ "group_size": 64,
727
+ "bits": 3
728
+ },
729
+ "model.layers.23.block_sparse_moe.switch_mlp.up_proj": {
730
+ "group_size": 64,
731
+ "bits": 3
732
+ },
733
+ "model.layers.23.block_sparse_moe.switch_mlp.down_proj": {
734
+ "group_size": 64,
735
+ "bits": 3
736
+ },
737
+ "model.layers.24.self_attn.q_proj": {
738
+ "group_size": 64,
739
+ "bits": 6
740
+ },
741
+ "model.layers.24.self_attn.k_proj": {
742
+ "group_size": 64,
743
+ "bits": 8
744
+ },
745
+ "model.layers.24.self_attn.v_proj": {
746
+ "group_size": 64,
747
+ "bits": 8
748
+ },
749
+ "model.layers.24.self_attn.o_proj": {
750
+ "group_size": 64,
751
+ "bits": 8
752
+ },
753
+ "model.layers.24.block_sparse_moe.switch_mlp.gate_proj": {
754
+ "group_size": 64,
755
+ "bits": 3
756
+ },
757
+ "model.layers.24.block_sparse_moe.switch_mlp.up_proj": {
758
+ "group_size": 64,
759
+ "bits": 3
760
+ },
761
+ "model.layers.24.block_sparse_moe.switch_mlp.down_proj": {
762
+ "group_size": 64,
763
+ "bits": 3
764
+ },
765
+ "model.layers.25.self_attn.q_proj": {
766
+ "group_size": 64,
767
+ "bits": 6
768
+ },
769
+ "model.layers.25.self_attn.k_proj": {
770
+ "group_size": 64,
771
+ "bits": 8
772
+ },
773
+ "model.layers.25.self_attn.v_proj": {
774
+ "group_size": 64,
775
+ "bits": 8
776
+ },
777
+ "model.layers.25.self_attn.o_proj": {
778
+ "group_size": 64,
779
+ "bits": 8
780
+ },
781
+ "model.layers.25.block_sparse_moe.switch_mlp.gate_proj": {
782
+ "group_size": 64,
783
+ "bits": 3
784
+ },
785
+ "model.layers.25.block_sparse_moe.switch_mlp.up_proj": {
786
+ "group_size": 64,
787
+ "bits": 3
788
+ },
789
+ "model.layers.25.block_sparse_moe.switch_mlp.down_proj": {
790
+ "group_size": 64,
791
+ "bits": 3
792
+ },
793
+ "model.layers.26.self_attn.q_proj": {
794
+ "group_size": 64,
795
+ "bits": 6
796
+ },
797
+ "model.layers.26.self_attn.k_proj": {
798
+ "group_size": 64,
799
+ "bits": 8
800
+ },
801
+ "model.layers.26.self_attn.v_proj": {
802
+ "group_size": 64,
803
+ "bits": 8
804
+ },
805
+ "model.layers.26.self_attn.o_proj": {
806
+ "group_size": 64,
807
+ "bits": 8
808
+ },
809
+ "model.layers.26.block_sparse_moe.switch_mlp.gate_proj": {
810
+ "group_size": 64,
811
+ "bits": 3
812
+ },
813
+ "model.layers.26.block_sparse_moe.switch_mlp.up_proj": {
814
+ "group_size": 64,
815
+ "bits": 3
816
+ },
817
+ "model.layers.26.block_sparse_moe.switch_mlp.down_proj": {
818
+ "group_size": 64,
819
+ "bits": 3
820
+ },
821
+ "model.layers.27.self_attn.q_proj": {
822
+ "group_size": 64,
823
+ "bits": 6
824
+ },
825
+ "model.layers.27.self_attn.k_proj": {
826
+ "group_size": 64,
827
+ "bits": 8
828
+ },
829
+ "model.layers.27.self_attn.v_proj": {
830
+ "group_size": 64,
831
+ "bits": 8
832
+ },
833
+ "model.layers.27.self_attn.o_proj": {
834
+ "group_size": 64,
835
+ "bits": 8
836
+ },
837
+ "model.layers.27.block_sparse_moe.switch_mlp.gate_proj": {
838
+ "group_size": 64,
839
+ "bits": 3
840
+ },
841
+ "model.layers.27.block_sparse_moe.switch_mlp.up_proj": {
842
+ "group_size": 64,
843
+ "bits": 3
844
+ },
845
+ "model.layers.27.block_sparse_moe.switch_mlp.down_proj": {
846
+ "group_size": 64,
847
+ "bits": 3
848
+ },
849
+ "model.layers.28.self_attn.q_proj": {
850
+ "group_size": 64,
851
+ "bits": 8
852
+ },
853
+ "model.layers.28.self_attn.k_proj": {
854
+ "group_size": 64,
855
+ "bits": 8
856
+ },
857
+ "model.layers.28.self_attn.v_proj": {
858
+ "group_size": 64,
859
+ "bits": 8
860
+ },
861
+ "model.layers.28.self_attn.o_proj": {
862
+ "group_size": 64,
863
+ "bits": 8
864
+ },
865
+ "model.layers.28.block_sparse_moe.switch_mlp.gate_proj": {
866
+ "group_size": 64,
867
+ "bits": 3
868
+ },
869
+ "model.layers.28.block_sparse_moe.switch_mlp.up_proj": {
870
+ "group_size": 64,
871
+ "bits": 3
872
+ },
873
+ "model.layers.28.block_sparse_moe.switch_mlp.down_proj": {
874
+ "group_size": 64,
875
+ "bits": 3
876
+ },
877
+ "model.layers.29.self_attn.q_proj": {
878
+ "group_size": 64,
879
+ "bits": 6
880
+ },
881
+ "model.layers.29.self_attn.k_proj": {
882
+ "group_size": 64,
883
+ "bits": 8
884
+ },
885
+ "model.layers.29.self_attn.o_proj": {
886
+ "group_size": 64,
887
+ "bits": 8
888
+ },
889
+ "model.layers.29.block_sparse_moe.switch_mlp.gate_proj": {
890
+ "group_size": 64,
891
+ "bits": 3
892
+ },
893
+ "model.layers.29.block_sparse_moe.switch_mlp.up_proj": {
894
+ "group_size": 64,
895
+ "bits": 3
896
+ },
897
+ "model.layers.29.block_sparse_moe.switch_mlp.down_proj": {
898
+ "group_size": 64,
899
+ "bits": 4
900
+ },
901
+ "model.layers.30.self_attn.q_proj": {
902
+ "group_size": 64,
903
+ "bits": 6
904
+ },
905
+ "model.layers.30.self_attn.k_proj": {
906
+ "group_size": 64,
907
+ "bits": 8
908
+ },
909
+ "model.layers.30.self_attn.v_proj": {
910
+ "group_size": 64,
911
+ "bits": 8
912
+ },
913
+ "model.layers.30.self_attn.o_proj": {
914
+ "group_size": 64,
915
+ "bits": 8
916
+ },
917
+ "model.layers.30.block_sparse_moe.switch_mlp.gate_proj": {
918
+ "group_size": 64,
919
+ "bits": 3
920
+ },
921
+ "model.layers.30.block_sparse_moe.switch_mlp.up_proj": {
922
+ "group_size": 64,
923
+ "bits": 3
924
+ },
925
+ "model.layers.30.block_sparse_moe.switch_mlp.down_proj": {
926
+ "group_size": 64,
927
+ "bits": 3
928
+ },
929
+ "model.layers.31.self_attn.q_proj": {
930
+ "group_size": 64,
931
+ "bits": 8
932
+ },
933
+ "model.layers.31.self_attn.k_proj": {
934
+ "group_size": 64,
935
+ "bits": 8
936
+ },
937
+ "model.layers.31.self_attn.o_proj": {
938
+ "group_size": 64,
939
+ "bits": 8
940
+ },
941
+ "model.layers.31.block_sparse_moe.switch_mlp.gate_proj": {
942
+ "group_size": 64,
943
+ "bits": 3
944
+ },
945
+ "model.layers.31.block_sparse_moe.switch_mlp.up_proj": {
946
+ "group_size": 64,
947
+ "bits": 3
948
+ },
949
+ "model.layers.31.block_sparse_moe.switch_mlp.down_proj": {
950
+ "group_size": 64,
951
+ "bits": 3
952
+ },
953
+ "model.layers.32.self_attn.q_proj": {
954
+ "group_size": 64,
955
+ "bits": 8
956
+ },
957
+ "model.layers.32.self_attn.k_proj": {
958
+ "group_size": 64,
959
+ "bits": 8
960
+ },
961
+ "model.layers.32.self_attn.o_proj": {
962
+ "group_size": 64,
963
+ "bits": 8
964
+ },
965
+ "model.layers.32.block_sparse_moe.switch_mlp.gate_proj": {
966
+ "group_size": 64,
967
+ "bits": 3
968
+ },
969
+ "model.layers.32.block_sparse_moe.switch_mlp.up_proj": {
970
+ "group_size": 64,
971
+ "bits": 3
972
+ },
973
+ "model.layers.32.block_sparse_moe.switch_mlp.down_proj": {
974
+ "group_size": 64,
975
+ "bits": 4
976
+ },
977
+ "model.layers.33.self_attn.q_proj": {
978
+ "group_size": 64,
979
+ "bits": 8
980
+ },
981
+ "model.layers.33.self_attn.k_proj": {
982
+ "group_size": 64,
983
+ "bits": 8
984
+ },
985
+ "model.layers.33.self_attn.o_proj": {
986
+ "group_size": 64,
987
+ "bits": 8
988
+ },
989
+ "model.layers.33.block_sparse_moe.switch_mlp.gate_proj": {
990
+ "group_size": 64,
991
+ "bits": 3
992
+ },
993
+ "model.layers.33.block_sparse_moe.switch_mlp.up_proj": {
994
+ "group_size": 64,
995
+ "bits": 3
996
+ },
997
+ "model.layers.33.block_sparse_moe.switch_mlp.down_proj": {
998
+ "group_size": 64,
999
+ "bits": 3
1000
+ },
1001
+ "model.layers.34.self_attn.q_proj": {
1002
+ "group_size": 64,
1003
+ "bits": 8
1004
+ },
1005
+ "model.layers.34.self_attn.k_proj": {
1006
+ "group_size": 64,
1007
+ "bits": 8
1008
+ },
1009
+ "model.layers.34.self_attn.v_proj": {
1010
+ "group_size": 64,
1011
+ "bits": 8
1012
+ },
1013
+ "model.layers.34.self_attn.o_proj": {
1014
+ "group_size": 64,
1015
+ "bits": 8
1016
+ },
1017
+ "model.layers.34.block_sparse_moe.switch_mlp.gate_proj": {
1018
+ "group_size": 64,
1019
+ "bits": 3
1020
+ },
1021
+ "model.layers.34.block_sparse_moe.switch_mlp.up_proj": {
1022
+ "group_size": 64,
1023
+ "bits": 3
1024
+ },
1025
+ "model.layers.34.block_sparse_moe.switch_mlp.down_proj": {
1026
+ "group_size": 64,
1027
+ "bits": 3
1028
+ },
1029
+ "model.layers.35.self_attn.q_proj": {
1030
+ "group_size": 64,
1031
+ "bits": 8
1032
+ },
1033
+ "model.layers.35.self_attn.k_proj": {
1034
+ "group_size": 64,
1035
+ "bits": 8
1036
+ },
1037
+ "model.layers.35.self_attn.o_proj": {
1038
+ "group_size": 64,
1039
+ "bits": 8
1040
+ },
1041
+ "model.layers.35.block_sparse_moe.switch_mlp.gate_proj": {
1042
+ "group_size": 64,
1043
+ "bits": 3
1044
+ },
1045
+ "model.layers.35.block_sparse_moe.switch_mlp.up_proj": {
1046
+ "group_size": 64,
1047
+ "bits": 3
1048
+ },
1049
+ "model.layers.35.block_sparse_moe.switch_mlp.down_proj": {
1050
+ "group_size": 64,
1051
+ "bits": 3
1052
+ },
1053
+ "model.layers.36.self_attn.q_proj": {
1054
+ "group_size": 64,
1055
+ "bits": 8
1056
+ },
1057
+ "model.layers.36.self_attn.k_proj": {
1058
+ "group_size": 64,
1059
+ "bits": 8
1060
+ },
1061
+ "model.layers.36.self_attn.o_proj": {
1062
+ "group_size": 64,
1063
+ "bits": 8
1064
+ },
1065
+ "model.layers.36.block_sparse_moe.switch_mlp.gate_proj": {
1066
+ "group_size": 64,
1067
+ "bits": 3
1068
+ },
1069
+ "model.layers.36.block_sparse_moe.switch_mlp.up_proj": {
1070
+ "group_size": 64,
1071
+ "bits": 3
1072
+ },
1073
+ "model.layers.36.block_sparse_moe.switch_mlp.down_proj": {
1074
+ "group_size": 64,
1075
+ "bits": 3
1076
+ },
1077
+ "model.layers.37.self_attn.q_proj": {
1078
+ "group_size": 64,
1079
+ "bits": 8
1080
+ },
1081
+ "model.layers.37.self_attn.k_proj": {
1082
+ "group_size": 64,
1083
+ "bits": 8
1084
+ },
1085
+ "model.layers.37.self_attn.o_proj": {
1086
+ "group_size": 64,
1087
+ "bits": 8
1088
+ },
1089
+ "model.layers.37.block_sparse_moe.switch_mlp.gate_proj": {
1090
+ "group_size": 64,
1091
+ "bits": 3
1092
+ },
1093
+ "model.layers.37.block_sparse_moe.switch_mlp.up_proj": {
1094
+ "group_size": 64,
1095
+ "bits": 3
1096
+ },
1097
+ "model.layers.37.block_sparse_moe.switch_mlp.down_proj": {
1098
+ "group_size": 64,
1099
+ "bits": 3
1100
+ },
1101
+ "model.layers.38.self_attn.q_proj": {
1102
+ "group_size": 64,
1103
+ "bits": 8
1104
+ },
1105
+ "model.layers.38.self_attn.k_proj": {
1106
+ "group_size": 64,
1107
+ "bits": 8
1108
+ },
1109
+ "model.layers.38.self_attn.o_proj": {
1110
+ "group_size": 64,
1111
+ "bits": 8
1112
+ },
1113
+ "model.layers.38.block_sparse_moe.switch_mlp.gate_proj": {
1114
+ "group_size": 64,
1115
+ "bits": 3
1116
+ },
1117
+ "model.layers.38.block_sparse_moe.switch_mlp.up_proj": {
1118
+ "group_size": 64,
1119
+ "bits": 3
1120
+ },
1121
+ "model.layers.38.block_sparse_moe.switch_mlp.down_proj": {
1122
+ "group_size": 64,
1123
+ "bits": 3
1124
+ },
1125
+ "model.layers.39.self_attn.q_proj": {
1126
+ "group_size": 64,
1127
+ "bits": 8
1128
+ },
1129
+ "model.layers.39.self_attn.k_proj": {
1130
+ "group_size": 64,
1131
+ "bits": 8
1132
+ },
1133
+ "model.layers.39.self_attn.o_proj": {
1134
+ "group_size": 64,
1135
+ "bits": 8
1136
+ },
1137
+ "model.layers.39.block_sparse_moe.switch_mlp.gate_proj": {
1138
+ "group_size": 64,
1139
+ "bits": 3
1140
+ },
1141
+ "model.layers.39.block_sparse_moe.switch_mlp.up_proj": {
1142
+ "group_size": 64,
1143
+ "bits": 3
1144
+ },
1145
+ "model.layers.39.block_sparse_moe.switch_mlp.down_proj": {
1146
+ "group_size": 64,
1147
+ "bits": 4
1148
+ },
1149
+ "model.layers.40.self_attn.q_proj": {
1150
+ "group_size": 64,
1151
+ "bits": 8
1152
+ },
1153
+ "model.layers.40.self_attn.k_proj": {
1154
+ "group_size": 64,
1155
+ "bits": 8
1156
+ },
1157
+ "model.layers.40.self_attn.o_proj": {
1158
+ "group_size": 64,
1159
+ "bits": 8
1160
+ },
1161
+ "model.layers.40.block_sparse_moe.switch_mlp.gate_proj": {
1162
+ "group_size": 64,
1163
+ "bits": 3
1164
+ },
1165
+ "model.layers.40.block_sparse_moe.switch_mlp.up_proj": {
1166
+ "group_size": 64,
1167
+ "bits": 3
1168
+ },
1169
+ "model.layers.40.block_sparse_moe.switch_mlp.down_proj": {
1170
+ "group_size": 64,
1171
+ "bits": 3
1172
+ },
1173
+ "model.layers.41.self_attn.q_proj": {
1174
+ "group_size": 64,
1175
+ "bits": 8
1176
+ },
1177
+ "model.layers.41.self_attn.k_proj": {
1178
+ "group_size": 64,
1179
+ "bits": 8
1180
+ },
1181
+ "model.layers.41.self_attn.o_proj": {
1182
+ "group_size": 64,
1183
+ "bits": 8
1184
+ },
1185
+ "model.layers.41.block_sparse_moe.switch_mlp.gate_proj": {
1186
+ "group_size": 64,
1187
+ "bits": 4
1188
+ },
1189
+ "model.layers.41.block_sparse_moe.switch_mlp.up_proj": {
1190
+ "group_size": 64,
1191
+ "bits": 3
1192
+ },
1193
+ "model.layers.41.block_sparse_moe.switch_mlp.down_proj": {
1194
+ "group_size": 64,
1195
+ "bits": 3
1196
+ },
1197
+ "model.layers.42.self_attn.q_proj": {
1198
+ "group_size": 64,
1199
+ "bits": 8
1200
+ },
1201
+ "model.layers.42.self_attn.k_proj": {
1202
+ "group_size": 64,
1203
+ "bits": 8
1204
+ },
1205
+ "model.layers.42.self_attn.o_proj": {
1206
+ "group_size": 64,
1207
+ "bits": 8
1208
+ },
1209
+ "model.layers.42.block_sparse_moe.switch_mlp.gate_proj": {
1210
+ "group_size": 64,
1211
+ "bits": 4
1212
+ },
1213
+ "model.layers.42.block_sparse_moe.switch_mlp.up_proj": {
1214
+ "group_size": 64,
1215
+ "bits": 4
1216
+ },
1217
+ "model.layers.42.block_sparse_moe.switch_mlp.down_proj": {
1218
+ "group_size": 64,
1219
+ "bits": 4
1220
+ },
1221
+ "model.layers.43.self_attn.q_proj": {
1222
+ "group_size": 64,
1223
+ "bits": 8
1224
+ },
1225
+ "model.layers.43.self_attn.k_proj": {
1226
+ "group_size": 64,
1227
+ "bits": 8
1228
+ },
1229
+ "model.layers.43.self_attn.o_proj": {
1230
+ "group_size": 64,
1231
+ "bits": 8
1232
+ },
1233
+ "model.layers.43.block_sparse_moe.switch_mlp.gate_proj": {
1234
+ "group_size": 64,
1235
+ "bits": 4
1236
+ },
1237
+ "model.layers.43.block_sparse_moe.switch_mlp.up_proj": {
1238
+ "group_size": 64,
1239
+ "bits": 4
1240
+ },
1241
+ "model.layers.43.block_sparse_moe.switch_mlp.down_proj": {
1242
+ "group_size": 64,
1243
+ "bits": 4
1244
+ },
1245
+ "model.layers.44.self_attn.q_proj": {
1246
+ "group_size": 64,
1247
+ "bits": 8
1248
+ },
1249
+ "model.layers.44.self_attn.o_proj": {
1250
+ "group_size": 64,
1251
+ "bits": 8
1252
+ },
1253
+ "model.layers.44.block_sparse_moe.switch_mlp.gate_proj": {
1254
+ "group_size": 64,
1255
+ "bits": 4
1256
+ },
1257
+ "model.layers.44.block_sparse_moe.switch_mlp.up_proj": {
1258
+ "group_size": 64,
1259
+ "bits": 4
1260
+ },
1261
+ "model.layers.44.block_sparse_moe.switch_mlp.down_proj": {
1262
+ "group_size": 64,
1263
+ "bits": 4
1264
+ },
1265
+ "model.layers.45.block_sparse_moe.switch_mlp.gate_proj": {
1266
+ "group_size": 64,
1267
+ "bits": 8
1268
+ },
1269
+ "model.layers.45.block_sparse_moe.switch_mlp.up_proj": {
1270
+ "group_size": 64,
1271
+ "bits": 8
1272
+ },
1273
+ "model.layers.45.block_sparse_moe.switch_mlp.down_proj": {
1274
+ "group_size": 64,
1275
+ "bits": 8
1276
+ },
1277
+ "model.layers.46.block_sparse_moe.switch_mlp.gate_proj": {
1278
+ "group_size": 64,
1279
+ "bits": 8
1280
+ },
1281
+ "model.layers.46.block_sparse_moe.switch_mlp.up_proj": {
1282
+ "group_size": 64,
1283
+ "bits": 8
1284
+ },
1285
+ "model.layers.46.block_sparse_moe.switch_mlp.down_proj": {
1286
+ "group_size": 64,
1287
+ "bits": 8
1288
+ },
1289
+ "model.layers.47.block_sparse_moe.switch_mlp.gate_proj": {
1290
+ "group_size": 64,
1291
+ "bits": 8
1292
+ },
1293
+ "model.layers.47.block_sparse_moe.switch_mlp.up_proj": {
1294
+ "group_size": 64,
1295
+ "bits": 8
1296
+ },
1297
+ "model.layers.47.block_sparse_moe.switch_mlp.down_proj": {
1298
+ "group_size": 64,
1299
+ "bits": 8
1300
+ },
1301
+ "model.layers.48.block_sparse_moe.switch_mlp.gate_proj": {
1302
+ "group_size": 64,
1303
+ "bits": 8
1304
+ },
1305
+ "model.layers.48.block_sparse_moe.switch_mlp.up_proj": {
1306
+ "group_size": 64,
1307
+ "bits": 8
1308
+ },
1309
+ "model.layers.48.block_sparse_moe.switch_mlp.down_proj": {
1310
+ "group_size": 64,
1311
+ "bits": 8
1312
+ },
1313
+ "model.layers.49.block_sparse_moe.switch_mlp.gate_proj": {
1314
+ "group_size": 64,
1315
+ "bits": 8
1316
+ },
1317
+ "model.layers.49.block_sparse_moe.switch_mlp.up_proj": {
1318
+ "group_size": 64,
1319
+ "bits": 8
1320
+ },
1321
+ "model.layers.49.block_sparse_moe.switch_mlp.down_proj": {
1322
+ "group_size": 64,
1323
+ "bits": 8
1324
+ },
1325
+ "model.layers.50.block_sparse_moe.switch_mlp.gate_proj": {
1326
+ "group_size": 64,
1327
+ "bits": 8
1328
+ },
1329
+ "model.layers.50.block_sparse_moe.switch_mlp.up_proj": {
1330
+ "group_size": 64,
1331
+ "bits": 8
1332
+ },
1333
+ "model.layers.50.block_sparse_moe.switch_mlp.down_proj": {
1334
+ "group_size": 64,
1335
+ "bits": 8
1336
+ },
1337
+ "model.layers.51.block_sparse_moe.switch_mlp.gate_proj": {
1338
+ "group_size": 64,
1339
+ "bits": 8
1340
+ },
1341
+ "model.layers.51.block_sparse_moe.switch_mlp.up_proj": {
1342
+ "group_size": 64,
1343
+ "bits": 8
1344
+ },
1345
+ "model.layers.51.block_sparse_moe.switch_mlp.down_proj": {
1346
+ "group_size": 64,
1347
+ "bits": 8
1348
+ },
1349
+ "model.layers.52.block_sparse_moe.switch_mlp.gate_proj": {
1350
+ "group_size": 64,
1351
+ "bits": 8
1352
+ },
1353
+ "model.layers.52.block_sparse_moe.switch_mlp.up_proj": {
1354
+ "group_size": 64,
1355
+ "bits": 8
1356
+ },
1357
+ "model.layers.52.block_sparse_moe.switch_mlp.down_proj": {
1358
+ "group_size": 64,
1359
+ "bits": 8
1360
+ },
1361
+ "model.layers.53.block_sparse_moe.switch_mlp.gate_proj": {
1362
+ "group_size": 64,
1363
+ "bits": 8
1364
+ },
1365
+ "model.layers.53.block_sparse_moe.switch_mlp.up_proj": {
1366
+ "group_size": 64,
1367
+ "bits": 8
1368
+ },
1369
+ "model.layers.53.block_sparse_moe.switch_mlp.down_proj": {
1370
+ "group_size": 64,
1371
+ "bits": 8
1372
+ },
1373
+ "model.layers.54.block_sparse_moe.switch_mlp.gate_proj": {
1374
+ "group_size": 64,
1375
+ "bits": 8
1376
+ },
1377
+ "model.layers.54.block_sparse_moe.switch_mlp.up_proj": {
1378
+ "group_size": 64,
1379
+ "bits": 8
1380
+ },
1381
+ "model.layers.54.block_sparse_moe.switch_mlp.down_proj": {
1382
+ "group_size": 64,
1383
+ "bits": 8
1384
+ },
1385
+ "model.layers.55.block_sparse_moe.switch_mlp.gate_proj": {
1386
+ "group_size": 64,
1387
+ "bits": 8
1388
+ },
1389
+ "model.layers.55.block_sparse_moe.switch_mlp.up_proj": {
1390
+ "group_size": 64,
1391
+ "bits": 8
1392
+ },
1393
+ "model.layers.55.block_sparse_moe.switch_mlp.down_proj": {
1394
+ "group_size": 64,
1395
+ "bits": 8
1396
+ },
1397
+ "model.layers.56.block_sparse_moe.switch_mlp.gate_proj": {
1398
+ "group_size": 64,
1399
+ "bits": 8
1400
+ },
1401
+ "model.layers.56.block_sparse_moe.switch_mlp.up_proj": {
1402
+ "group_size": 64,
1403
+ "bits": 8
1404
+ },
1405
+ "model.layers.56.block_sparse_moe.switch_mlp.down_proj": {
1406
+ "group_size": 64,
1407
+ "bits": 8
1408
+ },
1409
+ "model.layers.57.block_sparse_moe.switch_mlp.gate_proj": {
1410
+ "group_size": 64,
1411
+ "bits": 8
1412
+ },
1413
+ "model.layers.57.block_sparse_moe.switch_mlp.up_proj": {
1414
+ "group_size": 64,
1415
+ "bits": 8
1416
+ },
1417
+ "model.layers.57.block_sparse_moe.switch_mlp.down_proj": {
1418
+ "group_size": 64,
1419
+ "bits": 8
1420
+ },
1421
+ "model.layers.58.block_sparse_moe.switch_mlp.gate_proj": {
1422
+ "group_size": 64,
1423
+ "bits": 8
1424
+ },
1425
+ "model.layers.58.block_sparse_moe.switch_mlp.up_proj": {
1426
+ "group_size": 64,
1427
+ "bits": 8
1428
+ },
1429
+ "model.layers.58.block_sparse_moe.switch_mlp.down_proj": {
1430
+ "group_size": 64,
1431
+ "bits": 8
1432
+ },
1433
+ "model.layers.59.block_sparse_moe.switch_mlp.gate_proj": {
1434
+ "group_size": 64,
1435
+ "bits": 8
1436
+ },
1437
+ "model.layers.59.block_sparse_moe.switch_mlp.up_proj": {
1438
+ "group_size": 64,
1439
+ "bits": 8
1440
+ },
1441
+ "model.layers.59.block_sparse_moe.switch_mlp.down_proj": {
1442
+ "group_size": 64,
1443
+ "bits": 8
1444
+ },
1445
+ "model.layers.60.block_sparse_moe.switch_mlp.gate_proj": {
1446
+ "group_size": 64,
1447
+ "bits": 8
1448
+ },
1449
+ "model.layers.60.block_sparse_moe.switch_mlp.up_proj": {
1450
+ "group_size": 64,
1451
+ "bits": 8
1452
+ },
1453
+ "model.layers.60.block_sparse_moe.switch_mlp.down_proj": {
1454
+ "group_size": 64,
1455
+ "bits": 8
1456
+ },
1457
+ "model.layers.61.block_sparse_moe.switch_mlp.gate_proj": {
1458
+ "group_size": 64,
1459
+ "bits": 8
1460
+ },
1461
+ "model.layers.61.block_sparse_moe.switch_mlp.up_proj": {
1462
+ "group_size": 64,
1463
+ "bits": 8
1464
+ },
1465
+ "lm_head": {
1466
+ "group_size": 64,
1467
+ "bits": 8
1468
+ }
1469
+ },
1470
+ "quantization_config": {
1471
+ "group_size": 64,
1472
+ "bits": 4,
1473
+ "mode": "affine",
1474
+ "model.embed_tokens": {
1475
+ "group_size": 64,
1476
+ "bits": 8
1477
+ },
1478
+ "model.layers.0.self_attn.q_proj": {
1479
+ "group_size": 64,
1480
+ "bits": 8
1481
+ },
1482
+ "model.layers.0.self_attn.k_proj": {
1483
+ "group_size": 64,
1484
+ "bits": 8
1485
+ },
1486
+ "model.layers.0.self_attn.v_proj": {
1487
+ "group_size": 64,
1488
+ "bits": 8
1489
+ },
1490
+ "model.layers.0.self_attn.o_proj": {
1491
+ "group_size": 64,
1492
+ "bits": 8
1493
+ },
1494
+ "model.layers.0.block_sparse_moe.switch_mlp.gate_proj": {
1495
+ "group_size": 64,
1496
+ "bits": 8
1497
+ },
1498
+ "model.layers.0.block_sparse_moe.switch_mlp.up_proj": {
1499
+ "group_size": 64,
1500
+ "bits": 8
1501
+ },
1502
+ "model.layers.0.block_sparse_moe.switch_mlp.down_proj": {
1503
+ "group_size": 64,
1504
+ "bits": 8
1505
+ },
1506
+ "model.layers.1.block_sparse_moe.switch_mlp.gate_proj": {
1507
+ "group_size": 64,
1508
+ "bits": 6
1509
+ },
1510
+ "model.layers.1.block_sparse_moe.switch_mlp.up_proj": {
1511
+ "group_size": 64,
1512
+ "bits": 6
1513
+ },
1514
+ "model.layers.1.block_sparse_moe.switch_mlp.down_proj": {
1515
+ "group_size": 64,
1516
+ "bits": 8
1517
+ },
1518
+ "model.layers.2.self_attn.q_proj": {
1519
+ "group_size": 64,
1520
+ "bits": 8
1521
+ },
1522
+ "model.layers.2.self_attn.k_proj": {
1523
+ "group_size": 64,
1524
+ "bits": 8
1525
+ },
1526
+ "model.layers.2.self_attn.v_proj": {
1527
+ "group_size": 64,
1528
+ "bits": 8
1529
+ },
1530
+ "model.layers.2.self_attn.o_proj": {
1531
+ "group_size": 64,
1532
+ "bits": 8
1533
+ },
1534
+ "model.layers.2.block_sparse_moe.switch_mlp.gate_proj": {
1535
+ "group_size": 64,
1536
+ "bits": 5
1537
+ },
1538
+ "model.layers.2.block_sparse_moe.switch_mlp.up_proj": {
1539
+ "group_size": 64,
1540
+ "bits": 6
1541
+ },
1542
+ "model.layers.2.block_sparse_moe.switch_mlp.down_proj": {
1543
+ "group_size": 64,
1544
+ "bits": 6
1545
+ },
1546
+ "model.layers.3.self_attn.q_proj": {
1547
+ "group_size": 64,
1548
+ "bits": 8
1549
+ },
1550
+ "model.layers.3.self_attn.v_proj": {
1551
+ "group_size": 64,
1552
+ "bits": 8
1553
+ },
1554
+ "model.layers.3.self_attn.o_proj": {
1555
+ "group_size": 64,
1556
+ "bits": 8
1557
+ },
1558
+ "model.layers.3.block_sparse_moe.switch_mlp.gate_proj": {
1559
+ "group_size": 64,
1560
+ "bits": 6
1561
+ },
1562
+ "model.layers.3.block_sparse_moe.switch_mlp.up_proj": {
1563
+ "group_size": 64,
1564
+ "bits": 5
1565
+ },
1566
+ "model.layers.3.block_sparse_moe.switch_mlp.down_proj": {
1567
+ "group_size": 64,
1568
+ "bits": 6
1569
+ },
1570
+ "model.layers.4.self_attn.q_proj": {
1571
+ "group_size": 64,
1572
+ "bits": 8
1573
+ },
1574
+ "model.layers.4.self_attn.k_proj": {
1575
+ "group_size": 64,
1576
+ "bits": 8
1577
+ },
1578
+ "model.layers.4.self_attn.o_proj": {
1579
+ "group_size": 64,
1580
+ "bits": 8
1581
+ },
1582
+ "model.layers.4.block_sparse_moe.switch_mlp.gate_proj": {
1583
+ "group_size": 64,
1584
+ "bits": 5
1585
+ },
1586
+ "model.layers.4.block_sparse_moe.switch_mlp.up_proj": {
1587
+ "group_size": 64,
1588
+ "bits": 4
1589
+ },
1590
+ "model.layers.4.block_sparse_moe.switch_mlp.down_proj": {
1591
+ "group_size": 64,
1592
+ "bits": 5
1593
+ },
1594
+ "model.layers.5.self_attn.q_proj": {
1595
+ "group_size": 64,
1596
+ "bits": 8
1597
+ },
1598
+ "model.layers.5.self_attn.k_proj": {
1599
+ "group_size": 64,
1600
+ "bits": 8
1601
+ },
1602
+ "model.layers.5.self_attn.o_proj": {
1603
+ "group_size": 64,
1604
+ "bits": 6
1605
+ },
1606
+ "model.layers.5.block_sparse_moe.switch_mlp.gate_proj": {
1607
+ "group_size": 64,
1608
+ "bits": 4
1609
+ },
1610
+ "model.layers.5.block_sparse_moe.switch_mlp.up_proj": {
1611
+ "group_size": 64,
1612
+ "bits": 4
1613
+ },
1614
+ "model.layers.5.block_sparse_moe.switch_mlp.down_proj": {
1615
+ "group_size": 64,
1616
+ "bits": 6
1617
+ },
1618
+ "model.layers.6.self_attn.q_proj": {
1619
+ "group_size": 64,
1620
+ "bits": 5
1621
+ },
1622
+ "model.layers.6.self_attn.k_proj": {
1623
+ "group_size": 64,
1624
+ "bits": 8
1625
+ },
1626
+ "model.layers.6.self_attn.v_proj": {
1627
+ "group_size": 64,
1628
+ "bits": 8
1629
+ },
1630
+ "model.layers.6.self_attn.o_proj": {
1631
+ "group_size": 64,
1632
+ "bits": 6
1633
+ },
1634
+ "model.layers.6.block_sparse_moe.switch_mlp.gate_proj": {
1635
+ "group_size": 64,
1636
+ "bits": 4
1637
+ },
1638
+ "model.layers.6.block_sparse_moe.switch_mlp.up_proj": {
1639
+ "group_size": 64,
1640
+ "bits": 4
1641
+ },
1642
+ "model.layers.6.block_sparse_moe.switch_mlp.down_proj": {
1643
+ "group_size": 64,
1644
+ "bits": 4
1645
+ },
1646
+ "model.layers.7.self_attn.q_proj": {
1647
+ "group_size": 64,
1648
+ "bits": 8
1649
+ },
1650
+ "model.layers.7.self_attn.k_proj": {
1651
+ "group_size": 64,
1652
+ "bits": 5
1653
+ },
1654
+ "model.layers.7.self_attn.v_proj": {
1655
+ "group_size": 64,
1656
+ "bits": 8
1657
+ },
1658
+ "model.layers.7.self_attn.o_proj": {
1659
+ "group_size": 64,
1660
+ "bits": 6
1661
+ },
1662
+ "model.layers.7.block_sparse_moe.switch_mlp.gate_proj": {
1663
+ "group_size": 64,
1664
+ "bits": 4
1665
+ },
1666
+ "model.layers.7.block_sparse_moe.switch_mlp.up_proj": {
1667
+ "group_size": 64,
1668
+ "bits": 5
1669
+ },
1670
+ "model.layers.7.block_sparse_moe.switch_mlp.down_proj": {
1671
+ "group_size": 64,
1672
+ "bits": 5
1673
+ },
1674
+ "model.layers.8.self_attn.q_proj": {
1675
+ "group_size": 64,
1676
+ "bits": 6
1677
+ },
1678
+ "model.layers.8.self_attn.k_proj": {
1679
+ "group_size": 64,
1680
+ "bits": 8
1681
+ },
1682
+ "model.layers.8.self_attn.v_proj": {
1683
+ "group_size": 64,
1684
+ "bits": 8
1685
+ },
1686
+ "model.layers.8.self_attn.o_proj": {
1687
+ "group_size": 64,
1688
+ "bits": 6
1689
+ },
1690
+ "model.layers.8.block_sparse_moe.switch_mlp.gate_proj": {
1691
+ "group_size": 64,
1692
+ "bits": 4
1693
+ },
1694
+ "model.layers.8.block_sparse_moe.switch_mlp.up_proj": {
1695
+ "group_size": 64,
1696
+ "bits": 3
1697
+ },
1698
+ "model.layers.8.block_sparse_moe.switch_mlp.down_proj": {
1699
+ "group_size": 64,
1700
+ "bits": 5
1701
+ },
1702
+ "model.layers.9.self_attn.q_proj": {
1703
+ "group_size": 64,
1704
+ "bits": 6
1705
+ },
1706
+ "model.layers.9.self_attn.k_proj": {
1707
+ "group_size": 64,
1708
+ "bits": 8
1709
+ },
1710
+ "model.layers.9.self_attn.v_proj": {
1711
+ "group_size": 64,
1712
+ "bits": 8
1713
+ },
1714
+ "model.layers.9.self_attn.o_proj": {
1715
+ "group_size": 64,
1716
+ "bits": 6
1717
+ },
1718
+ "model.layers.9.block_sparse_moe.switch_mlp.gate_proj": {
1719
+ "group_size": 64,
1720
+ "bits": 3
1721
+ },
1722
+ "model.layers.9.block_sparse_moe.switch_mlp.up_proj": {
1723
+ "group_size": 64,
1724
+ "bits": 3
1725
+ },
1726
+ "model.layers.9.block_sparse_moe.switch_mlp.down_proj": {
1727
+ "group_size": 64,
1728
+ "bits": 4
1729
+ },
1730
+ "model.layers.10.self_attn.q_proj": {
1731
+ "group_size": 64,
1732
+ "bits": 5
1733
+ },
1734
+ "model.layers.10.self_attn.k_proj": {
1735
+ "group_size": 64,
1736
+ "bits": 6
1737
+ },
1738
+ "model.layers.10.self_attn.v_proj": {
1739
+ "group_size": 64,
1740
+ "bits": 8
1741
+ },
1742
+ "model.layers.10.self_attn.o_proj": {
1743
+ "group_size": 64,
1744
+ "bits": 6
1745
+ },
1746
+ "model.layers.10.block_sparse_moe.switch_mlp.gate_proj": {
1747
+ "group_size": 64,
1748
+ "bits": 4
1749
+ },
1750
+ "model.layers.10.block_sparse_moe.switch_mlp.up_proj": {
1751
+ "group_size": 64,
1752
+ "bits": 3
1753
+ },
1754
+ "model.layers.10.block_sparse_moe.switch_mlp.down_proj": {
1755
+ "group_size": 64,
1756
+ "bits": 4
1757
+ },
1758
+ "model.layers.11.self_attn.q_proj": {
1759
+ "group_size": 64,
1760
+ "bits": 6
1761
+ },
1762
+ "model.layers.11.self_attn.k_proj": {
1763
+ "group_size": 64,
1764
+ "bits": 8
1765
+ },
1766
+ "model.layers.11.self_attn.o_proj": {
1767
+ "group_size": 64,
1768
+ "bits": 6
1769
+ },
1770
+ "model.layers.11.block_sparse_moe.switch_mlp.gate_proj": {
1771
+ "group_size": 64,
1772
+ "bits": 3
1773
+ },
1774
+ "model.layers.11.block_sparse_moe.switch_mlp.up_proj": {
1775
+ "group_size": 64,
1776
+ "bits": 3
1777
+ },
1778
+ "model.layers.11.block_sparse_moe.switch_mlp.down_proj": {
1779
+ "group_size": 64,
1780
+ "bits": 4
1781
+ },
1782
+ "model.layers.12.self_attn.q_proj": {
1783
+ "group_size": 64,
1784
+ "bits": 5
1785
+ },
1786
+ "model.layers.12.self_attn.k_proj": {
1787
+ "group_size": 64,
1788
+ "bits": 8
1789
+ },
1790
+ "model.layers.12.self_attn.v_proj": {
1791
+ "group_size": 64,
1792
+ "bits": 8
1793
+ },
1794
+ "model.layers.12.self_attn.o_proj": {
1795
+ "group_size": 64,
1796
+ "bits": 5
1797
+ },
1798
+ "model.layers.12.block_sparse_moe.switch_mlp.gate_proj": {
1799
+ "group_size": 64,
1800
+ "bits": 3
1801
+ },
1802
+ "model.layers.12.block_sparse_moe.switch_mlp.up_proj": {
1803
+ "group_size": 64,
1804
+ "bits": 3
1805
+ },
1806
+ "model.layers.12.block_sparse_moe.switch_mlp.down_proj": {
1807
+ "group_size": 64,
1808
+ "bits": 4
1809
+ },
1810
+ "model.layers.13.self_attn.q_proj": {
1811
+ "group_size": 64,
1812
+ "bits": 6
1813
+ },
1814
+ "model.layers.13.self_attn.k_proj": {
1815
+ "group_size": 64,
1816
+ "bits": 8
1817
+ },
1818
+ "model.layers.13.self_attn.v_proj": {
1819
+ "group_size": 64,
1820
+ "bits": 8
1821
+ },
1822
+ "model.layers.13.self_attn.o_proj": {
1823
+ "group_size": 64,
1824
+ "bits": 6
1825
+ },
1826
+ "model.layers.13.block_sparse_moe.switch_mlp.gate_proj": {
1827
+ "group_size": 64,
1828
+ "bits": 3
1829
+ },
1830
+ "model.layers.13.block_sparse_moe.switch_mlp.up_proj": {
1831
+ "group_size": 64,
1832
+ "bits": 3
1833
+ },
1834
+ "model.layers.13.block_sparse_moe.switch_mlp.down_proj": {
1835
+ "group_size": 64,
1836
+ "bits": 3
1837
+ },
1838
+ "model.layers.14.self_attn.q_proj": {
1839
+ "group_size": 64,
1840
+ "bits": 6
1841
+ },
1842
+ "model.layers.14.self_attn.k_proj": {
1843
+ "group_size": 64,
1844
+ "bits": 8
1845
+ },
1846
+ "model.layers.14.self_attn.v_proj": {
1847
+ "group_size": 64,
1848
+ "bits": 8
1849
+ },
1850
+ "model.layers.14.self_attn.o_proj": {
1851
+ "group_size": 64,
1852
+ "bits": 6
1853
+ },
1854
+ "model.layers.14.block_sparse_moe.switch_mlp.gate_proj": {
1855
+ "group_size": 64,
1856
+ "bits": 3
1857
+ },
1858
+ "model.layers.14.block_sparse_moe.switch_mlp.up_proj": {
1859
+ "group_size": 64,
1860
+ "bits": 3
1861
+ },
1862
+ "model.layers.14.block_sparse_moe.switch_mlp.down_proj": {
1863
+ "group_size": 64,
1864
+ "bits": 3
1865
+ },
1866
+ "model.layers.15.self_attn.q_proj": {
1867
+ "group_size": 64,
1868
+ "bits": 5
1869
+ },
1870
+ "model.layers.15.self_attn.k_proj": {
1871
+ "group_size": 64,
1872
+ "bits": 8
1873
+ },
1874
+ "model.layers.15.self_attn.v_proj": {
1875
+ "group_size": 64,
1876
+ "bits": 8
1877
+ },
1878
+ "model.layers.15.self_attn.o_proj": {
1879
+ "group_size": 64,
1880
+ "bits": 6
1881
+ },
1882
+ "model.layers.15.block_sparse_moe.switch_mlp.gate_proj": {
1883
+ "group_size": 64,
1884
+ "bits": 3
1885
+ },
1886
+ "model.layers.15.block_sparse_moe.switch_mlp.up_proj": {
1887
+ "group_size": 64,
1888
+ "bits": 3
1889
+ },
1890
+ "model.layers.15.block_sparse_moe.switch_mlp.down_proj": {
1891
+ "group_size": 64,
1892
+ "bits": 3
1893
+ },
1894
+ "model.layers.16.self_attn.q_proj": {
1895
+ "group_size": 64,
1896
+ "bits": 6
1897
+ },
1898
+ "model.layers.16.self_attn.k_proj": {
1899
+ "group_size": 64,
1900
+ "bits": 8
1901
+ },
1902
+ "model.layers.16.self_attn.v_proj": {
1903
+ "group_size": 64,
1904
+ "bits": 8
1905
+ },
1906
+ "model.layers.16.self_attn.o_proj": {
1907
+ "group_size": 64,
1908
+ "bits": 8
1909
+ },
1910
+ "model.layers.16.block_sparse_moe.switch_mlp.gate_proj": {
1911
+ "group_size": 64,
1912
+ "bits": 3
1913
+ },
1914
+ "model.layers.16.block_sparse_moe.switch_mlp.up_proj": {
1915
+ "group_size": 64,
1916
+ "bits": 3
1917
+ },
1918
+ "model.layers.16.block_sparse_moe.switch_mlp.down_proj": {
1919
+ "group_size": 64,
1920
+ "bits": 3
1921
+ },
1922
+ "model.layers.17.self_attn.q_proj": {
1923
+ "group_size": 64,
1924
+ "bits": 5
1925
+ },
1926
+ "model.layers.17.self_attn.k_proj": {
1927
+ "group_size": 64,
1928
+ "bits": 8
1929
+ },
1930
+ "model.layers.17.self_attn.v_proj": {
1931
+ "group_size": 64,
1932
+ "bits": 8
1933
+ },
1934
+ "model.layers.17.self_attn.o_proj": {
1935
+ "group_size": 64,
1936
+ "bits": 6
1937
+ },
1938
+ "model.layers.17.block_sparse_moe.switch_mlp.gate_proj": {
1939
+ "group_size": 64,
1940
+ "bits": 3
1941
+ },
1942
+ "model.layers.17.block_sparse_moe.switch_mlp.up_proj": {
1943
+ "group_size": 64,
1944
+ "bits": 3
1945
+ },
1946
+ "model.layers.17.block_sparse_moe.switch_mlp.down_proj": {
1947
+ "group_size": 64,
1948
+ "bits": 3
1949
+ },
1950
+ "model.layers.18.self_attn.q_proj": {
1951
+ "group_size": 64,
1952
+ "bits": 6
1953
+ },
1954
+ "model.layers.18.self_attn.k_proj": {
1955
+ "group_size": 64,
1956
+ "bits": 8
1957
+ },
1958
+ "model.layers.18.self_attn.v_proj": {
1959
+ "group_size": 64,
1960
+ "bits": 8
1961
+ },
1962
+ "model.layers.18.self_attn.o_proj": {
1963
+ "group_size": 64,
1964
+ "bits": 6
1965
+ },
1966
+ "model.layers.18.block_sparse_moe.switch_mlp.gate_proj": {
1967
+ "group_size": 64,
1968
+ "bits": 3
1969
+ },
1970
+ "model.layers.18.block_sparse_moe.switch_mlp.up_proj": {
1971
+ "group_size": 64,
1972
+ "bits": 3
1973
+ },
1974
+ "model.layers.18.block_sparse_moe.switch_mlp.down_proj": {
1975
+ "group_size": 64,
1976
+ "bits": 3
1977
+ },
1978
+ "model.layers.19.self_attn.q_proj": {
1979
+ "group_size": 64,
1980
+ "bits": 6
1981
+ },
1982
+ "model.layers.19.self_attn.k_proj": {
1983
+ "group_size": 64,
1984
+ "bits": 8
1985
+ },
1986
+ "model.layers.19.self_attn.v_proj": {
1987
+ "group_size": 64,
1988
+ "bits": 8
1989
+ },
1990
+ "model.layers.19.self_attn.o_proj": {
1991
+ "group_size": 64,
1992
+ "bits": 6
1993
+ },
1994
+ "model.layers.19.block_sparse_moe.switch_mlp.gate_proj": {
1995
+ "group_size": 64,
1996
+ "bits": 3
1997
+ },
1998
+ "model.layers.19.block_sparse_moe.switch_mlp.up_proj": {
1999
+ "group_size": 64,
2000
+ "bits": 3
2001
+ },
2002
+ "model.layers.19.block_sparse_moe.switch_mlp.down_proj": {
2003
+ "group_size": 64,
2004
+ "bits": 3
2005
+ },
2006
+ "model.layers.20.self_attn.q_proj": {
2007
+ "group_size": 64,
2008
+ "bits": 6
2009
+ },
2010
+ "model.layers.20.self_attn.k_proj": {
2011
+ "group_size": 64,
2012
+ "bits": 8
2013
+ },
2014
+ "model.layers.20.self_attn.v_proj": {
2015
+ "group_size": 64,
2016
+ "bits": 8
2017
+ },
2018
+ "model.layers.20.self_attn.o_proj": {
2019
+ "group_size": 64,
2020
+ "bits": 6
2021
+ },
2022
+ "model.layers.20.block_sparse_moe.switch_mlp.gate_proj": {
2023
+ "group_size": 64,
2024
+ "bits": 3
2025
+ },
2026
+ "model.layers.20.block_sparse_moe.switch_mlp.up_proj": {
2027
+ "group_size": 64,
2028
+ "bits": 3
2029
+ },
2030
+ "model.layers.20.block_sparse_moe.switch_mlp.down_proj": {
2031
+ "group_size": 64,
2032
+ "bits": 3
2033
+ },
2034
+ "model.layers.21.self_attn.q_proj": {
2035
+ "group_size": 64,
2036
+ "bits": 5
2037
+ },
2038
+ "model.layers.21.self_attn.k_proj": {
2039
+ "group_size": 64,
2040
+ "bits": 8
2041
+ },
2042
+ "model.layers.21.self_attn.v_proj": {
2043
+ "group_size": 64,
2044
+ "bits": 8
2045
+ },
2046
+ "model.layers.21.self_attn.o_proj": {
2047
+ "group_size": 64,
2048
+ "bits": 6
2049
+ },
2050
+ "model.layers.21.block_sparse_moe.switch_mlp.gate_proj": {
2051
+ "group_size": 64,
2052
+ "bits": 3
2053
+ },
2054
+ "model.layers.21.block_sparse_moe.switch_mlp.up_proj": {
2055
+ "group_size": 64,
2056
+ "bits": 3
2057
+ },
2058
+ "model.layers.21.block_sparse_moe.switch_mlp.down_proj": {
2059
+ "group_size": 64,
2060
+ "bits": 3
2061
+ },
2062
+ "model.layers.22.self_attn.q_proj": {
2063
+ "group_size": 64,
2064
+ "bits": 6
2065
+ },
2066
+ "model.layers.22.self_attn.k_proj": {
2067
+ "group_size": 64,
2068
+ "bits": 8
2069
+ },
2070
+ "model.layers.22.self_attn.v_proj": {
2071
+ "group_size": 64,
2072
+ "bits": 8
2073
+ },
2074
+ "model.layers.22.self_attn.o_proj": {
2075
+ "group_size": 64,
2076
+ "bits": 6
2077
+ },
2078
+ "model.layers.22.block_sparse_moe.switch_mlp.gate_proj": {
2079
+ "group_size": 64,
2080
+ "bits": 3
2081
+ },
2082
+ "model.layers.22.block_sparse_moe.switch_mlp.up_proj": {
2083
+ "group_size": 64,
2084
+ "bits": 3
2085
+ },
2086
+ "model.layers.22.block_sparse_moe.switch_mlp.down_proj": {
2087
+ "group_size": 64,
2088
+ "bits": 3
2089
+ },
2090
+ "model.layers.23.self_attn.q_proj": {
2091
+ "group_size": 64,
2092
+ "bits": 6
2093
+ },
2094
+ "model.layers.23.self_attn.k_proj": {
2095
+ "group_size": 64,
2096
+ "bits": 8
2097
+ },
2098
+ "model.layers.23.self_attn.v_proj": {
2099
+ "group_size": 64,
2100
+ "bits": 8
2101
+ },
2102
+ "model.layers.23.self_attn.o_proj": {
2103
+ "group_size": 64,
2104
+ "bits": 8
2105
+ },
2106
+ "model.layers.23.block_sparse_moe.switch_mlp.gate_proj": {
2107
+ "group_size": 64,
2108
+ "bits": 3
2109
+ },
2110
+ "model.layers.23.block_sparse_moe.switch_mlp.up_proj": {
2111
+ "group_size": 64,
2112
+ "bits": 3
2113
+ },
2114
+ "model.layers.23.block_sparse_moe.switch_mlp.down_proj": {
2115
+ "group_size": 64,
2116
+ "bits": 3
2117
+ },
2118
+ "model.layers.24.self_attn.q_proj": {
2119
+ "group_size": 64,
2120
+ "bits": 6
2121
+ },
2122
+ "model.layers.24.self_attn.k_proj": {
2123
+ "group_size": 64,
2124
+ "bits": 8
2125
+ },
2126
+ "model.layers.24.self_attn.v_proj": {
2127
+ "group_size": 64,
2128
+ "bits": 8
2129
+ },
2130
+ "model.layers.24.self_attn.o_proj": {
2131
+ "group_size": 64,
2132
+ "bits": 8
2133
+ },
2134
+ "model.layers.24.block_sparse_moe.switch_mlp.gate_proj": {
2135
+ "group_size": 64,
2136
+ "bits": 3
2137
+ },
2138
+ "model.layers.24.block_sparse_moe.switch_mlp.up_proj": {
2139
+ "group_size": 64,
2140
+ "bits": 3
2141
+ },
2142
+ "model.layers.24.block_sparse_moe.switch_mlp.down_proj": {
2143
+ "group_size": 64,
2144
+ "bits": 3
2145
+ },
2146
+ "model.layers.25.self_attn.q_proj": {
2147
+ "group_size": 64,
2148
+ "bits": 6
2149
+ },
2150
+ "model.layers.25.self_attn.k_proj": {
2151
+ "group_size": 64,
2152
+ "bits": 8
2153
+ },
2154
+ "model.layers.25.self_attn.v_proj": {
2155
+ "group_size": 64,
2156
+ "bits": 8
2157
+ },
2158
+ "model.layers.25.self_attn.o_proj": {
2159
+ "group_size": 64,
2160
+ "bits": 8
2161
+ },
2162
+ "model.layers.25.block_sparse_moe.switch_mlp.gate_proj": {
2163
+ "group_size": 64,
2164
+ "bits": 3
2165
+ },
2166
+ "model.layers.25.block_sparse_moe.switch_mlp.up_proj": {
2167
+ "group_size": 64,
2168
+ "bits": 3
2169
+ },
2170
+ "model.layers.25.block_sparse_moe.switch_mlp.down_proj": {
2171
+ "group_size": 64,
2172
+ "bits": 3
2173
+ },
2174
+ "model.layers.26.self_attn.q_proj": {
2175
+ "group_size": 64,
2176
+ "bits": 6
2177
+ },
2178
+ "model.layers.26.self_attn.k_proj": {
2179
+ "group_size": 64,
2180
+ "bits": 8
2181
+ },
2182
+ "model.layers.26.self_attn.v_proj": {
2183
+ "group_size": 64,
2184
+ "bits": 8
2185
+ },
2186
+ "model.layers.26.self_attn.o_proj": {
2187
+ "group_size": 64,
2188
+ "bits": 8
2189
+ },
2190
+ "model.layers.26.block_sparse_moe.switch_mlp.gate_proj": {
2191
+ "group_size": 64,
2192
+ "bits": 3
2193
+ },
2194
+ "model.layers.26.block_sparse_moe.switch_mlp.up_proj": {
2195
+ "group_size": 64,
2196
+ "bits": 3
2197
+ },
2198
+ "model.layers.26.block_sparse_moe.switch_mlp.down_proj": {
2199
+ "group_size": 64,
2200
+ "bits": 3
2201
+ },
2202
+ "model.layers.27.self_attn.q_proj": {
2203
+ "group_size": 64,
2204
+ "bits": 6
2205
+ },
2206
+ "model.layers.27.self_attn.k_proj": {
2207
+ "group_size": 64,
2208
+ "bits": 8
2209
+ },
2210
+ "model.layers.27.self_attn.v_proj": {
2211
+ "group_size": 64,
2212
+ "bits": 8
2213
+ },
2214
+ "model.layers.27.self_attn.o_proj": {
2215
+ "group_size": 64,
2216
+ "bits": 8
2217
+ },
2218
+ "model.layers.27.block_sparse_moe.switch_mlp.gate_proj": {
2219
+ "group_size": 64,
2220
+ "bits": 3
2221
+ },
2222
+ "model.layers.27.block_sparse_moe.switch_mlp.up_proj": {
2223
+ "group_size": 64,
2224
+ "bits": 3
2225
+ },
2226
+ "model.layers.27.block_sparse_moe.switch_mlp.down_proj": {
2227
+ "group_size": 64,
2228
+ "bits": 3
2229
+ },
2230
+ "model.layers.28.self_attn.q_proj": {
2231
+ "group_size": 64,
2232
+ "bits": 8
2233
+ },
2234
+ "model.layers.28.self_attn.k_proj": {
2235
+ "group_size": 64,
2236
+ "bits": 8
2237
+ },
2238
+ "model.layers.28.self_attn.v_proj": {
2239
+ "group_size": 64,
2240
+ "bits": 8
2241
+ },
2242
+ "model.layers.28.self_attn.o_proj": {
2243
+ "group_size": 64,
2244
+ "bits": 8
2245
+ },
2246
+ "model.layers.28.block_sparse_moe.switch_mlp.gate_proj": {
2247
+ "group_size": 64,
2248
+ "bits": 3
2249
+ },
2250
+ "model.layers.28.block_sparse_moe.switch_mlp.up_proj": {
2251
+ "group_size": 64,
2252
+ "bits": 3
2253
+ },
2254
+ "model.layers.28.block_sparse_moe.switch_mlp.down_proj": {
2255
+ "group_size": 64,
2256
+ "bits": 3
2257
+ },
2258
+ "model.layers.29.self_attn.q_proj": {
2259
+ "group_size": 64,
2260
+ "bits": 6
2261
+ },
2262
+ "model.layers.29.self_attn.k_proj": {
2263
+ "group_size": 64,
2264
+ "bits": 8
2265
+ },
2266
+ "model.layers.29.self_attn.o_proj": {
2267
+ "group_size": 64,
2268
+ "bits": 8
2269
+ },
2270
+ "model.layers.29.block_sparse_moe.switch_mlp.gate_proj": {
2271
+ "group_size": 64,
2272
+ "bits": 3
2273
+ },
2274
+ "model.layers.29.block_sparse_moe.switch_mlp.up_proj": {
2275
+ "group_size": 64,
2276
+ "bits": 3
2277
+ },
2278
+ "model.layers.29.block_sparse_moe.switch_mlp.down_proj": {
2279
+ "group_size": 64,
2280
+ "bits": 4
2281
+ },
2282
+ "model.layers.30.self_attn.q_proj": {
2283
+ "group_size": 64,
2284
+ "bits": 6
2285
+ },
2286
+ "model.layers.30.self_attn.k_proj": {
2287
+ "group_size": 64,
2288
+ "bits": 8
2289
+ },
2290
+ "model.layers.30.self_attn.v_proj": {
2291
+ "group_size": 64,
2292
+ "bits": 8
2293
+ },
2294
+ "model.layers.30.self_attn.o_proj": {
2295
+ "group_size": 64,
2296
+ "bits": 8
2297
+ },
2298
+ "model.layers.30.block_sparse_moe.switch_mlp.gate_proj": {
2299
+ "group_size": 64,
2300
+ "bits": 3
2301
+ },
2302
+ "model.layers.30.block_sparse_moe.switch_mlp.up_proj": {
2303
+ "group_size": 64,
2304
+ "bits": 3
2305
+ },
2306
+ "model.layers.30.block_sparse_moe.switch_mlp.down_proj": {
2307
+ "group_size": 64,
2308
+ "bits": 3
2309
+ },
2310
+ "model.layers.31.self_attn.q_proj": {
2311
+ "group_size": 64,
2312
+ "bits": 8
2313
+ },
2314
+ "model.layers.31.self_attn.k_proj": {
2315
+ "group_size": 64,
2316
+ "bits": 8
2317
+ },
2318
+ "model.layers.31.self_attn.o_proj": {
2319
+ "group_size": 64,
2320
+ "bits": 8
2321
+ },
2322
+ "model.layers.31.block_sparse_moe.switch_mlp.gate_proj": {
2323
+ "group_size": 64,
2324
+ "bits": 3
2325
+ },
2326
+ "model.layers.31.block_sparse_moe.switch_mlp.up_proj": {
2327
+ "group_size": 64,
2328
+ "bits": 3
2329
+ },
2330
+ "model.layers.31.block_sparse_moe.switch_mlp.down_proj": {
2331
+ "group_size": 64,
2332
+ "bits": 3
2333
+ },
2334
+ "model.layers.32.self_attn.q_proj": {
2335
+ "group_size": 64,
2336
+ "bits": 8
2337
+ },
2338
+ "model.layers.32.self_attn.k_proj": {
2339
+ "group_size": 64,
2340
+ "bits": 8
2341
+ },
2342
+ "model.layers.32.self_attn.o_proj": {
2343
+ "group_size": 64,
2344
+ "bits": 8
2345
+ },
2346
+ "model.layers.32.block_sparse_moe.switch_mlp.gate_proj": {
2347
+ "group_size": 64,
2348
+ "bits": 3
2349
+ },
2350
+ "model.layers.32.block_sparse_moe.switch_mlp.up_proj": {
2351
+ "group_size": 64,
2352
+ "bits": 3
2353
+ },
2354
+ "model.layers.32.block_sparse_moe.switch_mlp.down_proj": {
2355
+ "group_size": 64,
2356
+ "bits": 4
2357
+ },
2358
+ "model.layers.33.self_attn.q_proj": {
2359
+ "group_size": 64,
2360
+ "bits": 8
2361
+ },
2362
+ "model.layers.33.self_attn.k_proj": {
2363
+ "group_size": 64,
2364
+ "bits": 8
2365
+ },
2366
+ "model.layers.33.self_attn.o_proj": {
2367
+ "group_size": 64,
2368
+ "bits": 8
2369
+ },
2370
+ "model.layers.33.block_sparse_moe.switch_mlp.gate_proj": {
2371
+ "group_size": 64,
2372
+ "bits": 3
2373
+ },
2374
+ "model.layers.33.block_sparse_moe.switch_mlp.up_proj": {
2375
+ "group_size": 64,
2376
+ "bits": 3
2377
+ },
2378
+ "model.layers.33.block_sparse_moe.switch_mlp.down_proj": {
2379
+ "group_size": 64,
2380
+ "bits": 3
2381
+ },
2382
+ "model.layers.34.self_attn.q_proj": {
2383
+ "group_size": 64,
2384
+ "bits": 8
2385
+ },
2386
+ "model.layers.34.self_attn.k_proj": {
2387
+ "group_size": 64,
2388
+ "bits": 8
2389
+ },
2390
+ "model.layers.34.self_attn.v_proj": {
2391
+ "group_size": 64,
2392
+ "bits": 8
2393
+ },
2394
+ "model.layers.34.self_attn.o_proj": {
2395
+ "group_size": 64,
2396
+ "bits": 8
2397
+ },
2398
+ "model.layers.34.block_sparse_moe.switch_mlp.gate_proj": {
2399
+ "group_size": 64,
2400
+ "bits": 3
2401
+ },
2402
+ "model.layers.34.block_sparse_moe.switch_mlp.up_proj": {
2403
+ "group_size": 64,
2404
+ "bits": 3
2405
+ },
2406
+ "model.layers.34.block_sparse_moe.switch_mlp.down_proj": {
2407
+ "group_size": 64,
2408
+ "bits": 3
2409
+ },
2410
+ "model.layers.35.self_attn.q_proj": {
2411
+ "group_size": 64,
2412
+ "bits": 8
2413
+ },
2414
+ "model.layers.35.self_attn.k_proj": {
2415
+ "group_size": 64,
2416
+ "bits": 8
2417
+ },
2418
+ "model.layers.35.self_attn.o_proj": {
2419
+ "group_size": 64,
2420
+ "bits": 8
2421
+ },
2422
+ "model.layers.35.block_sparse_moe.switch_mlp.gate_proj": {
2423
+ "group_size": 64,
2424
+ "bits": 3
2425
+ },
2426
+ "model.layers.35.block_sparse_moe.switch_mlp.up_proj": {
2427
+ "group_size": 64,
2428
+ "bits": 3
2429
+ },
2430
+ "model.layers.35.block_sparse_moe.switch_mlp.down_proj": {
2431
+ "group_size": 64,
2432
+ "bits": 3
2433
+ },
2434
+ "model.layers.36.self_attn.q_proj": {
2435
+ "group_size": 64,
2436
+ "bits": 8
2437
+ },
2438
+ "model.layers.36.self_attn.k_proj": {
2439
+ "group_size": 64,
2440
+ "bits": 8
2441
+ },
2442
+ "model.layers.36.self_attn.o_proj": {
2443
+ "group_size": 64,
2444
+ "bits": 8
2445
+ },
2446
+ "model.layers.36.block_sparse_moe.switch_mlp.gate_proj": {
2447
+ "group_size": 64,
2448
+ "bits": 3
2449
+ },
2450
+ "model.layers.36.block_sparse_moe.switch_mlp.up_proj": {
2451
+ "group_size": 64,
2452
+ "bits": 3
2453
+ },
2454
+ "model.layers.36.block_sparse_moe.switch_mlp.down_proj": {
2455
+ "group_size": 64,
2456
+ "bits": 3
2457
+ },
2458
+ "model.layers.37.self_attn.q_proj": {
2459
+ "group_size": 64,
2460
+ "bits": 8
2461
+ },
2462
+ "model.layers.37.self_attn.k_proj": {
2463
+ "group_size": 64,
2464
+ "bits": 8
2465
+ },
2466
+ "model.layers.37.self_attn.o_proj": {
2467
+ "group_size": 64,
2468
+ "bits": 8
2469
+ },
2470
+ "model.layers.37.block_sparse_moe.switch_mlp.gate_proj": {
2471
+ "group_size": 64,
2472
+ "bits": 3
2473
+ },
2474
+ "model.layers.37.block_sparse_moe.switch_mlp.up_proj": {
2475
+ "group_size": 64,
2476
+ "bits": 3
2477
+ },
2478
+ "model.layers.37.block_sparse_moe.switch_mlp.down_proj": {
2479
+ "group_size": 64,
2480
+ "bits": 3
2481
+ },
2482
+ "model.layers.38.self_attn.q_proj": {
2483
+ "group_size": 64,
2484
+ "bits": 8
2485
+ },
2486
+ "model.layers.38.self_attn.k_proj": {
2487
+ "group_size": 64,
2488
+ "bits": 8
2489
+ },
2490
+ "model.layers.38.self_attn.o_proj": {
2491
+ "group_size": 64,
2492
+ "bits": 8
2493
+ },
2494
+ "model.layers.38.block_sparse_moe.switch_mlp.gate_proj": {
2495
+ "group_size": 64,
2496
+ "bits": 3
2497
+ },
2498
+ "model.layers.38.block_sparse_moe.switch_mlp.up_proj": {
2499
+ "group_size": 64,
2500
+ "bits": 3
2501
+ },
2502
+ "model.layers.38.block_sparse_moe.switch_mlp.down_proj": {
2503
+ "group_size": 64,
2504
+ "bits": 3
2505
+ },
2506
+ "model.layers.39.self_attn.q_proj": {
2507
+ "group_size": 64,
2508
+ "bits": 8
2509
+ },
2510
+ "model.layers.39.self_attn.k_proj": {
2511
+ "group_size": 64,
2512
+ "bits": 8
2513
+ },
2514
+ "model.layers.39.self_attn.o_proj": {
2515
+ "group_size": 64,
2516
+ "bits": 8
2517
+ },
2518
+ "model.layers.39.block_sparse_moe.switch_mlp.gate_proj": {
2519
+ "group_size": 64,
2520
+ "bits": 3
2521
+ },
2522
+ "model.layers.39.block_sparse_moe.switch_mlp.up_proj": {
2523
+ "group_size": 64,
2524
+ "bits": 3
2525
+ },
2526
+ "model.layers.39.block_sparse_moe.switch_mlp.down_proj": {
2527
+ "group_size": 64,
2528
+ "bits": 4
2529
+ },
2530
+ "model.layers.40.self_attn.q_proj": {
2531
+ "group_size": 64,
2532
+ "bits": 8
2533
+ },
2534
+ "model.layers.40.self_attn.k_proj": {
2535
+ "group_size": 64,
2536
+ "bits": 8
2537
+ },
2538
+ "model.layers.40.self_attn.o_proj": {
2539
+ "group_size": 64,
2540
+ "bits": 8
2541
+ },
2542
+ "model.layers.40.block_sparse_moe.switch_mlp.gate_proj": {
2543
+ "group_size": 64,
2544
+ "bits": 3
2545
+ },
2546
+ "model.layers.40.block_sparse_moe.switch_mlp.up_proj": {
2547
+ "group_size": 64,
2548
+ "bits": 3
2549
+ },
2550
+ "model.layers.40.block_sparse_moe.switch_mlp.down_proj": {
2551
+ "group_size": 64,
2552
+ "bits": 3
2553
+ },
2554
+ "model.layers.41.self_attn.q_proj": {
2555
+ "group_size": 64,
2556
+ "bits": 8
2557
+ },
2558
+ "model.layers.41.self_attn.k_proj": {
2559
+ "group_size": 64,
2560
+ "bits": 8
2561
+ },
2562
+ "model.layers.41.self_attn.o_proj": {
2563
+ "group_size": 64,
2564
+ "bits": 8
2565
+ },
2566
+ "model.layers.41.block_sparse_moe.switch_mlp.gate_proj": {
2567
+ "group_size": 64,
2568
+ "bits": 4
2569
+ },
2570
+ "model.layers.41.block_sparse_moe.switch_mlp.up_proj": {
2571
+ "group_size": 64,
2572
+ "bits": 3
2573
+ },
2574
+ "model.layers.41.block_sparse_moe.switch_mlp.down_proj": {
2575
+ "group_size": 64,
2576
+ "bits": 3
2577
+ },
2578
+ "model.layers.42.self_attn.q_proj": {
2579
+ "group_size": 64,
2580
+ "bits": 8
2581
+ },
2582
+ "model.layers.42.self_attn.k_proj": {
2583
+ "group_size": 64,
2584
+ "bits": 8
2585
+ },
2586
+ "model.layers.42.self_attn.o_proj": {
2587
+ "group_size": 64,
2588
+ "bits": 8
2589
+ },
2590
+ "model.layers.42.block_sparse_moe.switch_mlp.gate_proj": {
2591
+ "group_size": 64,
2592
+ "bits": 4
2593
+ },
2594
+ "model.layers.42.block_sparse_moe.switch_mlp.up_proj": {
2595
+ "group_size": 64,
2596
+ "bits": 4
2597
+ },
2598
+ "model.layers.42.block_sparse_moe.switch_mlp.down_proj": {
2599
+ "group_size": 64,
2600
+ "bits": 4
2601
+ },
2602
+ "model.layers.43.self_attn.q_proj": {
2603
+ "group_size": 64,
2604
+ "bits": 8
2605
+ },
2606
+ "model.layers.43.self_attn.k_proj": {
2607
+ "group_size": 64,
2608
+ "bits": 8
2609
+ },
2610
+ "model.layers.43.self_attn.o_proj": {
2611
+ "group_size": 64,
2612
+ "bits": 8
2613
+ },
2614
+ "model.layers.43.block_sparse_moe.switch_mlp.gate_proj": {
2615
+ "group_size": 64,
2616
+ "bits": 4
2617
+ },
2618
+ "model.layers.43.block_sparse_moe.switch_mlp.up_proj": {
2619
+ "group_size": 64,
2620
+ "bits": 4
2621
+ },
2622
+ "model.layers.43.block_sparse_moe.switch_mlp.down_proj": {
2623
+ "group_size": 64,
2624
+ "bits": 4
2625
+ },
2626
+ "model.layers.44.self_attn.q_proj": {
2627
+ "group_size": 64,
2628
+ "bits": 8
2629
+ },
2630
+ "model.layers.44.self_attn.o_proj": {
2631
+ "group_size": 64,
2632
+ "bits": 8
2633
+ },
2634
+ "model.layers.44.block_sparse_moe.switch_mlp.gate_proj": {
2635
+ "group_size": 64,
2636
+ "bits": 4
2637
+ },
2638
+ "model.layers.44.block_sparse_moe.switch_mlp.up_proj": {
2639
+ "group_size": 64,
2640
+ "bits": 4
2641
+ },
2642
+ "model.layers.44.block_sparse_moe.switch_mlp.down_proj": {
2643
+ "group_size": 64,
2644
+ "bits": 4
2645
+ },
2646
+ "model.layers.45.block_sparse_moe.switch_mlp.gate_proj": {
2647
+ "group_size": 64,
2648
+ "bits": 8
2649
+ },
2650
+ "model.layers.45.block_sparse_moe.switch_mlp.up_proj": {
2651
+ "group_size": 64,
2652
+ "bits": 8
2653
+ },
2654
+ "model.layers.45.block_sparse_moe.switch_mlp.down_proj": {
2655
+ "group_size": 64,
2656
+ "bits": 8
2657
+ },
2658
+ "model.layers.46.block_sparse_moe.switch_mlp.gate_proj": {
2659
+ "group_size": 64,
2660
+ "bits": 8
2661
+ },
2662
+ "model.layers.46.block_sparse_moe.switch_mlp.up_proj": {
2663
+ "group_size": 64,
2664
+ "bits": 8
2665
+ },
2666
+ "model.layers.46.block_sparse_moe.switch_mlp.down_proj": {
2667
+ "group_size": 64,
2668
+ "bits": 8
2669
+ },
2670
+ "model.layers.47.block_sparse_moe.switch_mlp.gate_proj": {
2671
+ "group_size": 64,
2672
+ "bits": 8
2673
+ },
2674
+ "model.layers.47.block_sparse_moe.switch_mlp.up_proj": {
2675
+ "group_size": 64,
2676
+ "bits": 8
2677
+ },
2678
+ "model.layers.47.block_sparse_moe.switch_mlp.down_proj": {
2679
+ "group_size": 64,
2680
+ "bits": 8
2681
+ },
2682
+ "model.layers.48.block_sparse_moe.switch_mlp.gate_proj": {
2683
+ "group_size": 64,
2684
+ "bits": 8
2685
+ },
2686
+ "model.layers.48.block_sparse_moe.switch_mlp.up_proj": {
2687
+ "group_size": 64,
2688
+ "bits": 8
2689
+ },
2690
+ "model.layers.48.block_sparse_moe.switch_mlp.down_proj": {
2691
+ "group_size": 64,
2692
+ "bits": 8
2693
+ },
2694
+ "model.layers.49.block_sparse_moe.switch_mlp.gate_proj": {
2695
+ "group_size": 64,
2696
+ "bits": 8
2697
+ },
2698
+ "model.layers.49.block_sparse_moe.switch_mlp.up_proj": {
2699
+ "group_size": 64,
2700
+ "bits": 8
2701
+ },
2702
+ "model.layers.49.block_sparse_moe.switch_mlp.down_proj": {
2703
+ "group_size": 64,
2704
+ "bits": 8
2705
+ },
2706
+ "model.layers.50.block_sparse_moe.switch_mlp.gate_proj": {
2707
+ "group_size": 64,
2708
+ "bits": 8
2709
+ },
2710
+ "model.layers.50.block_sparse_moe.switch_mlp.up_proj": {
2711
+ "group_size": 64,
2712
+ "bits": 8
2713
+ },
2714
+ "model.layers.50.block_sparse_moe.switch_mlp.down_proj": {
2715
+ "group_size": 64,
2716
+ "bits": 8
2717
+ },
2718
+ "model.layers.51.block_sparse_moe.switch_mlp.gate_proj": {
2719
+ "group_size": 64,
2720
+ "bits": 8
2721
+ },
2722
+ "model.layers.51.block_sparse_moe.switch_mlp.up_proj": {
2723
+ "group_size": 64,
2724
+ "bits": 8
2725
+ },
2726
+ "model.layers.51.block_sparse_moe.switch_mlp.down_proj": {
2727
+ "group_size": 64,
2728
+ "bits": 8
2729
+ },
2730
+ "model.layers.52.block_sparse_moe.switch_mlp.gate_proj": {
2731
+ "group_size": 64,
2732
+ "bits": 8
2733
+ },
2734
+ "model.layers.52.block_sparse_moe.switch_mlp.up_proj": {
2735
+ "group_size": 64,
2736
+ "bits": 8
2737
+ },
2738
+ "model.layers.52.block_sparse_moe.switch_mlp.down_proj": {
2739
+ "group_size": 64,
2740
+ "bits": 8
2741
+ },
2742
+ "model.layers.53.block_sparse_moe.switch_mlp.gate_proj": {
2743
+ "group_size": 64,
2744
+ "bits": 8
2745
+ },
2746
+ "model.layers.53.block_sparse_moe.switch_mlp.up_proj": {
2747
+ "group_size": 64,
2748
+ "bits": 8
2749
+ },
2750
+ "model.layers.53.block_sparse_moe.switch_mlp.down_proj": {
2751
+ "group_size": 64,
2752
+ "bits": 8
2753
+ },
2754
+ "model.layers.54.block_sparse_moe.switch_mlp.gate_proj": {
2755
+ "group_size": 64,
2756
+ "bits": 8
2757
+ },
2758
+ "model.layers.54.block_sparse_moe.switch_mlp.up_proj": {
2759
+ "group_size": 64,
2760
+ "bits": 8
2761
+ },
2762
+ "model.layers.54.block_sparse_moe.switch_mlp.down_proj": {
2763
+ "group_size": 64,
2764
+ "bits": 8
2765
+ },
2766
+ "model.layers.55.block_sparse_moe.switch_mlp.gate_proj": {
2767
+ "group_size": 64,
2768
+ "bits": 8
2769
+ },
2770
+ "model.layers.55.block_sparse_moe.switch_mlp.up_proj": {
2771
+ "group_size": 64,
2772
+ "bits": 8
2773
+ },
2774
+ "model.layers.55.block_sparse_moe.switch_mlp.down_proj": {
2775
+ "group_size": 64,
2776
+ "bits": 8
2777
+ },
2778
+ "model.layers.56.block_sparse_moe.switch_mlp.gate_proj": {
2779
+ "group_size": 64,
2780
+ "bits": 8
2781
+ },
2782
+ "model.layers.56.block_sparse_moe.switch_mlp.up_proj": {
2783
+ "group_size": 64,
2784
+ "bits": 8
2785
+ },
2786
+ "model.layers.56.block_sparse_moe.switch_mlp.down_proj": {
2787
+ "group_size": 64,
2788
+ "bits": 8
2789
+ },
2790
+ "model.layers.57.block_sparse_moe.switch_mlp.gate_proj": {
2791
+ "group_size": 64,
2792
+ "bits": 8
2793
+ },
2794
+ "model.layers.57.block_sparse_moe.switch_mlp.up_proj": {
2795
+ "group_size": 64,
2796
+ "bits": 8
2797
+ },
2798
+ "model.layers.57.block_sparse_moe.switch_mlp.down_proj": {
2799
+ "group_size": 64,
2800
+ "bits": 8
2801
+ },
2802
+ "model.layers.58.block_sparse_moe.switch_mlp.gate_proj": {
2803
+ "group_size": 64,
2804
+ "bits": 8
2805
+ },
2806
+ "model.layers.58.block_sparse_moe.switch_mlp.up_proj": {
2807
+ "group_size": 64,
2808
+ "bits": 8
2809
+ },
2810
+ "model.layers.58.block_sparse_moe.switch_mlp.down_proj": {
2811
+ "group_size": 64,
2812
+ "bits": 8
2813
+ },
2814
+ "model.layers.59.block_sparse_moe.switch_mlp.gate_proj": {
2815
+ "group_size": 64,
2816
+ "bits": 8
2817
+ },
2818
+ "model.layers.59.block_sparse_moe.switch_mlp.up_proj": {
2819
+ "group_size": 64,
2820
+ "bits": 8
2821
+ },
2822
+ "model.layers.59.block_sparse_moe.switch_mlp.down_proj": {
2823
+ "group_size": 64,
2824
+ "bits": 8
2825
+ },
2826
+ "model.layers.60.block_sparse_moe.switch_mlp.gate_proj": {
2827
+ "group_size": 64,
2828
+ "bits": 8
2829
+ },
2830
+ "model.layers.60.block_sparse_moe.switch_mlp.up_proj": {
2831
+ "group_size": 64,
2832
+ "bits": 8
2833
+ },
2834
+ "model.layers.60.block_sparse_moe.switch_mlp.down_proj": {
2835
+ "group_size": 64,
2836
+ "bits": 8
2837
+ },
2838
+ "model.layers.61.block_sparse_moe.switch_mlp.gate_proj": {
2839
+ "group_size": 64,
2840
+ "bits": 8
2841
+ },
2842
+ "model.layers.61.block_sparse_moe.switch_mlp.up_proj": {
2843
+ "group_size": 64,
2844
+ "bits": 8
2845
+ },
2846
+ "lm_head": {
2847
+ "group_size": 64,
2848
+ "bits": 8
2849
+ }
2850
+ },
2851
+ "rms_norm_eps": 1e-06,
2852
+ "rope_theta": 5000000,
2853
+ "rotary_dim": 64,
2854
+ "scoring_func": "sigmoid",
2855
+ "shared_intermediate_size": 0,
2856
+ "tie_word_embeddings": false,
2857
+ "transformers_version": "4.46.1",
2858
+ "use_cache": true,
2859
+ "use_mtp": true,
2860
+ "use_qk_norm": true,
2861
+ "use_routing_bias": true,
2862
+ "vocab_size": 200064
2863
+ }
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,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 200019,
3
+ "do_sample": true,
4
+ "eos_token_id": 200020,
5
+ "temperature": 1.0,
6
+ "top_p": 0.95,
7
+ "top_k": 40,
8
+ "transformers_version": "4.46.1"
9
+ }
model-00001-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:661183a51dff939bb56d856c70ad125ed5bda58dc61e654b1561c71126792a80
3
+ size 4644590949
model-00002-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:32d8d3542175b4012c1d090225a5d36336258f5597df174e73b7a4848ddc1160
3
+ size 5108300899
model-00003-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9199b5ba3e7387d7b33c5e24a364b0ae0420927293961f446d1386848dbb50fc
3
+ size 5352910804
model-00004-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b71be15eb73f20ea2d354b5b8e9aef338d555d8058cb0ebe7ffd9893e0d486b6
3
+ size 5359021235
model-00005-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d1b931893f9b48938f2a5613be6a3759d392b594df67d53cb19870965e5f8c36
3
+ size 5006896750
model-00006-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:30f954d2ec2925dd5241484bda0f2b37ff22609784381775e3768dcf4d24740e
3
+ size 4948519091
model-00007-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6820f9ce921903173c0ce30782819103fa42c5f5601510a4ecfd85bab2129c95
3
+ size 5026573132
model-00008-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f5bf7ec3f2d4e6b5201cbd75962e53d27171677d18822bf146170df79725c841
3
+ size 5333281747
model-00009-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b9e880a756a3617be206ded5561c748217a14d253d30bb448f1f919d2766c655
3
+ size 4951075956
model-00010-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b57a2c758e7a5faa459b4af9dac0ef0a165b9774017bb62f765fbd13bbad444b
3
+ size 5340359641
model-00011-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0195c51a49542f0ccdd8557d5755afef2bd215053e5859d18bc577b93b79418d
3
+ size 4967591016
model-00012-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df235fdd387f6187a2a78f1bd27df90b544e6a767862cb553237c2f8bdfcd28c
3
+ size 5050755712
model-00013-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8f10200db94e1993d68e90000375b3d8fd725af68a0ad0bde48f2967ebe6cc5b
3
+ size 5066090672
model-00014-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f3781ce70080c74d73da7f78f11d18b41f47df1ab928167ba7fb5f145fa45531
3
+ size 5365131839
model-00015-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e6c2a8df14a80511b68b90cd4f1323b3aecefb2689a35b73fbea405a070a5510
3
+ size 5194505493
model-00016-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:adce4c50dcd3e45f7c0847cc5879d126692c7c5dd542a2d633251cd58f9c184e
3
+ size 4786680766
model-00017-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7829ae7b687875e141e96da780e50b3702ec4cfe6a210552ac5ae245f6673192
3
+ size 4956381641
model-00018-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:462b28b425bbb4e8852d60b2454eb9c1b25de82a39caf6ee5ec1e9dc07d6e412
3
+ size 5225084742
model-00019-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:da223253983ecd04d96dd2741f5fa31c76331628873d07f52dbf31b22dd76a46
3
+ size 5225084740
model-00020-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0a8f58c3bfbf075eafb9ba0a3427f06781b6a1fd7b2b3080f88341e5bd87c894
3
+ size 5316339664
model-00021-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0bd2decaac70cd6a226bdbc779ec69b875fd49543d589e9cb7e82f671b2af2ec
3
+ size 5225084702
model-00022-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7de5b7e4a8764744d1bd8d3af6e1c71585b43c4f481de5c76aaa9fda7079e26d
3
+ size 5225084744
model-00023-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:44d323f9132ed5394de6ae032247076d775246d03f78c1117d45d78895b80788
3
+ size 5316339648
model-00024-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b525e57ea2a0d1c3296fde71cb4fcc75cfb743a41dc1c1f5fa1f9343dee87cb6
3
+ size 5225084724
model-00025-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1ee2ae222fe2623b2e4fa587480570576402bddd43768ea48771c78cc198fe0a
3
+ size 5225084740
model-00026-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8576f2cf548b5f3f13cfbb4fe6faa40c85c2dc4b2e51ec311466f6b52d4b0ff5
3
+ size 5316339654
model-00027-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3c538990f85723119310006093cd14c410804136c24b5ec7535ff0a3a9d2d675
3
+ size 5225084736
model-00028-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:042fd9c6a04c76057f8ce62a89de126ddc591cb28d5279b1c96911290e846064
3
+ size 5225084740
model-00029-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b47695d65e08dfdfed88bc569b964c9afdde4ccdb5c70f5b1e564f8768428182
3
+ size 5316339656
model-00030-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:962f7620bd91be3b81c3fbd527d7c521998e46cf2a7a66f9bcb6084501a15d23
3
+ size 4982854043
model-00031-of-00031.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a75ec66586186b05cd4048a597082a571045991a48996d6fb2d0662c3b076e57
3
+ size 653009198
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
modeling_minimax_m2.py ADDED
@@ -0,0 +1,706 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 collections.abc import Callable
24
+ from typing import Optional, Union, Unpack
25
+
26
+ import torch
27
+ from torch import nn
28
+
29
+ from transformers.activations import ACT2FN
30
+ from transformers.cache_utils import Cache, DynamicCache
31
+ from transformers.generation import GenerationMixin
32
+ from transformers.integrations import use_kernel_forward_from_hub
33
+ from transformers.masking_utils import create_causal_mask, create_sliding_window_causal_mask
34
+ from transformers.modeling_flash_attention_utils import FlashAttentionKwargs
35
+ from transformers.modeling_layers import (
36
+ GenericForQuestionAnswering,
37
+ GenericForSequenceClassification,
38
+ GenericForTokenClassification,
39
+ GradientCheckpointingLayer,
40
+ )
41
+ from transformers.modeling_outputs import MoeCausalLMOutputWithPast, MoeModelOutputWithPast
42
+ from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
43
+ from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
44
+ from transformers.utils import TransformersKwargs, auto_docstring, can_return_tuple
45
+ from transformers.utils.deprecation import deprecate_kwarg
46
+ from transformers.utils.generic import OutputRecorder, check_model_inputs
47
+ from .configuration_minimax_m2 import MiniMaxM2Config
48
+
49
+
50
+ class MiniMaxM2MLP(nn.Module):
51
+ def __init__(self, config: MiniMaxM2Config):
52
+ super().__init__()
53
+ self.ffn_dim = config.intermediate_size
54
+ self.hidden_dim = config.hidden_size
55
+
56
+ self.w1 = nn.Linear(self.hidden_dim, self.ffn_dim, bias=False)
57
+ self.w2 = nn.Linear(self.ffn_dim, self.hidden_dim, bias=False)
58
+ self.w3 = nn.Linear(self.hidden_dim, self.ffn_dim, bias=False)
59
+
60
+ self.act_fn = ACT2FN[config.hidden_act]
61
+
62
+ def forward(self, hidden_states):
63
+ current_hidden_states = self.act_fn(self.w1(hidden_states)) * self.w3(hidden_states)
64
+ current_hidden_states = self.w2(current_hidden_states)
65
+ return current_hidden_states
66
+
67
+
68
+ class MiniMaxM2Experts(nn.ModuleList):
69
+ """
70
+ ModuleList of experts.
71
+ """
72
+
73
+ def __init__(self, config: MiniMaxM2Config):
74
+ super().__init__()
75
+ self.top_k = config.num_experts_per_tok
76
+ self.num_experts = config.num_local_experts
77
+ for _ in range(self.num_experts):
78
+ self.append(MiniMaxM2MLP(config))
79
+
80
+ def forward(
81
+ self, hidden_states: torch.Tensor, top_k_index: torch.Tensor, top_k_weights: torch.Tensor
82
+ ) -> torch.Tensor:
83
+ """
84
+ Args:
85
+ hidden_states: (batch_size * sequence_length, hidden_dim)
86
+ selected_experts: (batch_size * sequence_length, top_k)
87
+ routing_weights: (batch_size * sequence_length, top_k)
88
+ Returns:
89
+ (batch_size * sequence_length, hidden_dim)
90
+ """
91
+ final_hidden_states = torch.zeros_like(hidden_states)
92
+ expert_mask = torch.nn.functional.one_hot(top_k_index, num_classes=self.num_experts).permute(2, 1, 0)
93
+
94
+ expert_hit = torch.greater(expert_mask.sum(dim=(-1, -2)), 0).nonzero()
95
+ for expert_idx in expert_hit:
96
+ idx, top_x = torch.where(expert_mask[expert_idx].squeeze(0))
97
+ current_state = hidden_states[None, top_x].reshape(-1, hidden_states.shape[-1])
98
+ current_hidden_states = self[expert_idx](current_state) * top_k_weights[top_x, idx, None]
99
+ final_hidden_states.index_add_(0, top_x, current_hidden_states.to(hidden_states.dtype))
100
+ return final_hidden_states
101
+
102
+
103
+ class MiniMaxM2SparseMoeBlock(nn.Module):
104
+ def __init__(self, config):
105
+ super().__init__()
106
+ self.top_k = config.num_experts_per_tok
107
+ self.jitter_noise = config.router_jitter_noise
108
+ self.gate = nn.Linear(config.hidden_size, config.num_local_experts, bias=False)
109
+ self.experts = MiniMaxM2Experts(config)
110
+ self.register_buffer("e_score_correction_bias", torch.zeros(config.num_local_experts))
111
+
112
+ def route_tokens_to_experts(self, router_logits):
113
+ routing_weights = torch.nn.functional.sigmoid(router_logits.float())
114
+ scores_for_choice = routing_weights + self.e_score_correction_bias
115
+ _, top_k_index = torch.topk(scores_for_choice, self.top_k, dim=-1, sorted=False)
116
+ top_k_weights = routing_weights.gather(1, top_k_index)
117
+ top_k_weights /= top_k_weights.sum(dim=-1, keepdim=True)
118
+ return top_k_index, top_k_weights.to(router_logits.dtype)
119
+
120
+ def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]:
121
+ batch_size, sequence_length, hidden_dim = hidden_states.shape
122
+ if self.training and self.jitter_noise > 0:
123
+ hidden_states *= torch.empty_like(hidden_states).uniform_(1.0 - self.jitter_noise, 1.0 + self.jitter_noise)
124
+ hidden_states = hidden_states.view(-1, hidden_states.shape[-1])
125
+ router_logits = self.gate(hidden_states)
126
+ top_k_index, top_k_weights = self.route_tokens_to_experts(router_logits)
127
+ hidden_states = self.experts(hidden_states, top_k_index, top_k_weights.to(hidden_states.dtype))
128
+ hidden_states = hidden_states.reshape(batch_size, sequence_length, hidden_dim)
129
+ return hidden_states, router_logits
130
+
131
+
132
+ @use_kernel_forward_from_hub("RMSNorm")
133
+ class MiniMaxM2RMSNorm(nn.Module):
134
+ def __init__(self, hidden_size, eps=1e-6):
135
+ """
136
+ MiniMaxM2RMSNorm is equivalent to T5LayerNorm
137
+ """
138
+ super().__init__()
139
+ self.weight = nn.Parameter(torch.ones(hidden_size))
140
+ self.variance_epsilon = eps
141
+
142
+ def forward(self, hidden_states):
143
+ input_dtype = hidden_states.dtype
144
+ hidden_states = hidden_states.to(torch.float32)
145
+ variance = hidden_states.pow(2).mean(-1, keepdim=True)
146
+ hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
147
+ return self.weight * hidden_states.to(input_dtype)
148
+
149
+ def extra_repr(self):
150
+ return f"{tuple(self.weight.shape)}, eps={self.variance_epsilon}"
151
+
152
+
153
+ def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
154
+ """
155
+ This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
156
+ num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
157
+ """
158
+ batch, num_key_value_heads, slen, head_dim = hidden_states.shape
159
+ if n_rep == 1:
160
+ return hidden_states
161
+ hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
162
+ return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
163
+
164
+
165
+ def eager_attention_forward(
166
+ module: nn.Module,
167
+ query: torch.Tensor,
168
+ key: torch.Tensor,
169
+ value: torch.Tensor,
170
+ attention_mask: Optional[torch.Tensor],
171
+ scaling: float,
172
+ dropout: float = 0.0,
173
+ **kwargs: Unpack[TransformersKwargs],
174
+ ):
175
+ key_states = repeat_kv(key, module.num_key_value_groups)
176
+ value_states = repeat_kv(value, module.num_key_value_groups)
177
+
178
+ attn_weights = torch.matmul(query, key_states.transpose(2, 3)) * scaling
179
+ if attention_mask is not None:
180
+ causal_mask = attention_mask[:, :, :, : key_states.shape[-2]]
181
+ attn_weights = attn_weights + causal_mask
182
+
183
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query.dtype)
184
+ attn_weights = nn.functional.dropout(attn_weights, p=dropout, training=module.training)
185
+ attn_output = torch.matmul(attn_weights, value_states)
186
+ attn_output = attn_output.transpose(1, 2).contiguous()
187
+
188
+ return attn_output, attn_weights
189
+
190
+
191
+ def rotate_half(x):
192
+ """Rotates half the hidden dims of the input."""
193
+ x1 = x[..., : x.shape[-1] // 2]
194
+ x2 = x[..., x.shape[-1] // 2 :]
195
+ return torch.cat((-x2, x1), dim=-1)
196
+
197
+
198
+ def apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_dim=1):
199
+ """Applies Rotary Position Embedding to the query and key tensors.
200
+
201
+ Args:
202
+ q (`torch.Tensor`): The query tensor.
203
+ k (`torch.Tensor`): The key tensor.
204
+ cos (`torch.Tensor`): The cosine part of the rotary embedding.
205
+ sin (`torch.Tensor`): The sine part of the rotary embedding.
206
+ position_ids (`torch.Tensor`, *optional*):
207
+ Deprecated and unused.
208
+ unsqueeze_dim (`int`, *optional*, defaults to 1):
209
+ The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
210
+ sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
211
+ that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
212
+ k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
213
+ cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
214
+ the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
215
+ Returns:
216
+ `tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
217
+ """
218
+ cos = cos.unsqueeze(unsqueeze_dim)
219
+ sin = sin.unsqueeze(unsqueeze_dim)
220
+
221
+ # Keep half or full tensor for later concatenation
222
+ rotary_dim = cos.shape[-1]
223
+ q_rot, q_pass = q[..., :rotary_dim], q[..., rotary_dim:]
224
+ k_rot, k_pass = k[..., :rotary_dim], k[..., rotary_dim:]
225
+
226
+ # Apply rotary embeddings on the first half or full tensor
227
+ q_embed = (q_rot * cos) + (rotate_half(q_rot) * sin)
228
+ k_embed = (k_rot * cos) + (rotate_half(k_rot) * sin)
229
+
230
+ # Concatenate back to full shape
231
+ q_embed = torch.cat([q_embed, q_pass], dim=-1)
232
+ k_embed = torch.cat([k_embed, k_pass], dim=-1)
233
+ return q_embed, k_embed
234
+
235
+
236
+ class MiniMaxM2Attention(nn.Module):
237
+ """Multi-headed attention from 'Attention Is All You Need' paper"""
238
+
239
+ def __init__(self, config: MiniMaxM2Config, layer_idx: int):
240
+ super().__init__()
241
+ self.config = config
242
+ self.layer_idx = layer_idx
243
+ self.head_dim = getattr(config, "head_dim", None) or config.hidden_size // config.num_attention_heads
244
+ self.num_key_value_groups = config.num_attention_heads // config.num_key_value_heads
245
+ self.scaling = self.head_dim**-0.5
246
+ self.attention_dropout = config.attention_dropout
247
+ self.is_causal = True
248
+ self.q_proj = nn.Linear(config.hidden_size, config.num_attention_heads * self.head_dim, bias=False)
249
+ self.k_proj = nn.Linear(config.hidden_size, config.num_key_value_heads * self.head_dim, bias=False)
250
+ self.v_proj = nn.Linear(config.hidden_size, config.num_key_value_heads * self.head_dim, bias=False)
251
+ self.o_proj = nn.Linear(config.num_attention_heads * self.head_dim, config.hidden_size, bias=False)
252
+
253
+ self.use_qk_norm = config.use_qk_norm
254
+ if self.use_qk_norm:
255
+ self.q_norm = MiniMaxM2RMSNorm(self.head_dim * config.num_attention_heads, eps=config.rms_norm_eps)
256
+ self.k_norm = MiniMaxM2RMSNorm(self.head_dim * config.num_key_value_heads, eps=config.rms_norm_eps)
257
+
258
+ @deprecate_kwarg("past_key_value", new_name="past_key_values", version="4.58")
259
+ def forward(
260
+ self,
261
+ hidden_states: torch.Tensor,
262
+ position_embeddings: tuple[torch.Tensor, torch.Tensor],
263
+ attention_mask: Optional[torch.Tensor],
264
+ past_key_values: Optional[Cache] = None,
265
+ cache_position: Optional[torch.LongTensor] = None,
266
+ **kwargs: Unpack[FlashAttentionKwargs],
267
+ ) -> tuple[torch.Tensor, Optional[torch.Tensor]]:
268
+ input_shape = hidden_states.shape[:-1]
269
+ hidden_shape = (*input_shape, -1, self.head_dim)
270
+
271
+ query_states = self.q_proj(hidden_states)
272
+ key_states = self.k_proj(hidden_states)
273
+ value_states = self.v_proj(hidden_states)
274
+
275
+ if self.use_qk_norm: # main diff from Llama
276
+ query_states = self.q_norm(query_states)
277
+ key_states = self.k_norm(key_states)
278
+
279
+ key_states = key_states.view(hidden_shape)
280
+ query_states = query_states.view(hidden_shape)
281
+ value_states = value_states.view(hidden_shape)
282
+
283
+ query_states = query_states.transpose(1, 2)
284
+ key_states = key_states.transpose(1, 2)
285
+ value_states = value_states.transpose(1, 2)
286
+
287
+ cos, sin = position_embeddings
288
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)
289
+
290
+ if past_key_values is not None:
291
+ # sin and cos are specific to RoPE models; position_ids needed for the static cache
292
+ cache_kwargs = {"sin": sin, "cos": cos, "cache_position": cache_position}
293
+ key_states, value_states = past_key_values.update(key_states, value_states, self.layer_idx, cache_kwargs)
294
+
295
+ attention_interface: Callable = eager_attention_forward
296
+ if self.config._attn_implementation != "eager":
297
+ attention_interface = ALL_ATTENTION_FUNCTIONS[self.config._attn_implementation]
298
+
299
+ attn_output, attn_weights = attention_interface(
300
+ self,
301
+ query_states,
302
+ key_states,
303
+ value_states,
304
+ attention_mask,
305
+ dropout=0.0 if not self.training else self.attention_dropout,
306
+ scaling=self.scaling,
307
+ **kwargs,
308
+ )
309
+
310
+ attn_output = attn_output.reshape(*input_shape, -1).contiguous()
311
+ attn_output = self.o_proj(attn_output)
312
+ return attn_output, attn_weights
313
+
314
+
315
+ class MiniMaxM2DecoderLayer(GradientCheckpointingLayer):
316
+ def __init__(self, config: MiniMaxM2Config, layer_idx: int):
317
+ super().__init__()
318
+ self.hidden_size = config.hidden_size
319
+
320
+ self.self_attn = MiniMaxM2Attention(config, layer_idx)
321
+
322
+ self.block_sparse_moe = MiniMaxM2SparseMoeBlock(config)
323
+ self.input_layernorm = MiniMaxM2RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
324
+ self.post_attention_layernorm = MiniMaxM2RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
325
+
326
+ @deprecate_kwarg("past_key_value", new_name="past_key_values", version="4.58")
327
+ def forward(
328
+ self,
329
+ hidden_states: torch.Tensor,
330
+ position_embeddings: tuple[torch.Tensor, torch.Tensor],
331
+ attention_mask: Optional[torch.Tensor] = None,
332
+ position_ids: Optional[torch.LongTensor] = None,
333
+ past_key_values: Optional[Cache] = None,
334
+ cache_position: Optional[torch.LongTensor] = None,
335
+ **kwargs: Unpack[TransformersKwargs],
336
+ ) -> torch.FloatTensor:
337
+ residual = hidden_states
338
+
339
+ hidden_states = self.input_layernorm(hidden_states)
340
+
341
+ # Self Attention
342
+ hidden_states, _ = self.self_attn(
343
+ hidden_states=hidden_states,
344
+ position_embeddings=position_embeddings,
345
+ attention_mask=attention_mask,
346
+ position_ids=position_ids,
347
+ past_key_values=past_key_values,
348
+ cache_position=cache_position,
349
+ **kwargs,
350
+ )
351
+ hidden_states = residual + hidden_states
352
+
353
+ # Fully Connected
354
+ residual = hidden_states
355
+ hidden_states = self.post_attention_layernorm(hidden_states)
356
+ hidden_states, _ = self.block_sparse_moe(hidden_states)
357
+ hidden_states = residual + hidden_states
358
+
359
+ return hidden_states
360
+
361
+
362
+ class MiniMaxM2RotaryEmbedding(nn.Module):
363
+ inv_freq: torch.Tensor # fix linting for `register_buffer`
364
+
365
+ def __init__(self, config: MiniMaxM2Config, device=None):
366
+ super().__init__()
367
+ # BC: "rope_type" was originally "type"
368
+ if hasattr(config, "rope_scaling") and isinstance(config.rope_scaling, dict):
369
+ self.rope_type = config.rope_scaling.get("rope_type", config.rope_scaling.get("type"))
370
+ else:
371
+ self.rope_type = "default"
372
+ self.max_seq_len_cached = config.max_position_embeddings
373
+ self.original_max_seq_len = config.max_position_embeddings
374
+
375
+ self.config = config
376
+ self.rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type]
377
+
378
+ inv_freq, self.attention_scaling = self.rope_init_fn(self.config, device)
379
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
380
+ self.original_inv_freq = self.inv_freq
381
+
382
+ @torch.no_grad()
383
+ @dynamic_rope_update # power user: used with advanced RoPE types (e.g. dynamic rope)
384
+ def forward(self, x, position_ids):
385
+ inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1).to(x.device)
386
+ position_ids_expanded = position_ids[:, None, :].float()
387
+
388
+ device_type = x.device.type if isinstance(x.device.type, str) and x.device.type != "mps" else "cpu"
389
+ with torch.autocast(device_type=device_type, enabled=False): # Force float32
390
+ freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(1, 2)
391
+ emb = torch.cat((freqs, freqs), dim=-1)
392
+ cos = emb.cos() * self.attention_scaling
393
+ sin = emb.sin() * self.attention_scaling
394
+
395
+ return cos.to(dtype=x.dtype), sin.to(dtype=x.dtype)
396
+
397
+
398
+ @auto_docstring
399
+ class MiniMaxM2PreTrainedModel(PreTrainedModel):
400
+ config: MiniMaxM2Config
401
+ base_model_prefix = "model"
402
+ supports_gradient_checkpointing = True
403
+ _no_split_modules = ["MiniMaxM2DecoderLayer"]
404
+ _skip_keys_device_placement = ["past_key_values"]
405
+ _supports_flash_attn = True
406
+ _supports_sdpa = True
407
+ _supports_flex_attn = True
408
+ _can_compile_fullgraph = False # MoE models don't work with torch.compile (`torch.where(condition)` not supported)
409
+ _supports_attention_backend = True
410
+ _can_record_outputs = {
411
+ "router_logits": OutputRecorder(MiniMaxM2SparseMoeBlock, index=1),
412
+ "hidden_states": MiniMaxM2DecoderLayer,
413
+ "attentions": MiniMaxM2Attention,
414
+ }
415
+
416
+
417
+ @auto_docstring
418
+ class MiniMaxM2Model(MiniMaxM2PreTrainedModel):
419
+ def __init__(self, config: MiniMaxM2Config):
420
+ super().__init__(config)
421
+ self.padding_idx = config.pad_token_id
422
+ self.vocab_size = config.vocab_size
423
+
424
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
425
+ self.layers = nn.ModuleList(
426
+ [MiniMaxM2DecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
427
+ )
428
+ self.norm = MiniMaxM2RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
429
+ self.rotary_emb = MiniMaxM2RotaryEmbedding(config=config)
430
+ self.gradient_checkpointing = False
431
+
432
+ # Initialize weights and apply final processing
433
+ self.post_init()
434
+
435
+ @check_model_inputs
436
+ @auto_docstring
437
+ def forward(
438
+ self,
439
+ input_ids: Optional[torch.LongTensor] = None,
440
+ attention_mask: Optional[torch.Tensor] = None,
441
+ position_ids: Optional[torch.LongTensor] = None,
442
+ past_key_values: Optional[Cache] = None,
443
+ inputs_embeds: Optional[torch.FloatTensor] = None,
444
+ use_cache: Optional[bool] = None,
445
+ cache_position: Optional[torch.LongTensor] = None,
446
+ **kwargs: Unpack[TransformersKwargs],
447
+ ) -> MoeModelOutputWithPast:
448
+ if (input_ids is None) ^ (inputs_embeds is not None):
449
+ raise ValueError("You must specify exactly one of input_ids or inputs_embeds")
450
+
451
+ if use_cache and past_key_values is None:
452
+ past_key_values = DynamicCache(config=self.config)
453
+
454
+ if inputs_embeds is None:
455
+ inputs_embeds = self.embed_tokens(input_ids)
456
+
457
+ if cache_position is None:
458
+ past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
459
+ cache_position = torch.arange(
460
+ past_seen_tokens, past_seen_tokens + inputs_embeds.shape[1], device=inputs_embeds.device
461
+ )
462
+ if position_ids is None:
463
+ position_ids = cache_position.unsqueeze(0)
464
+
465
+ mask_function = create_causal_mask if self.config.sliding_window is None else create_sliding_window_causal_mask
466
+ causal_mask = mask_function(
467
+ config=self.config,
468
+ input_embeds=inputs_embeds,
469
+ attention_mask=attention_mask,
470
+ cache_position=cache_position,
471
+ past_key_values=past_key_values,
472
+ position_ids=position_ids,
473
+ )
474
+
475
+ hidden_states = inputs_embeds
476
+
477
+ # create position embeddings to be shared across the decoder layers
478
+ position_embeddings = self.rotary_emb(hidden_states, position_ids)
479
+
480
+ for decoder_layer in self.layers[: self.config.num_hidden_layers]:
481
+ hidden_states = decoder_layer(
482
+ hidden_states,
483
+ position_embeddings=position_embeddings,
484
+ attention_mask=causal_mask,
485
+ position_ids=position_ids,
486
+ past_key_values=past_key_values,
487
+ use_cache=use_cache,
488
+ cache_position=cache_position,
489
+ **kwargs,
490
+ )
491
+
492
+ hidden_states = self.norm(hidden_states)
493
+
494
+ return MoeModelOutputWithPast( # only diff with Mistral is the output type, we need MoE
495
+ last_hidden_state=hidden_states,
496
+ past_key_values=past_key_values,
497
+ )
498
+
499
+
500
+ def load_balancing_loss_func(
501
+ gate_logits: Union[torch.Tensor, tuple[torch.Tensor], None],
502
+ num_experts: Optional[int] = None,
503
+ top_k=2,
504
+ attention_mask: Optional[torch.Tensor] = None,
505
+ ) -> Union[torch.Tensor, int]:
506
+ r"""
507
+ Computes auxiliary load balancing loss as in Switch Transformer - implemented in Pytorch.
508
+
509
+ See Switch Transformer (https://huggingface.co/papers/2101.03961) for more details. This function implements the loss
510
+ function presented in equations (4) - (6) of the paper. It aims at penalizing cases where the routing between
511
+ experts is too unbalanced.
512
+
513
+ Args:
514
+ gate_logits:
515
+ Logits from the `gate`, should be a tuple of model.config.num_hidden_layers tensors of
516
+ shape [batch_size X sequence_length, num_experts].
517
+ num_experts:
518
+ Number of experts
519
+ top_k:
520
+ The number of experts to route per-token, can be also interpreted as the `top-k` routing
521
+ parameter.
522
+ attention_mask (`torch.Tensor`, *optional*):
523
+ The attention_mask used in forward function
524
+ shape [batch_size X sequence_length] if not None.
525
+
526
+ Returns:
527
+ The auxiliary loss.
528
+ """
529
+ if gate_logits is None or not isinstance(gate_logits, tuple):
530
+ return 0
531
+
532
+ if isinstance(gate_logits, tuple):
533
+ compute_device = gate_logits[0].device
534
+ concatenated_gate_logits = torch.cat([layer_gate.to(compute_device) for layer_gate in gate_logits], dim=0)
535
+
536
+ routing_weights = torch.nn.functional.softmax(concatenated_gate_logits, dim=-1)
537
+
538
+ _, selected_experts = torch.topk(routing_weights, top_k, dim=-1)
539
+
540
+ expert_mask = torch.nn.functional.one_hot(selected_experts, num_experts)
541
+
542
+ if attention_mask is None:
543
+ # Compute the percentage of tokens routed to each experts
544
+ tokens_per_expert = torch.mean(expert_mask.float(), dim=0)
545
+
546
+ # Compute the average probability of routing to these experts
547
+ router_prob_per_expert = torch.mean(routing_weights, dim=0)
548
+ else:
549
+ batch_size, sequence_length = attention_mask.shape
550
+ num_hidden_layers = concatenated_gate_logits.shape[0] // (batch_size * sequence_length)
551
+
552
+ # Compute the mask that masks all padding tokens as 0 with the same shape of expert_mask
553
+ expert_attention_mask = (
554
+ attention_mask[None, :, :, None, None]
555
+ .expand((num_hidden_layers, batch_size, sequence_length, top_k, num_experts))
556
+ .reshape(-1, top_k, num_experts)
557
+ .to(compute_device)
558
+ )
559
+
560
+ # Compute the percentage of tokens routed to each experts
561
+ tokens_per_expert = torch.sum(expert_mask.float() * expert_attention_mask, dim=0) / torch.sum(
562
+ expert_attention_mask, dim=0
563
+ )
564
+
565
+ # Compute the mask that masks all padding tokens as 0 with the same shape of tokens_per_expert
566
+ router_per_expert_attention_mask = (
567
+ attention_mask[None, :, :, None]
568
+ .expand((num_hidden_layers, batch_size, sequence_length, num_experts))
569
+ .reshape(-1, num_experts)
570
+ .to(compute_device)
571
+ )
572
+
573
+ # Compute the average probability of routing to these experts
574
+ router_prob_per_expert = torch.sum(routing_weights * router_per_expert_attention_mask, dim=0) / torch.sum(
575
+ router_per_expert_attention_mask, dim=0
576
+ )
577
+
578
+ overall_loss = torch.sum(tokens_per_expert * router_prob_per_expert.unsqueeze(0))
579
+ return overall_loss * num_experts
580
+
581
+
582
+ @auto_docstring
583
+ class MiniMaxM2ForCausalLM(MiniMaxM2PreTrainedModel, GenerationMixin):
584
+ _tied_weights_keys = ["lm_head.weight"]
585
+ _tp_plan = {"lm_head": "colwise_rep"}
586
+ _pp_plan = {"lm_head": (["hidden_states"], ["logits"])}
587
+
588
+ def __init__(self, config):
589
+ super().__init__(config)
590
+ self.model = MiniMaxM2Model(config)
591
+ self.vocab_size = config.vocab_size
592
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
593
+ self.router_aux_loss_coef = config.router_aux_loss_coef
594
+ self.num_experts = config.num_local_experts
595
+ self.num_experts_per_tok = config.num_experts_per_tok
596
+
597
+ # Initialize weights and apply final processing
598
+ self.post_init()
599
+
600
+ @can_return_tuple
601
+ @auto_docstring
602
+ def forward(
603
+ self,
604
+ input_ids: Optional[torch.LongTensor] = None,
605
+ attention_mask: Optional[torch.Tensor] = None,
606
+ position_ids: Optional[torch.LongTensor] = None,
607
+ past_key_values: Optional[Cache] = None,
608
+ inputs_embeds: Optional[torch.FloatTensor] = None,
609
+ labels: Optional[torch.LongTensor] = None,
610
+ use_cache: Optional[bool] = None,
611
+ output_router_logits: Optional[bool] = None,
612
+ cache_position: Optional[torch.LongTensor] = None,
613
+ logits_to_keep: Union[int, torch.Tensor] = 0,
614
+ **kwargs: Unpack[TransformersKwargs],
615
+ ) -> MoeCausalLMOutputWithPast:
616
+ r"""
617
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
618
+ Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
619
+ config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
620
+ (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
621
+
622
+ Example:
623
+
624
+ ```python
625
+ >>> from transformers import AutoTokenizer, MiniMaxM2ForCausalLM
626
+
627
+ >>> model = MiniMaxM2ForCausalLM.from_pretrained("mistralai/MiniMaxM2-8x7B-v0.1")
628
+ >>> tokenizer = AutoTokenizer.from_pretrained("mistralai/MiniMaxM2-8x7B-v0.1")
629
+
630
+ >>> prompt = "Hey, are you conscious? Can you talk to me?"
631
+ >>> inputs = tokenizer(prompt, return_tensors="pt")
632
+
633
+ >>> # Generate
634
+ >>> generate_ids = model.generate(inputs.input_ids, max_length=30)
635
+ >>> tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
636
+ "Hey, are you conscious? Can you talk to me?\nI'm not conscious, but I can talk to you."
637
+ ```"""
638
+
639
+ output_router_logits = (
640
+ output_router_logits if output_router_logits is not None else self.config.output_router_logits
641
+ )
642
+
643
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
644
+ outputs: MoeModelOutputWithPast = self.model(
645
+ input_ids=input_ids,
646
+ attention_mask=attention_mask,
647
+ position_ids=position_ids,
648
+ past_key_values=past_key_values,
649
+ inputs_embeds=inputs_embeds,
650
+ use_cache=use_cache,
651
+ output_router_logits=output_router_logits,
652
+ cache_position=cache_position,
653
+ **kwargs,
654
+ )
655
+
656
+ hidden_states = outputs.last_hidden_state
657
+ # Only compute necessary logits, and do not upcast them to float if we are not computing the loss
658
+ slice_indices = slice(-logits_to_keep, None) if isinstance(logits_to_keep, int) else logits_to_keep
659
+ logits = self.lm_head(hidden_states[:, slice_indices, :])
660
+
661
+ loss = None
662
+ if labels is not None:
663
+ loss = self.loss_function(logits, labels, self.vocab_size, **kwargs)
664
+
665
+ aux_loss = None
666
+ if output_router_logits:
667
+ aux_loss = load_balancing_loss_func(
668
+ outputs.router_logits,
669
+ self.num_experts,
670
+ self.num_experts_per_tok,
671
+ attention_mask,
672
+ )
673
+ if labels is not None:
674
+ loss += self.router_aux_loss_coef * aux_loss.to(loss.device) # make sure to reside in the same device
675
+
676
+ return MoeCausalLMOutputWithPast(
677
+ loss=loss,
678
+ aux_loss=aux_loss,
679
+ logits=logits,
680
+ past_key_values=outputs.past_key_values,
681
+ hidden_states=outputs.hidden_states,
682
+ attentions=outputs.attentions,
683
+ router_logits=outputs.router_logits,
684
+ )
685
+
686
+
687
+ class MiniMaxM2ForSequenceClassification(GenericForSequenceClassification, MiniMaxM2PreTrainedModel):
688
+ pass
689
+
690
+
691
+ class MiniMaxM2ForTokenClassification(GenericForTokenClassification, MiniMaxM2PreTrainedModel):
692
+ pass
693
+
694
+
695
+ class MiniMaxM2ForQuestionAnswering(GenericForQuestionAnswering, MiniMaxM2PreTrainedModel):
696
+ pass
697
+
698
+
699
+ __all__ = [
700
+ "MiniMaxM2ForCausalLM",
701
+ "MiniMaxM2ForQuestionAnswering",
702
+ "MiniMaxM2Model",
703
+ "MiniMaxM2PreTrainedModel",
704
+ "MiniMaxM2ForSequenceClassification",
705
+ "MiniMaxM2ForTokenClassification",
706
+ ]
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2b0639a138c0ccae63bce932b102cd4e1a344a9b7374cc3a9d42512592ddb52f
3
+ size 15522577
tokenizer_config.json ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "]~!b[",
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "[e~[",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<code_interpreter>",
10
+ "<commit_after>",
11
+ "<commit_before>",
12
+ "<commit_msg>",
13
+ "<empty_output>",
14
+ "<filename>",
15
+ "<fim_middle>",
16
+ "<fim_pad>",
17
+ "<fim_prefix>",
18
+ "<fim_suffix>",
19
+ "<function_call>",
20
+ "<gh_stars>",
21
+ "]<]speech[>[",
22
+ "]<]image[>[",
23
+ "]<]video[>[",
24
+ "]<]start of speech[>[",
25
+ "]<]end of speech[>[",
26
+ "]<]start of image[>[",
27
+ "]<]end of image[>[",
28
+ "]<]start of video[>[",
29
+ "]<]end of video[>[",
30
+ "]<]vision pad[>[",
31
+ "]~!b[",
32
+ "<issue_closed>",
33
+ "<issue_comment>",
34
+ "<issue_start>",
35
+ "<jupyter_code>",
36
+ "<jupyter_output>",
37
+ "<jupyter_start>",
38
+ "<jupyter_text>",
39
+ "<reponame>",
40
+ "[e~[",
41
+ "]!d~[",
42
+ "]!p~[",
43
+ "]~b]",
44
+ "<jupyter_error>",
45
+ "<add_file>",
46
+ "<delete_file>",
47
+ "<rename_file>",
48
+ "<edit_file>",
49
+ "<commit_message>",
50
+ "<empty_source_file>",
51
+ "<repo_struct>",
52
+ "<code_context>",
53
+ "<file_content>",
54
+ "<source_files>",
55
+ "<pr_start>",
56
+ "<review_comment>",
57
+ "<filepath>",
58
+ "<file_sep>"
59
+ ],
60
+ "is_local": true,
61
+ "model_max_length": 40960000,
62
+ "pad_token": null,
63
+ "tokenizer_class": "GPT2Tokenizer",
64
+ "tool_parser_type": "minimax_m2",
65
+ "unk_token": "]!d~["
66
+ }