Upload model
Browse filesFiles changed (37)
- .gitattributes+2
- README.mdAdded
- added_tokens.jsonAdded+56
- chat_template.jinjaAdded+159
- config.jsonAdded+306
- configuration_minimax_m2.pyAdded+200
- generation_config.jsonAdded+8
- merges.txtAdded
- model-00001-of-00023.safetensorsAdded+3
- model-00002-of-00023.safetensorsAdded+3
- model-00003-of-00023.safetensorsAdded+3
- model-00004-of-00023.safetensorsAdded+3
- model-00005-of-00023.safetensorsAdded+3
- model-00006-of-00023.safetensorsAdded+3
- model-00007-of-00023.safetensorsAdded+3
- model-00008-of-00023.safetensorsAdded+3
- model-00009-of-00023.safetensorsAdded+3
- model-00010-of-00023.safetensorsAdded+3
- model-00011-of-00023.safetensorsAdded+3
- model-00012-of-00023.safetensorsAdded+3
- model-00013-of-00023.safetensorsAdded+3
- model-00014-of-00023.safetensorsAdded+3
- model-00015-of-00023.safetensorsAdded+3
- model-00016-of-00023.safetensorsAdded+3
- model-00017-of-00023.safetensorsAdded+3
- model-00018-of-00023.safetensorsAdded+3
- model-00019-of-00023.safetensorsAdded+3
- model-00020-of-00023.safetensorsAdded+3
- model-00021-of-00023.safetensorsAdded+3
- model-00022-of-00023.safetensorsAdded+3
- model-00023-of-00023.safetensorsAdded+3
- model.safetensors.index.jsonAdded+3
- quantization_config.jsonAdded+198
- special_tokens_map.jsonAdded+75
- tokenizer.jsonAdded+3
- tokenizer_config.jsonAdded+496
- vocab.jsonAdded
32 unmodified lines333435363732 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textmodel.safetensors.index.json filter=lfs diff=lfs merge=lfs -texttokenizer.json filter=lfs diff=lfs merge=lfs -text1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556{ "</minimax:tool_call>": 200053, "</think>": 200051, "<add_file>": 200036, "<code_context>": 200043, "<code_interpreter>": 200023, "<commit_after>": 200018, "<commit_before>": 200016, "<commit_message>": 200040, "<commit_msg>": 200017, "<delete_file>": 200037, "<edit_file>": 200039, "<empty_output>": 200015, "<empty_source_file>": 200041, "<file_content>": 200044, "<file_sep>": 200049, "<filename>": 200006, "<filepath>": 200048, "<fim_middle>": 200002, "<fim_pad>": 200004, "<fim_prefix>": 200001, "<fim_suffix>": 200003, "<function_call>": 200022, "<gh_stars>": 200007, "<issue_closed>": 200010, "<issue_comment>": 200009, "<issue_start>": 200008, "<jupyter_code>": 200013, "<jupyter_error>": 200035, "<jupyter_output>": 200014, "<jupyter_start>": 200011, "<jupyter_text>": 200012, "<minimax:tool_call>": 200052, "<pr_start>": 200046, "<rename_file>": 200038, "<repo_struct>": 200042, "<reponame>": 200005, "<review_comment>": 200047, "<source_files>": 200045, "<think>": 200050, "[e~[": 200020, "]!d~[": 200021, "]!p~[": 200000, "]<]end of image[>[": 200030, "]<]end of speech[>[": 200028, "]<]end of video[>[": 200032, "]<]image[>[": 200025, "]<]speech[>[": 200024, "]<]start of image[>[": 200029, "]<]start of speech[>[": 200027, "]<]start of video[>[": 200031, "]<]video[>[": 200026, "]<]vision pad[>[": 200033, "]~!b[": 200034, "]~b]": 200019}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159{# ----------‑‑‑ special token variables ‑‑‑---------- #}{%- set toolcall_begin_token = '<minimax:tool_call>' -%}{%- set toolcall_end_token = '</minimax:tool_call>' -%}{#- Tool Rendering Functions ============================================== -#}{%- macro render_tool_namespace(namespace_name, tool_list) -%}{%- for tool in tool_list -%}<tool>{{ tool.function | tojson(ensure_ascii=False) }}</tool>{% endfor -%}{%- endmacro -%}{%- macro visible_text(content) -%} {%- if content is string -%} {{ content }} {%- elif content is iterable and content is not mapping -%} {%- for item in content -%} {%- if item is mapping and item.type == 'text' -%} {{- item.text }} {%- elif item is string -%} {{- item }} {%- endif -%} {%- endfor -%} {%- else -%} {{- content }} {%- endif -%}{%- endmacro -%}{#- System Message Construction ============================================ -#}{%- macro build_system_message(system_message) -%} {%- if system_message and system_message.content -%} {{- visible_text(system_message.content) }} {%- else -%} {%- if model_identity is not defined -%} {%- set model_identity = "You are a helpful assistant. Your name is MiniMax-M2.5 and is built by MiniMax." -%} {%- endif -%} {{- model_identity }} {%- endif -%} {#- Handle current_date -#} {%- if system_message and system_message.current_date -%} {{- '\n' ~ 'Current date: ' + system_message.current_date }} {%- endif -%} {#- Handle current_location -#} {%- if system_message and system_message.current_location -%} {{- '\n' ~ 'Current location: ' + system_message.current_location }} {%- endif -%}{%- endmacro -%}{#- Main Template Logic ================================================= -#}{#- Extract system message (only first message if it's system) -#}{%- set system_message = none -%}{%- set conversation_messages = messages -%}{%- if messages and messages[0].role == "system" -%} {%- set system_message = messages[0] -%} {%- set conversation_messages = messages[1:] -%}{%- endif -%}{#- Get the last user message turn, for interleved thinking -#}{%- set ns = namespace(last_user_index=-1) %}{% for m in conversation_messages %} {%- if m.role == 'user' %} {% set ns.last_user_index = loop.index0 -%} {%- endif %}{%- endfor %}{#- Render system message -#}{{- ']~!b[' ~ ']~b]system' ~ '\n' }}{{- build_system_message(system_message) }}{#- Render tools if available -#}{%- if tools -%} {{- '\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' }} {{- '\n' ~ '<tools>' ~ '\n' }} {{- render_tool_namespace("functions", tools) }} {{- '</tools>' ~ '\n\n' }}{{- 'When making tool calls, use XML format to invoke tools and pass parameters:' ~ '\n' }}{{- '\n' ~ toolcall_begin_token }}<invoke name="tool-name-1"><parameter name="param-key-1">param-value-1</parameter><parameter name="param-key-2">param-value-2</parameter>...</invoke>{{- '\n' ~ toolcall_end_token }}{%- endif -%}{{- '[e~[\n' }}
{#- Render messages -#}{%- set last_tool_call = namespace(name=none) -%}{%- for message in conversation_messages -%} {%- if message.role == 'assistant' -%} {#- Only render reasoning_content if no user message follows -#} {{- ']~b]ai' ~ '\n' }}
{%- set reasoning_content = '' %} {%- set content = visible_text(message.content) %} {%- if message.reasoning_content is string %} {%- set reasoning_content = message.reasoning_content %} {%- else %} {%- if '</think>' in content %} {%- set reasoning_content = content.split('</think>')[0].strip('\n').split('<think>')[-1].strip('\n') %} {%- set content = content.split('</think>')[-1].strip('\n') %} {%- endif %} {%- endif %} {%- if reasoning_content and loop.index0 > ns.last_user_index -%} {{- '<think>' ~ '\n' ~ reasoning_content ~ '\n' ~ '</think>' ~ '\n\n' }} {%- endif -%} {%- if content -%} {{- content }} {%- endif -%} {%- if message.tool_calls -%} {{- '\n' ~ toolcall_begin_token ~ '\n' }}
{%- for tool_call in message.tool_calls -%} {%- if tool_call.function %} {%- set tool_call = tool_call.function %} {%- endif %} {{- '<invoke name="' + tool_call.name + '">' }} {% set _args = tool_call.arguments %} {%- for k, v in _args.items() %} {{- '<parameter name="' + k + '">' }} {{- v | tojson(ensure_ascii=False) if v is not string else v }} {{- '</parameter>' }} {% endfor %} {{- '</invoke>' ~ '\n' }} {%- endfor -%} {{- toolcall_end_token}} {%- set last_tool_call.name = message.tool_calls[-1].name -%} {%- else -%} {%- set last_tool_call.name = none -%} {%- endif -%} {{- '[e~[' ~ '\n' }} {%- elif message.role == 'tool' -%} {%- if last_tool_call.name is none -%} {{- raise_exception("Message has tool role, but there was no previous assistant message with a tool call!") }} {%- endif -%} {%- if loop.first or (conversation_messages[loop.index0 - 1].role != 'tool') -%} {{- ']~b]tool' }} {%- endif -%} {%- if message.content is string -%} {{- '\n<response>' }} {{- message.content }} {{- '</response>' }} {%- else -%} {%- for tr in message.content -%} {{- '\n<response>' }} {{- tr.output if tr.output is defined else (tr.text if tr.type == 'text' and tr.text is defined else tr) }} {{- '\n</response>' }} {%- endfor -%} {%- endif -%} {%- if loop.last or (conversation_messages[loop.index0 + 1].role != 'tool') -%} {{- '[e~[\n' -}} {%- endif -%} {%- elif message.role == 'user' -%} {{- ']~b]user' ~ '\n' }} {{- visible_text(message.content) }} {{- '[e~[' ~ '\n' }} {%- endif -%}{%- endfor -%}
{#- Generation prompt -#}{%- if add_generation_prompt -%}{{- ']~b]ai' ~ '\n' ~ '<think>' ~ '\n' }}{%- endif -%}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306{ "architectures": [ "MiniMaxM2ForCausalLM" ], "attention_dropout": 0.0, "attn_type_list": [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], "auto_map": { "AutoConfig": "configuration_minimax_m2.MiniMaxM2Config", "AutoModelForCausalLM": "modeling_minimax_m2.MiniMaxM2ForCausalLM" }, "bos_token_id": 1, "eos_token_id": 2, "head_dim": 128, "hidden_act": "silu", "hidden_size": 3072, "initializer_range": 0.02, "intermediate_size": 1536, "max_position_embeddings": 196608, "model_type": "minimax_m2", "mtp_transformer_layers": 1, "num_attention_heads": 48, "num_experts_per_tok": 8, "num_hidden_layers": 62, "num_key_value_heads": 8, "num_local_experts": 256, "num_mtp_modules": 3, "output_router_logits": false, "partial_rotary_factor": 0.5, "qk_norm_type": "per_layer", "quantization_config": { "autoround_version": "0.12.0", "bits": 4, "data_type": "int", "extra_config": { "model.layers.0.block_sparse_moe.gate": { "bits": 8 }, "model.layers.1.block_sparse_moe.gate": { "bits": 8 }, "model.layers.10.block_sparse_moe.gate": { "bits": 8 }, "model.layers.11.block_sparse_moe.gate": { "bits": 8 }, "model.layers.12.block_sparse_moe.gate": { "bits": 8 }, "model.layers.13.block_sparse_moe.gate": { "bits": 8 }, "model.layers.14.block_sparse_moe.gate": { "bits": 8 }, "model.layers.15.block_sparse_moe.gate": { "bits": 8 }, "model.layers.16.block_sparse_moe.gate": { "bits": 8 }, "model.layers.17.block_sparse_moe.gate": { "bits": 8 }, "model.layers.18.block_sparse_moe.gate": { "bits": 8 }, "model.layers.19.block_sparse_moe.gate": { "bits": 8 }, "model.layers.2.block_sparse_moe.gate": { "bits": 8 }, "model.layers.20.block_sparse_moe.gate": { "bits": 8 }, "model.layers.21.block_sparse_moe.gate": { "bits": 8 }, "model.layers.22.block_sparse_moe.gate": { "bits": 8 }, "model.layers.23.block_sparse_moe.gate": { "bits": 8 }, "model.layers.24.block_sparse_moe.gate": { "bits": 8 }, "model.layers.25.block_sparse_moe.gate": { "bits": 8 }, "model.layers.26.block_sparse_moe.gate": { "bits": 8 }, "model.layers.27.block_sparse_moe.gate": { "bits": 8 }, "model.layers.28.block_sparse_moe.gate": { "bits": 8 }, "model.layers.29.block_sparse_moe.gate": { "bits": 8 }, "model.layers.3.block_sparse_moe.gate": { "bits": 8 }, "model.layers.30.block_sparse_moe.gate": { "bits": 8 }, "model.layers.31.block_sparse_moe.gate": { "bits": 8 }, "model.layers.32.block_sparse_moe.gate": { "bits": 8 }, "model.layers.33.block_sparse_moe.gate": { "bits": 8 }, "model.layers.34.block_sparse_moe.gate": { "bits": 8 }, "model.layers.35.block_sparse_moe.gate": { "bits": 8 }, "model.layers.36.block_sparse_moe.gate": { "bits": 8 }, "model.layers.37.block_sparse_moe.gate": { "bits": 8 }, "model.layers.38.block_sparse_moe.gate": { "bits": 8 }, "model.layers.39.block_sparse_moe.gate": { "bits": 8 }, "model.layers.4.block_sparse_moe.gate": { "bits": 8 }, "model.layers.40.block_sparse_moe.gate": { "bits": 8 }, "model.layers.41.block_sparse_moe.gate": { "bits": 8 }, "model.layers.42.block_sparse_moe.gate": { "bits": 8 }, "model.layers.43.block_sparse_moe.gate": { "bits": 8 }, "model.layers.44.block_sparse_moe.gate": { "bits": 8 }, "model.layers.45.block_sparse_moe.gate": { "bits": 8 }, "model.layers.46.block_sparse_moe.gate": { "bits": 8 }, "model.layers.47.block_sparse_moe.gate": { "bits": 8 }, "model.layers.48.block_sparse_moe.gate": { "bits": 8 }, "model.layers.49.block_sparse_moe.gate": { "bits": 8 }, "model.layers.5.block_sparse_moe.gate": { "bits": 8 }, "model.layers.50.block_sparse_moe.gate": { "bits": 8 }, "model.layers.51.block_sparse_moe.gate": { "bits": 8 }, "model.layers.52.block_sparse_moe.gate": { "bits": 8 }, "model.layers.53.block_sparse_moe.gate": { "bits": 8 }, "model.layers.54.block_sparse_moe.gate": { "bits": 8 }, "model.layers.55.block_sparse_moe.gate": { "bits": 8 }, "model.layers.56.block_sparse_moe.gate": { "bits": 8 }, "model.layers.57.block_sparse_moe.gate": { "bits": 8 }, "model.layers.58.block_sparse_moe.gate": { "bits": 8 }, "model.layers.59.block_sparse_moe.gate": { "bits": 8 }, "model.layers.6.block_sparse_moe.gate": { "bits": 8 }, "model.layers.60.block_sparse_moe.gate": { "bits": 8 }, "model.layers.61.block_sparse_moe.gate": { "bits": 8 }, "model.layers.7.block_sparse_moe.gate": { "bits": 8 }, "model.layers.8.block_sparse_moe.gate": { "bits": 8 }, "model.layers.9.block_sparse_moe.gate": { "bits": 8 } }, "group_size": 128, "iters": 0, "packing_format": "auto_round:auto_gptq", "quant_method": "auto-round", "sym": true }, "rms_norm_eps": 1e-06, "rope_theta": 5000000, "rotary_dim": 64, "router_aux_loss_coef": 0.001, "router_jitter_noise": 0.0, "scoring_func": "sigmoid", "shared_intermediate_size": 0, "sliding_window": null, "tie_word_embeddings": false, "transformers_version": "4.57.1", "use_cache": true, "use_mtp": true, "use_qk_norm": true, "use_routing_bias": true, "vocab_size": 200064}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200# 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨# This file was automatically generated from src/transformers/models/minimax_m2/modular_minimax_m2.py.# Do NOT edit this file manually as any edits will be overwritten by the generation of# the file from the modular. If any change should be done, please apply the change to the# modular_minimax_m2.py file directly. One of our CI enforces this.# 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨# coding=utf-8# Copyright 2025 the HuggingFace Team. All rights reserved.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.
from transformers.configuration_utils import PretrainedConfig
class MiniMaxM2Config(PretrainedConfig): r""" This is the configuration class to store the configuration of a [`MiniMaxM2Model`]. It is used to instantiate an MiniMaxM2 model according to the specified arguments, defining the model architecture. Instantiating a configuration with the defaults will yield a similar configuration to that of the MiniMaxM2-7B-v0.1 or MiniMaxM2-7B-Instruct-v0.1.
[minimax_m2ai/MiniMaxM2-8x7B](https://huggingface.co/minimax_m2ai/MiniMaxM2-8x7B) [minimax_m2ai/MiniMaxM2-7B-Instruct-v0.1](https://huggingface.co/minimax_m2ai/MiniMaxM2-7B-Instruct-v0.1)
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the documentation from [`PretrainedConfig`] for more information.
Args: vocab_size (`int`, *optional*, defaults to 32000): Vocabulary size of the MiniMaxM2 model. Defines the number of different tokens that can be represented by the `inputs_ids` passed when calling [`MiniMaxM2Model`] hidden_size (`int`, *optional*, defaults to 4096): Dimension of the hidden representations. intermediate_size (`int`, *optional*, defaults to 14336): Dimension of the MLP representations. num_hidden_layers (`int`, *optional*, defaults to 32): Number of hidden layers in the Transformer encoder. num_attention_heads (`int`, *optional*, defaults to 32): Number of attention heads for each attention layer in the Transformer encoder. num_key_value_heads (`int`, *optional*, defaults to 8): This is the number of key_value heads that should be used to implement Grouped Query Attention. If `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if `num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed by meanpooling all the original heads within that group. For more details, check out [this paper](https://huggingface.co/papers/2305.13245). If it is not specified, will default to `8`. head_dim (`int`, *optional*, defaults to `hidden_size // num_attention_heads`): The attention head dimension. hidden_act (`str` or `function`, *optional*, defaults to `"silu"`): The non-linear activation function (function or string) in the decoder. max_position_embeddings (`int`, *optional*, defaults to `4096*32`): The maximum sequence length that this model might ever be used with. MiniMaxM2's sliding window attention allows sequence of up to 4096*32 tokens. initializer_range (`float`, *optional*, defaults to 0.02): The standard deviation of the truncated_normal_initializer for initializing all weight matrices. rms_norm_eps (`float`, *optional*, defaults to 1e-05): The epsilon used by the rms normalization layers. use_cache (`bool`, *optional*, defaults to `True`): Whether or not the model should return the last key/values attentions (not used by all models). Only relevant if `config.is_decoder=True`. pad_token_id (`int`, *optional*): The id of the padding token. bos_token_id (`int`, *optional*, defaults to 1): The id of the "beginning-of-sequence" token. eos_token_id (`int`, *optional*, defaults to 2): The id of the "end-of-sequence" token. tie_word_embeddings (`bool`, *optional*, defaults to `False`): Whether the model's input and output word embeddings should be tied. rope_theta (`float`, *optional*, defaults to 1000000.0): The base period of the RoPE embeddings. sliding_window (`int`, *optional*): Sliding window attention window size. If not specified, will default to `4096`. attention_dropout (`float`, *optional*, defaults to 0.0): The dropout ratio for the attention probabilities. num_experts_per_tok (`int`, *optional*, defaults to 2): The number of experts to route per-token, can be also interpreted as the `top-k` routing parameter num_local_experts (`int`, *optional*, defaults to 8): Number of experts per Sparse MLP layer. output_router_logits (`bool`, *optional*, defaults to `False`): Whether or not the router logits should be returned by the model. Enabling this will also allow the model to output the auxiliary loss. See [here]() for more details router_aux_loss_coef (`float`, *optional*, defaults to 0.001): The aux loss factor for the total loss. router_jitter_noise (`float`, *optional*, defaults to 0.0): Amount of noise to add to the router.
```python >>> from transformers import MiniMaxM2Model, MiniMaxM2Config
>>> # Initializing a MiniMaxM2 7B style configuration >>> configuration = MiniMaxM2Config()
>>> # Initializing a model from the MiniMaxM2 7B style configuration >>> model = MiniMaxM2Model(configuration)
>>> # Accessing the model configuration >>> configuration = model.config ```"""
model_type = "minimax_m2" keys_to_ignore_at_inference = ["past_key_values"] base_model_tp_plan = { "layers.*.self_attn.q_proj": "colwise", "layers.*.self_attn.k_proj": "colwise", "layers.*.self_attn.v_proj": "colwise", "layers.*.self_attn.o_proj": "rowwise", "layers.*.block_sparse_moe.gate": "colwise_rep", # we need to replicate here to correctly route experts "layers.*.block_sparse_moe.experts.*.w1": "colwise", "layers.*.block_sparse_moe.experts.*.w2": "rowwise", "layers.*.block_sparse_moe.experts.*.w3": "colwise", } base_model_pp_plan = { "embed_tokens": (["input_ids"], ["inputs_embeds"]), "layers": (["hidden_states", "attention_mask"], ["hidden_states"]), "norm": (["hidden_states"], ["hidden_states"]), }
def __init__( self, vocab_size=32000, hidden_size=4096, intermediate_size=14336, num_hidden_layers=32, num_attention_heads=32, num_key_value_heads=8, head_dim=None, hidden_act="silu", max_position_embeddings=4096 * 32, initializer_range=0.02, rms_norm_eps=1e-5, use_cache=True, pad_token_id=None, bos_token_id=1, eos_token_id=2, tie_word_embeddings=False, rope_theta=1e6, sliding_window=None, attention_dropout=0.0, num_experts_per_tok=2, num_local_experts=8, output_router_logits=False, router_aux_loss_coef=0.001, router_jitter_noise=0.0, **kwargs, ): self.vocab_size = vocab_size self.max_position_embeddings = max_position_embeddings self.hidden_size = hidden_size self.intermediate_size = intermediate_size self.num_hidden_layers = num_hidden_layers self.num_attention_heads = num_attention_heads self.sliding_window = sliding_window
# for backward compatibility if num_key_value_heads is None: num_key_value_heads = num_attention_heads
self.num_key_value_heads = num_key_value_heads self.hidden_act = hidden_act self.initializer_range = initializer_range self.rms_norm_eps = rms_norm_eps self.use_cache = use_cache self.rope_theta = rope_theta self.attention_dropout = attention_dropout self.head_dim = head_dim
self.num_experts_per_tok = num_experts_per_tok self.num_local_experts = num_local_experts self.output_router_logits = output_router_logits self.router_aux_loss_coef = router_aux_loss_coef self.router_jitter_noise = router_jitter_noise
self.use_qk_norm = kwargs.pop("use_qk_norm", False) self.rotary_dim = kwargs.pop("rotary_dim", self.head_dim) self.partial_rotary_factor = kwargs.pop("partial_rotary_factor", 1) if self.head_dim is not None: self.partial_rotary_factor = self.rotary_dim / self.head_dim
super().__init__( pad_token_id=pad_token_id, bos_token_id=bos_token_id, eos_token_id=eos_token_id, tie_word_embeddings=tie_word_embeddings, **kwargs, )
__all__ = ["MiniMaxM2Config"]12345678{ "bos_token_id": 200019, "do_sample": true, "eos_token_id": 200020, "top_k": 40, "top_p": 0.95, "transformers_version": "4.57.1"}123version https://git-lfs.github.com/spec/v1oid sha256:ac7ccdfbcf8f0f716981ee073d3da4514979755a9dccc4304747f0c09f777863size 5369490592123version https://git-lfs.github.com/spec/v1oid sha256:5ba97056e3bb75a0a5aaaa1b0a0cb2ab062883c721c1476063fb35cfb9652470size 5369490592123version https://git-lfs.github.com/spec/v1oid sha256:816ac5aa324c319fd7a1217601c230a071c7d7d3f9406ae6bbf493359780af41size 5369490592123version https://git-lfs.github.com/spec/v1oid sha256:9c00a8f7fe0dfb8580e4ed6485ec6f1b8cf39153c40a508226685ab17499f6dfsize 5369493832123version https://git-lfs.github.com/spec/v1oid sha256:273bc78e70bb10f788576577f15d6b0d60dda145663c4a866a7670f76565b7cfsize 5369497552123version https://git-lfs.github.com/spec/v1oid sha256:ad57849acd81f99552eb1781a644b697407a57229f77050feb7f5f90f4f50330size 5367877136123version https://git-lfs.github.com/spec/v1oid sha256:79342625686be14f8cfd147ba43283da4edc89313d568693f64aab553f259a9bsize 5369497120123version https://git-lfs.github.com/spec/v1oid sha256:0237ef0a1e558673ab4530e809fb45bd609a1be4fee34ebb6269676988ff86afsize 5369497120123version https://git-lfs.github.com/spec/v1oid sha256:67ad6d8ad67d8a51c290115412a76da49ae1bc3d3de554bbc005ecd9368c8542size 5369497248123version https://git-lfs.github.com/spec/v1oid sha256:69155430d9b29a777fd318831b2cd58e052f9c4ef1568de68602e4b630ae11d0size 5369497552123version https://git-lfs.github.com/spec/v1oid sha256:e1130cdf7b9c2ff3607abfa17a86d505e6b7fd8388a94e3b1e0a934a197a6e3bsize 5367877320123version https://git-lfs.github.com/spec/v1oid sha256:ad87c79aaf8b433ccdef76d7611a73181b71c1cf873ea9f35a3c5ef0691e00desize 5369497120123version https://git-lfs.github.com/spec/v1oid sha256:3935d2640f537adc7365c32f03b7e62e3d544ce0abbe95d541deccfc5fe4132fsize 5369497120123version https://git-lfs.github.com/spec/v1oid sha256:1b35ec88a46795b5608610c6ec7f948f8851110bf6d972dcf1480ca5d93ecee0size 5369497120123version https://git-lfs.github.com/spec/v1oid sha256:94c6b72fd6057147aa896d0df469d9d6bbb42e6bcaa12c1c70186ed385a68710size 5369497488123version https://git-lfs.github.com/spec/v1oid sha256:6bf054f3f80d90b77abbb19858031bcfff76ced7117dac966f9f40a700e872a7size 5369497552123version https://git-lfs.github.com/spec/v1oid sha256:03caa0781ee0f767c121a9aa8fcd45fc898f42ac7d36fff17a24ac688a009f11size 5367877072123version https://git-lfs.github.com/spec/v1oid sha256:f5583b36d5e861574406d582621f2ba279a3c160c7e334baf6c917becdd9a77csize 5369497120123version https://git-lfs.github.com/spec/v1oid sha256:76cd64b81f6c8d45ddd870a802a4fe2670e4aacee50c4f677e96036836505d6csize 5369497120123version https://git-lfs.github.com/spec/v1oid sha256:7a458f28239666aea5534261f5e387cf28caf720391fad6b5ec0d0aabe5e6e11size 5369497304123version https://git-lfs.github.com/spec/v1oid sha256:bd85423b16cf7a337cb36fd93fd72a5170d67565b3f1f0f3e6a6dcf9f8c94382size 5369497552123version https://git-lfs.github.com/spec/v1oid sha256:752e0e58ef03923e33d1336cc61178486d18b3be38306430a5b3d883f28ef38esize 5367877264123version https://git-lfs.github.com/spec/v1oid sha256:7ce66ef48736486420112b1fcd566664e7cba390bf8483d9c955864f96660b9fsize 2553281576123version https://git-lfs.github.com/spec/v1oid sha256:c2c76f965bec7f8f91ae1e10c70258cc1604de2ae20462488cbfd1cd8b1c62f5size 14068102123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198{ "bits": 4, "data_type": "int", "group_size": 128, "sym": true, "iters": 0, "autoround_version": "0.12.0", "quant_method": "auto-round", "packing_format": "auto_round:auto_gptq", "extra_config": { "model.layers.0.block_sparse_moe.gate": { "bits": 8 }, "model.layers.1.block_sparse_moe.gate": { "bits": 8 }, "model.layers.2.block_sparse_moe.gate": { "bits": 8 }, "model.layers.3.block_sparse_moe.gate": { "bits": 8 }, "model.layers.4.block_sparse_moe.gate": { "bits": 8 }, "model.layers.5.block_sparse_moe.gate": { "bits": 8 }, "model.layers.6.block_sparse_moe.gate": { "bits": 8 }, "model.layers.7.block_sparse_moe.gate": { "bits": 8 }, "model.layers.8.block_sparse_moe.gate": { "bits": 8 }, "model.layers.9.block_sparse_moe.gate": { "bits": 8 }, "model.layers.10.block_sparse_moe.gate": { "bits": 8 }, "model.layers.11.block_sparse_moe.gate": { "bits": 8 }, "model.layers.12.block_sparse_moe.gate": { "bits": 8 }, "model.layers.13.block_sparse_moe.gate": { "bits": 8 }, "model.layers.14.block_sparse_moe.gate": { "bits": 8 }, "model.layers.15.block_sparse_moe.gate": { "bits": 8 }, "model.layers.16.block_sparse_moe.gate": { "bits": 8 }, "model.layers.17.block_sparse_moe.gate": { "bits": 8 }, "model.layers.18.block_sparse_moe.gate": { "bits": 8 }, "model.layers.19.block_sparse_moe.gate": { "bits": 8 }, "model.layers.20.block_sparse_moe.gate": { "bits": 8 }, "model.layers.21.block_sparse_moe.gate": { "bits": 8 }, "model.layers.22.block_sparse_moe.gate": { "bits": 8 }, "model.layers.23.block_sparse_moe.gate": { "bits": 8 }, "model.layers.24.block_sparse_moe.gate": { "bits": 8 }, "model.layers.25.block_sparse_moe.gate": { "bits": 8 }, "model.layers.26.block_sparse_moe.gate": { "bits": 8 }, "model.layers.27.block_sparse_moe.gate": { "bits": 8 }, "model.layers.28.block_sparse_moe.gate": { "bits": 8 }, "model.layers.29.block_sparse_moe.gate": { "bits": 8 }, "model.layers.30.block_sparse_moe.gate": { "bits": 8 }, "model.layers.31.block_sparse_moe.gate": { "bits": 8 }, "model.layers.32.block_sparse_moe.gate": { "bits": 8 }, "model.layers.33.block_sparse_moe.gate": { "bits": 8 }, "model.layers.34.block_sparse_moe.gate": { "bits": 8 }, "model.layers.35.block_sparse_moe.gate": { "bits": 8 }, "model.layers.36.block_sparse_moe.gate": { "bits": 8 }, "model.layers.37.block_sparse_moe.gate": { "bits": 8 }, "model.layers.38.block_sparse_moe.gate": { "bits": 8 }, "model.layers.39.block_sparse_moe.gate": { "bits": 8 }, "model.layers.40.block_sparse_moe.gate": { "bits": 8 }, "model.layers.41.block_sparse_moe.gate": { "bits": 8 }, "model.layers.42.block_sparse_moe.gate": { "bits": 8 }, "model.layers.43.block_sparse_moe.gate": { "bits": 8 }, "model.layers.44.block_sparse_moe.gate": { "bits": 8 }, "model.layers.45.block_sparse_moe.gate": { "bits": 8 }, "model.layers.46.block_sparse_moe.gate": { "bits": 8 }, "model.layers.47.block_sparse_moe.gate": { "bits": 8 }, "model.layers.48.block_sparse_moe.gate": { "bits": 8 }, "model.layers.49.block_sparse_moe.gate": { "bits": 8 }, "model.layers.50.block_sparse_moe.gate": { "bits": 8 }, "model.layers.51.block_sparse_moe.gate": { "bits": 8 }, "model.layers.52.block_sparse_moe.gate": { "bits": 8 }, "model.layers.53.block_sparse_moe.gate": { "bits": 8 }, "model.layers.54.block_sparse_moe.gate": { "bits": 8 }, "model.layers.55.block_sparse_moe.gate": { "bits": 8 }, "model.layers.56.block_sparse_moe.gate": { "bits": 8 }, "model.layers.57.block_sparse_moe.gate": { "bits": 8 }, "model.layers.58.block_sparse_moe.gate": { "bits": 8 }, "model.layers.59.block_sparse_moe.gate": { "bits": 8 }, "model.layers.60.block_sparse_moe.gate": { "bits": 8 }, "model.layers.61.block_sparse_moe.gate": { "bits": 8 } }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475{ "additional_special_tokens": [ "<code_interpreter>", "<commit_after>", "<commit_before>", "<commit_msg>", "<empty_output>", "<filename>", "<fim_middle>", "<fim_pad>", "<fim_prefix>", "<fim_suffix>", "<function_call>", "<gh_stars>", "]<]speech[>[", "]<]image[>[", "]<]video[>[", "]<]start of speech[>[", "]<]end of speech[>[", "]<]start of image[>[", "]<]end of image[>[", "]<]start of video[>[", "]<]end of video[>[", "]<]vision pad[>[", "]~!b[", "<issue_closed>", "<issue_comment>", "<issue_start>", "<jupyter_code>", "<jupyter_output>", "<jupyter_start>", "<jupyter_text>", "<reponame>", "[e~[", "]!d~[", "]!p~[", "]~b]", "<jupyter_error>", "<add_file>", "<delete_file>", "<rename_file>", "<edit_file>", "<commit_message>", "<empty_source_file>", "<repo_struct>", "<code_context>", "<file_content>", "<source_files>", "<pr_start>", "<review_comment>", "<filepath>", "<file_sep>" ], "bos_token": { "content": "]~!b[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "eos_token": { "content": "[e~[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "unk_token": { "content": "]!d~[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }}123version https://git-lfs.github.com/spec/v1oid sha256:8fe9e9c3276d4ef1e47e399e5ca2122a210722d8ff62a25ab93a927fc0280387size 15522862123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496{ "add_prefix_space": false, "added_tokens_decoder": { "200000": { "content": "]!p~[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200001": { "content": "<fim_prefix>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200002": { "content": "<fim_middle>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200003": { "content": "<fim_suffix>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200004": { "content": "<fim_pad>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200005": { "content": "<reponame>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200006": { "content": "<filename>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200007": { "content": "<gh_stars>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200008": { "content": "<issue_start>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200009": { "content": "<issue_comment>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200010": { "content": "<issue_closed>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200011": { "content": "<jupyter_start>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200012": { "content": "<jupyter_text>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200013": { "content": "<jupyter_code>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200014": { "content": "<jupyter_output>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200015": { "content": "<empty_output>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200016": { "content": "<commit_before>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200017": { "content": "<commit_msg>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200018": { "content": "<commit_after>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200019": { "content": "]~b]", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200020": { "content": "[e~[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200021": { "content": "]!d~[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200022": { "content": "<function_call>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200023": { "content": "<code_interpreter>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200024": { "content": "]<]speech[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200025": { "content": "]<]image[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200026": { "content": "]<]video[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200027": { "content": "]<]start of speech[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200028": { "content": "]<]end of speech[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200029": { "content": "]<]start of image[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200030": { "content": "]<]end of image[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200031": { "content": "]<]start of video[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200032": { "content": "]<]end of video[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200033": { "content": "]<]vision pad[>[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200034": { "content": "]~!b[", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200035": { "content": "<jupyter_error>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200036": { "content": "<add_file>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200037": { "content": "<delete_file>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200038": { "content": "<rename_file>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200039": { "content": "<edit_file>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200040": { "content": "<commit_message>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200041": { "content": "<empty_source_file>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200042": { "content": "<repo_struct>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200043": { "content": "<code_context>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200044": { "content": "<file_content>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200045": { "content": "<source_files>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200046": { "content": "<pr_start>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200047": { "content": "<review_comment>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200048": { "content": "<filepath>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200049": { "content": "<file_sep>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "200050": { "content": "<think>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "200051": { "content": "</think>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "200052": { "content": "<minimax:tool_call>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false }, "200053": { "content": "</minimax:tool_call>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": false } }, "additional_special_tokens": [ "<code_interpreter>", "<commit_after>", "<commit_before>", "<commit_msg>", "<empty_output>", "<filename>", "<fim_middle>", "<fim_pad>", "<fim_prefix>", "<fim_suffix>", "<function_call>", "<gh_stars>", "]<]speech[>[", "]<]image[>[", "]<]video[>[", "]<]start of speech[>[", "]<]end of speech[>[", "]<]start of image[>[", "]<]end of image[>[", "]<]start of video[>[", "]<]end of video[>[", "]<]vision pad[>[", "]~!b[", "<issue_closed>", "<issue_comment>", "<issue_start>", "<jupyter_code>", "<jupyter_output>", "<jupyter_start>", "<jupyter_text>", "<reponame>", "[e~[", "]!d~[", "]!p~[", "]~b]", "<jupyter_error>", "<add_file>", "<delete_file>", "<rename_file>", "<edit_file>", "<commit_message>", "<empty_source_file>", "<repo_struct>", "<code_context>", "<file_content>", "<source_files>", "<pr_start>", "<review_comment>", "<filepath>", "<file_sep>" ], "bos_token": "]~!b[", "clean_up_tokenization_spaces": false, "eos_token": "[e~[", "extra_special_tokens": {}, "model_max_length": 40960000, "tokenizer_class": "GPT2Tokenizer", "unk_token": "]!d~["}.gitattributes+2
README.mdAdded
added_tokens.jsonAdded+56
chat_template.jinjaAdded+159
config.jsonAdded+306
configuration_minimax_m2.pyAdded+200
generation_config.jsonAdded+8
merges.txtAdded
model-00001-of-00023.safetensorsAdded+3
model-00002-of-00023.safetensorsAdded+3
model-00003-of-00023.safetensorsAdded+3
model-00004-of-00023.safetensorsAdded+3
model-00005-of-00023.safetensorsAdded+3
model-00006-of-00023.safetensorsAdded+3
model-00007-of-00023.safetensorsAdded+3
model-00008-of-00023.safetensorsAdded+3
model-00009-of-00023.safetensorsAdded+3
model-00010-of-00023.safetensorsAdded+3
model-00011-of-00023.safetensorsAdded+3
model-00012-of-00023.safetensorsAdded+3
model-00013-of-00023.safetensorsAdded+3
model-00014-of-00023.safetensorsAdded+3
model-00015-of-00023.safetensorsAdded+3
model-00016-of-00023.safetensorsAdded+3
model-00017-of-00023.safetensorsAdded+3
model-00018-of-00023.safetensorsAdded+3
model-00019-of-00023.safetensorsAdded+3
model-00020-of-00023.safetensorsAdded+3
model-00021-of-00023.safetensorsAdded+3
model-00022-of-00023.safetensorsAdded+3
model-00023-of-00023.safetensorsAdded+3
model.safetensors.index.jsonAdded+3
quantization_config.jsonAdded+198
special_tokens_map.jsonAdded+75
tokenizer.jsonAdded+3
tokenizer_config.jsonAdded+496
vocab.jsonAdded