Text Generation
MLX
Safetensors
minimax_m2
jang
jang-k
mixed-precision
awq
minimax
minimax-m2
Mixture of Experts
apple-silicon
conversational
custom_code
Instructions to use OsaurusAI/MiniMax-M2.7-JANG_K with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use OsaurusAI/MiniMax-M2.7-JANG_K with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("OsaurusAI/MiniMax-M2.7-JANG_K") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use OsaurusAI/MiniMax-M2.7-JANG_K with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "OsaurusAI/MiniMax-M2.7-JANG_K"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "OsaurusAI/MiniMax-M2.7-JANG_K" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use OsaurusAI/MiniMax-M2.7-JANG_K with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "OsaurusAI/MiniMax-M2.7-JANG_K"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "OsaurusAI/MiniMax-M2.7-JANG_K" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OsaurusAI/MiniMax-M2.7-JANG_K", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use OsaurusAI/MiniMax-M2.7-JANG_K with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "OsaurusAI/MiniMax-M2.7-JANG_K"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default OsaurusAI/MiniMax-M2.7-JANG_K
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use OsaurusAI/MiniMax-M2.7-JANG_K with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "OsaurusAI/MiniMax-M2.7-JANG_K"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "OsaurusAI/MiniMax-M2.7-JANG_K" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Add files using upload-large-folder tool
Browse files- LICENSE +17 -0
- README.md +102 -0
- chat_template.jinja +163 -0
- config.json +2287 -0
- configuration_minimax_m2.py +200 -0
- generation_config.json +9 -0
- jang_config.json +46 -0
- jangq-logo.png +0 -0
- merges.txt +0 -0
- model-00001-of-00018.safetensors +3 -0
- model-00002-of-00018.safetensors +3 -0
- model-00003-of-00018.safetensors +3 -0
- model-00004-of-00018.safetensors +3 -0
- model-00005-of-00018.safetensors +3 -0
- model-00006-of-00018.safetensors +3 -0
- model-00007-of-00018.safetensors +3 -0
- model-00008-of-00018.safetensors +3 -0
- model-00009-of-00018.safetensors +3 -0
- model-00010-of-00018.safetensors +3 -0
- model-00011-of-00018.safetensors +3 -0
- model-00012-of-00018.safetensors +3 -0
- model-00013-of-00018.safetensors +3 -0
- model-00014-of-00018.safetensors +3 -0
- model-00015-of-00018.safetensors +3 -0
- model-00016-of-00018.safetensors +3 -0
- model-00017-of-00018.safetensors +3 -0
- model-00018-of-00018.safetensors +3 -0
- model.safetensors.index.json +0 -0
- modeling_minimax_m2.py +706 -0
- tokenizer.json +0 -0
- tokenizer_config.json +496 -0
- vocab.json +0 -0
LICENSE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
NON-COMMERCIAL LICENSE
|
| 2 |
+
Non-commercial use permitted based on MIT-style terms; commercial use requires prior written authorization.
|
| 3 |
+
Copyright (c) 2026 MiniMax
|
| 4 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software for non-commercial purposes, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or provide copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
| 5 |
+
1. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
| 6 |
+
2. If the Software (or any derivative works thereof) is used for any Commercial Use, you shall prominently display "Built with MiniMax M2.7" on a related website, user interface, blogpost, about page or product documentation.
|
| 7 |
+
3. Any Commercial Use of the Software or any derivative work thereof is prohibited without obtaining a separate, prior written authorization from MiniMax. To request such authorization, please contact api@minimax.io with the subject line "M2.7 licensing".
|
| 8 |
+
4. "Commercial Use" means any use of the Software or any derivative work thereof that is primarily intended for commercial advantage or monetary compensation, which includes, without limitation: (i) offering products or services to third parties for a fee, which utilize, incorporate, or rely on the Software or its derivatives, (ii) the commercial use of APIs provided by or for the Software or its derivatives, including to support or enable commercial products, services, or operations, whether in a cloud-based, hosted, or other similar environment, and (iii) the deployment or provision of the Software or its derivatives that have been subjected to post-training, fine-tuning, instruction-tuning, or any other form of modification, for any commercial purpose.
|
| 9 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 10 |
+
|
| 11 |
+
Appendix: Prohibited Uses
|
| 12 |
+
You agree you will not use, or allow others to use, the Software or any derivatives of the Software to:
|
| 13 |
+
1. Generate or disseminate content prohibited by applicable laws or regulations.
|
| 14 |
+
2. Assist with, engage in or otherwise support any military purpose.
|
| 15 |
+
3. Exploit, harm, or attempt to exploit or harm minors.
|
| 16 |
+
4. Generate or disseminate false or misleading information with the intent to cause harm.
|
| 17 |
+
5. Promote discrimination, hate speech, or harmful behavior against individuals or groups based on race or ethnic origin, religion, disability, age, nationality and national origin, veteran status, sexual orientation, gender or gender identity, caste, immigration status, or any other characteristic that is associated with systemic discrimination or marginalization.
|
README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: minimax-m2.7-non-commercial
|
| 4 |
+
license_link: LICENSE
|
| 5 |
+
library_name: mlx
|
| 6 |
+
tags:
|
| 7 |
+
- mlx
|
| 8 |
+
- jang
|
| 9 |
+
- jang-k
|
| 10 |
+
- mixed-precision
|
| 11 |
+
- awq
|
| 12 |
+
- minimax
|
| 13 |
+
- minimax-m2
|
| 14 |
+
- moe
|
| 15 |
+
- apple-silicon
|
| 16 |
+
pipeline_tag: text-generation
|
| 17 |
+
base_model: MiniMaxAI/MiniMax-M2.7
|
| 18 |
+
base_model_relation: quantized
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
<p align="center"><img src="jangq-logo.png" width="160"/></p>
|
| 22 |
+
|
| 23 |
+
# MiniMax-M2.7-JANG_K
|
| 24 |
+
|
| 25 |
+
**MiniMax M2.7 — 86 GB on disk** (down from ~230 GB FP8 source) — **mixed-bit
|
| 26 |
+
JANG_K** quantization using `mx.quantize` affine, prestacked switch_mlp.
|
| 27 |
+
|
| 28 |
+
- **Source:** [MiniMaxAI/MiniMax-M2.7](https://huggingface.co/MiniMaxAI)
|
| 29 |
+
(62 layers, 256 routed experts top-8, 196K context)
|
| 30 |
+
- **Quantization:** **mixed-bit affine** (`mx.quantize`, `group_size=128`):
|
| 31 |
+
- `down_proj`: **4-bit** (output enters residual stream — more sensitive)
|
| 32 |
+
- `gate_proj`: **2-bit** + AWQ pre-scaling (gated activation)
|
| 33 |
+
- `up_proj`: **2-bit** + AWQ pre-scaling (gated activation)
|
| 34 |
+
- attention `q/k/v/o_proj`: 8-bit affine
|
| 35 |
+
- embed: 6-bit / lm_head: 8-bit
|
| 36 |
+
- norms / router gate / expert_bias: fp16 passthrough
|
| 37 |
+
- **Routed-expert layout:** **prestacked** along axis 0 as
|
| 38 |
+
`block_sparse_moe.switch_mlp.{gate,up,down}_proj` of shape
|
| 39 |
+
`(n_experts, out, in_packed)` — instant cold load, no runtime sidecar.
|
| 40 |
+
- **Bundle size:** **~86 GB on-disk** (~3.0-bit avg routed including AWQ scales)
|
| 41 |
+
- **Runs on:** M3 Max 96 GB+ / M4 Max 128 GB / M5 Max 128 GB / Mac Studio 256 GB
|
| 42 |
+
|
| 43 |
+
## Why JANG_K?
|
| 44 |
+
|
| 45 |
+
`down_proj`'s output enters the residual stream and accumulates across
|
| 46 |
+
62 layers — quantization noise compounds. `gate_proj` and `up_proj`
|
| 47 |
+
enter through SwiGLU's multiplicative gate (`silu(gate) × up`) which
|
| 48 |
+
dampens noise. Spending 4 bits on `down` and 2 bits on `gate`/`up` gives
|
| 49 |
+
quality close to full-4-bit at considerably smaller size.
|
| 50 |
+
|
| 51 |
+
## AWQ
|
| 52 |
+
|
| 53 |
+
Activation-aware scaling on the 2-bit projections (`gate_proj`, `up_proj`):
|
| 54 |
+
|
| 55 |
+
- Per-layer `(hidden,)` scale: `s = clip((max(|x|) + eps)^0.5, min=1.0)`
|
| 56 |
+
(16 calibration prompts × ≤256 tokens; floor=1.0 prevents
|
| 57 |
+
inverse-fold from amplifying dead channels)
|
| 58 |
+
- Pre-scale weights along input axis: `W' = W * s[None, None, :]`
|
| 59 |
+
- Inverse fold into preceding norm: `post_attention_layernorm.weight /= s`
|
| 60 |
+
- Forward math is preserved exactly; quantization grid is reallocated
|
| 61 |
+
toward high-importance input channels.
|
| 62 |
+
|
| 63 |
+
`down_proj` does not need AWQ — it stays at 4-bit.
|
| 64 |
+
|
| 65 |
+
## Loading
|
| 66 |
+
|
| 67 |
+
Loadable via stock `mlx-lm` (no JANG runtime required):
|
| 68 |
+
|
| 69 |
+
```python
|
| 70 |
+
from mlx_lm import load, generate
|
| 71 |
+
model, tok = load("JANGQ-AI/MiniMax-M2.7-JANG_K")
|
| 72 |
+
|
| 73 |
+
messages = [{"role": "user", "content": "What is the capital of France?"}]
|
| 74 |
+
prompt = tok.apply_chat_template(messages, add_generation_prompt=True,
|
| 75 |
+
tokenize=False)
|
| 76 |
+
print(generate(model, tok, prompt=prompt, max_tokens=128))
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
## Reasoning + tools
|
| 80 |
+
|
| 81 |
+
- **Default:** thinking ON (chat template inserts `<think>\n` after assistant prefix)
|
| 82 |
+
- **Reasoning parser:** `qwen3` (extracts `<think>...</think>` blocks)
|
| 83 |
+
- **Tool parser:** `minimax`
|
| 84 |
+
- **Disable reasoning:**
|
| 85 |
+
```python
|
| 86 |
+
prompt = tok.apply_chat_template(messages, add_generation_prompt=True,
|
| 87 |
+
tokenize=False, enable_thinking=False)
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
## Variants in the MiniMax-M2.7 line on JANGQ-AI
|
| 91 |
+
|
| 92 |
+
| Variant | Routed bits | Bundle size | Loader |
|
| 93 |
+
|---|---|---|---|
|
| 94 |
+
| `MiniMax-M2.7-JANGTQ` | 2-bit codebook | 47 GB | `jang_tools.load_jangtq` |
|
| 95 |
+
| `MiniMax-M2.7-JANGTQ_K` | mixed 2/4 codebook | 74 GB | `jang_tools.load_jangtq` |
|
| 96 |
+
| **`MiniMax-M2.7-JANG_K` (this)** | **mixed 2/4 affine + AWQ** | **86 GB** | **stock `mlx_lm`** |
|
| 97 |
+
|
| 98 |
+
## Credits
|
| 99 |
+
|
| 100 |
+
- **Quantization toolchain:** [JANG](https://github.com/jangq-ai/jang) by Jinho Jang <eric@jangq.ai>
|
| 101 |
+
- **Base model:** MiniMax-M2.7 by [MiniMaxA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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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' }}
|
| 159 |
+
{%- if enable_thinking is defined and enable_thinking is false -%}
|
| 160 |
+
{%- else -%}
|
| 161 |
+
{{- '<think>' ~ '\n' }}
|
| 162 |
+
{%- endif -%}
|
| 163 |
+
{%- endif -%}
|
config.json
ADDED
|
@@ -0,0 +1,2287 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
+
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 |
+
"head_dim": 128,
|
| 75 |
+
"hidden_act": "silu",
|
| 76 |
+
"hidden_size": 3072,
|
| 77 |
+
"intermediate_size": 1536,
|
| 78 |
+
"max_position_embeddings": 196608,
|
| 79 |
+
"model_type": "minimax_m2",
|
| 80 |
+
"mtp_transformer_layers": 0,
|
| 81 |
+
"num_attention_heads": 48,
|
| 82 |
+
"num_experts_per_tok": 8,
|
| 83 |
+
"num_hidden_layers": 62,
|
| 84 |
+
"num_key_value_heads": 8,
|
| 85 |
+
"num_local_experts": 256,
|
| 86 |
+
"num_mtp_modules": 0,
|
| 87 |
+
"qk_norm_type": "per_layer",
|
| 88 |
+
"rms_norm_eps": 1e-06,
|
| 89 |
+
"rope_theta": 5000000,
|
| 90 |
+
"rotary_dim": 64,
|
| 91 |
+
"scoring_func": "sigmoid",
|
| 92 |
+
"shared_intermediate_size": 0,
|
| 93 |
+
"tie_word_embeddings": false,
|
| 94 |
+
"transformers_version": "4.46.1",
|
| 95 |
+
"use_cache": true,
|
| 96 |
+
"use_mtp": false,
|
| 97 |
+
"use_qk_norm": true,
|
| 98 |
+
"use_routing_bias": true,
|
| 99 |
+
"vocab_size": 200064,
|
| 100 |
+
"_name_or_path": "MiniMax-M2.7-JANG_K",
|
| 101 |
+
"quantization": {
|
| 102 |
+
"bits": 8,
|
| 103 |
+
"group_size": 128,
|
| 104 |
+
"mode": "affine",
|
| 105 |
+
"model.embed_tokens": {
|
| 106 |
+
"bits": 6,
|
| 107 |
+
"group_size": 128,
|
| 108 |
+
"mode": "affine"
|
| 109 |
+
},
|
| 110 |
+
"lm_head": {
|
| 111 |
+
"bits": 8,
|
| 112 |
+
"group_size": 128,
|
| 113 |
+
"mode": "affine"
|
| 114 |
+
},
|
| 115 |
+
"model.layers.0.self_attn.q_proj": {
|
| 116 |
+
"bits": 8,
|
| 117 |
+
"group_size": 128,
|
| 118 |
+
"mode": "affine"
|
| 119 |
+
},
|
| 120 |
+
"model.layers.0.self_attn.k_proj": {
|
| 121 |
+
"bits": 8,
|
| 122 |
+
"group_size": 128,
|
| 123 |
+
"mode": "affine"
|
| 124 |
+
},
|
| 125 |
+
"model.layers.0.self_attn.v_proj": {
|
| 126 |
+
"bits": 8,
|
| 127 |
+
"group_size": 128,
|
| 128 |
+
"mode": "affine"
|
| 129 |
+
},
|
| 130 |
+
"model.layers.0.self_attn.o_proj": {
|
| 131 |
+
"bits": 8,
|
| 132 |
+
"group_size": 128,
|
| 133 |
+
"mode": "affine"
|
| 134 |
+
},
|
| 135 |
+
"model.layers.0.block_sparse_moe.switch_mlp.gate_proj": {
|
| 136 |
+
"bits": 2,
|
| 137 |
+
"group_size": 128,
|
| 138 |
+
"mode": "affine"
|
| 139 |
+
},
|
| 140 |
+
"model.layers.0.block_sparse_moe.switch_mlp.down_proj": {
|
| 141 |
+
"bits": 4,
|
| 142 |
+
"group_size": 128,
|
| 143 |
+
"mode": "affine"
|
| 144 |
+
},
|
| 145 |
+
"model.layers.0.block_sparse_moe.switch_mlp.up_proj": {
|
| 146 |
+
"bits": 2,
|
| 147 |
+
"group_size": 128,
|
| 148 |
+
"mode": "affine"
|
| 149 |
+
},
|
| 150 |
+
"model.layers.1.self_attn.q_proj": {
|
| 151 |
+
"bits": 8,
|
| 152 |
+
"group_size": 128,
|
| 153 |
+
"mode": "affine"
|
| 154 |
+
},
|
| 155 |
+
"model.layers.1.self_attn.k_proj": {
|
| 156 |
+
"bits": 8,
|
| 157 |
+
"group_size": 128,
|
| 158 |
+
"mode": "affine"
|
| 159 |
+
},
|
| 160 |
+
"model.layers.1.self_attn.v_proj": {
|
| 161 |
+
"bits": 8,
|
| 162 |
+
"group_size": 128,
|
| 163 |
+
"mode": "affine"
|
| 164 |
+
},
|
| 165 |
+
"model.layers.1.self_attn.o_proj": {
|
| 166 |
+
"bits": 8,
|
| 167 |
+
"group_size": 128,
|
| 168 |
+
"mode": "affine"
|
| 169 |
+
},
|
| 170 |
+
"model.layers.1.block_sparse_moe.switch_mlp.gate_proj": {
|
| 171 |
+
"bits": 2,
|
| 172 |
+
"group_size": 128,
|
| 173 |
+
"mode": "affine"
|
| 174 |
+
},
|
| 175 |
+
"model.layers.1.block_sparse_moe.switch_mlp.down_proj": {
|
| 176 |
+
"bits": 4,
|
| 177 |
+
"group_size": 128,
|
| 178 |
+
"mode": "affine"
|
| 179 |
+
},
|
| 180 |
+
"model.layers.1.block_sparse_moe.switch_mlp.up_proj": {
|
| 181 |
+
"bits": 2,
|
| 182 |
+
"group_size": 128,
|
| 183 |
+
"mode": "affine"
|
| 184 |
+
},
|
| 185 |
+
"model.layers.2.self_attn.q_proj": {
|
| 186 |
+
"bits": 8,
|
| 187 |
+
"group_size": 128,
|
| 188 |
+
"mode": "affine"
|
| 189 |
+
},
|
| 190 |
+
"model.layers.2.self_attn.k_proj": {
|
| 191 |
+
"bits": 8,
|
| 192 |
+
"group_size": 128,
|
| 193 |
+
"mode": "affine"
|
| 194 |
+
},
|
| 195 |
+
"model.layers.2.self_attn.v_proj": {
|
| 196 |
+
"bits": 8,
|
| 197 |
+
"group_size": 128,
|
| 198 |
+
"mode": "affine"
|
| 199 |
+
},
|
| 200 |
+
"model.layers.2.self_attn.o_proj": {
|
| 201 |
+
"bits": 8,
|
| 202 |
+
"group_size": 128,
|
| 203 |
+
"mode": "affine"
|
| 204 |
+
},
|
| 205 |
+
"model.layers.2.block_sparse_moe.switch_mlp.gate_proj": {
|
| 206 |
+
"bits": 2,
|
| 207 |
+
"group_size": 128,
|
| 208 |
+
"mode": "affine"
|
| 209 |
+
},
|
| 210 |
+
"model.layers.2.block_sparse_moe.switch_mlp.down_proj": {
|
| 211 |
+
"bits": 4,
|
| 212 |
+
"group_size": 128,
|
| 213 |
+
"mode": "affine"
|
| 214 |
+
},
|
| 215 |
+
"model.layers.2.block_sparse_moe.switch_mlp.up_proj": {
|
| 216 |
+
"bits": 2,
|
| 217 |
+
"group_size": 128,
|
| 218 |
+
"mode": "affine"
|
| 219 |
+
},
|
| 220 |
+
"model.layers.3.self_attn.q_proj": {
|
| 221 |
+
"bits": 8,
|
| 222 |
+
"group_size": 128,
|
| 223 |
+
"mode": "affine"
|
| 224 |
+
},
|
| 225 |
+
"model.layers.3.self_attn.k_proj": {
|
| 226 |
+
"bits": 8,
|
| 227 |
+
"group_size": 128,
|
| 228 |
+
"mode": "affine"
|
| 229 |
+
},
|
| 230 |
+
"model.layers.3.self_attn.v_proj": {
|
| 231 |
+
"bits": 8,
|
| 232 |
+
"group_size": 128,
|
| 233 |
+
"mode": "affine"
|
| 234 |
+
},
|
| 235 |
+
"model.layers.3.self_attn.o_proj": {
|
| 236 |
+
"bits": 8,
|
| 237 |
+
"group_size": 128,
|
| 238 |
+
"mode": "affine"
|
| 239 |
+
},
|
| 240 |
+
"model.layers.3.block_sparse_moe.switch_mlp.gate_proj": {
|
| 241 |
+
"bits": 2,
|
| 242 |
+
"group_size": 128,
|
| 243 |
+
"mode": "affine"
|
| 244 |
+
},
|
| 245 |
+
"model.layers.3.block_sparse_moe.switch_mlp.down_proj": {
|
| 246 |
+
"bits": 4,
|
| 247 |
+
"group_size": 128,
|
| 248 |
+
"mode": "affine"
|
| 249 |
+
},
|
| 250 |
+
"model.layers.3.block_sparse_moe.switch_mlp.up_proj": {
|
| 251 |
+
"bits": 2,
|
| 252 |
+
"group_size": 128,
|
| 253 |
+
"mode": "affine"
|
| 254 |
+
},
|
| 255 |
+
"model.layers.4.self_attn.q_proj": {
|
| 256 |
+
"bits": 8,
|
| 257 |
+
"group_size": 128,
|
| 258 |
+
"mode": "affine"
|
| 259 |
+
},
|
| 260 |
+
"model.layers.4.self_attn.k_proj": {
|
| 261 |
+
"bits": 8,
|
| 262 |
+
"group_size": 128,
|
| 263 |
+
"mode": "affine"
|
| 264 |
+
},
|
| 265 |
+
"model.layers.4.self_attn.v_proj": {
|
| 266 |
+
"bits": 8,
|
| 267 |
+
"group_size": 128,
|
| 268 |
+
"mode": "affine"
|
| 269 |
+
},
|
| 270 |
+
"model.layers.4.self_attn.o_proj": {
|
| 271 |
+
"bits": 8,
|
| 272 |
+
"group_size": 128,
|
| 273 |
+
"mode": "affine"
|
| 274 |
+
},
|
| 275 |
+
"model.layers.4.block_sparse_moe.switch_mlp.gate_proj": {
|
| 276 |
+
"bits": 2,
|
| 277 |
+
"group_size": 128,
|
| 278 |
+
"mode": "affine"
|
| 279 |
+
},
|
| 280 |
+
"model.layers.4.block_sparse_moe.switch_mlp.down_proj": {
|
| 281 |
+
"bits": 4,
|
| 282 |
+
"group_size": 128,
|
| 283 |
+
"mode": "affine"
|
| 284 |
+
},
|
| 285 |
+
"model.layers.4.block_sparse_moe.switch_mlp.up_proj": {
|
| 286 |
+
"bits": 2,
|
| 287 |
+
"group_size": 128,
|
| 288 |
+
"mode": "affine"
|
| 289 |
+
},
|
| 290 |
+
"model.layers.5.self_attn.q_proj": {
|
| 291 |
+
"bits": 8,
|
| 292 |
+
"group_size": 128,
|
| 293 |
+
"mode": "affine"
|
| 294 |
+
},
|
| 295 |
+
"model.layers.5.self_attn.k_proj": {
|
| 296 |
+
"bits": 8,
|
| 297 |
+
"group_size": 128,
|
| 298 |
+
"mode": "affine"
|
| 299 |
+
},
|
| 300 |
+
"model.layers.5.self_attn.v_proj": {
|
| 301 |
+
"bits": 8,
|
| 302 |
+
"group_size": 128,
|
| 303 |
+
"mode": "affine"
|
| 304 |
+
},
|
| 305 |
+
"model.layers.5.self_attn.o_proj": {
|
| 306 |
+
"bits": 8,
|
| 307 |
+
"group_size": 128,
|
| 308 |
+
"mode": "affine"
|
| 309 |
+
},
|
| 310 |
+
"model.layers.5.block_sparse_moe.switch_mlp.gate_proj": {
|
| 311 |
+
"bits": 2,
|
| 312 |
+
"group_size": 128,
|
| 313 |
+
"mode": "affine"
|
| 314 |
+
},
|
| 315 |
+
"model.layers.5.block_sparse_moe.switch_mlp.down_proj": {
|
| 316 |
+
"bits": 4,
|
| 317 |
+
"group_size": 128,
|
| 318 |
+
"mode": "affine"
|
| 319 |
+
},
|
| 320 |
+
"model.layers.5.block_sparse_moe.switch_mlp.up_proj": {
|
| 321 |
+
"bits": 2,
|
| 322 |
+
"group_size": 128,
|
| 323 |
+
"mode": "affine"
|
| 324 |
+
},
|
| 325 |
+
"model.layers.6.self_attn.q_proj": {
|
| 326 |
+
"bits": 8,
|
| 327 |
+
"group_size": 128,
|
| 328 |
+
"mode": "affine"
|
| 329 |
+
},
|
| 330 |
+
"model.layers.6.self_attn.k_proj": {
|
| 331 |
+
"bits": 8,
|
| 332 |
+
"group_size": 128,
|
| 333 |
+
"mode": "affine"
|
| 334 |
+
},
|
| 335 |
+
"model.layers.6.self_attn.v_proj": {
|
| 336 |
+
"bits": 8,
|
| 337 |
+
"group_size": 128,
|
| 338 |
+
"mode": "affine"
|
| 339 |
+
},
|
| 340 |
+
"model.layers.6.self_attn.o_proj": {
|
| 341 |
+
"bits": 8,
|
| 342 |
+
"group_size": 128,
|
| 343 |
+
"mode": "affine"
|
| 344 |
+
},
|
| 345 |
+
"model.layers.6.block_sparse_moe.switch_mlp.gate_proj": {
|
| 346 |
+
"bits": 2,
|
| 347 |
+
"group_size": 128,
|
| 348 |
+
"mode": "affine"
|
| 349 |
+
},
|
| 350 |
+
"model.layers.6.block_sparse_moe.switch_mlp.down_proj": {
|
| 351 |
+
"bits": 4,
|
| 352 |
+
"group_size": 128,
|
| 353 |
+
"mode": "affine"
|
| 354 |
+
},
|
| 355 |
+
"model.layers.6.block_sparse_moe.switch_mlp.up_proj": {
|
| 356 |
+
"bits": 2,
|
| 357 |
+
"group_size": 128,
|
| 358 |
+
"mode": "affine"
|
| 359 |
+
},
|
| 360 |
+
"model.layers.7.self_attn.q_proj": {
|
| 361 |
+
"bits": 8,
|
| 362 |
+
"group_size": 128,
|
| 363 |
+
"mode": "affine"
|
| 364 |
+
},
|
| 365 |
+
"model.layers.7.self_attn.k_proj": {
|
| 366 |
+
"bits": 8,
|
| 367 |
+
"group_size": 128,
|
| 368 |
+
"mode": "affine"
|
| 369 |
+
},
|
| 370 |
+
"model.layers.7.self_attn.v_proj": {
|
| 371 |
+
"bits": 8,
|
| 372 |
+
"group_size": 128,
|
| 373 |
+
"mode": "affine"
|
| 374 |
+
},
|
| 375 |
+
"model.layers.7.self_attn.o_proj": {
|
| 376 |
+
"bits": 8,
|
| 377 |
+
"group_size": 128,
|
| 378 |
+
"mode": "affine"
|
| 379 |
+
},
|
| 380 |
+
"model.layers.7.block_sparse_moe.switch_mlp.gate_proj": {
|
| 381 |
+
"bits": 2,
|
| 382 |
+
"group_size": 128,
|
| 383 |
+
"mode": "affine"
|
| 384 |
+
},
|
| 385 |
+
"model.layers.7.block_sparse_moe.switch_mlp.down_proj": {
|
| 386 |
+
"bits": 4,
|
| 387 |
+
"group_size": 128,
|
| 388 |
+
"mode": "affine"
|
| 389 |
+
},
|
| 390 |
+
"model.layers.7.block_sparse_moe.switch_mlp.up_proj": {
|
| 391 |
+
"bits": 2,
|
| 392 |
+
"group_size": 128,
|
| 393 |
+
"mode": "affine"
|
| 394 |
+
},
|
| 395 |
+
"model.layers.8.self_attn.q_proj": {
|
| 396 |
+
"bits": 8,
|
| 397 |
+
"group_size": 128,
|
| 398 |
+
"mode": "affine"
|
| 399 |
+
},
|
| 400 |
+
"model.layers.8.self_attn.k_proj": {
|
| 401 |
+
"bits": 8,
|
| 402 |
+
"group_size": 128,
|
| 403 |
+
"mode": "affine"
|
| 404 |
+
},
|
| 405 |
+
"model.layers.8.self_attn.v_proj": {
|
| 406 |
+
"bits": 8,
|
| 407 |
+
"group_size": 128,
|
| 408 |
+
"mode": "affine"
|
| 409 |
+
},
|
| 410 |
+
"model.layers.8.self_attn.o_proj": {
|
| 411 |
+
"bits": 8,
|
| 412 |
+
"group_size": 128,
|
| 413 |
+
"mode": "affine"
|
| 414 |
+
},
|
| 415 |
+
"model.layers.8.block_sparse_moe.switch_mlp.gate_proj": {
|
| 416 |
+
"bits": 2,
|
| 417 |
+
"group_size": 128,
|
| 418 |
+
"mode": "affine"
|
| 419 |
+
},
|
| 420 |
+
"model.layers.8.block_sparse_moe.switch_mlp.down_proj": {
|
| 421 |
+
"bits": 4,
|
| 422 |
+
"group_size": 128,
|
| 423 |
+
"mode": "affine"
|
| 424 |
+
},
|
| 425 |
+
"model.layers.8.block_sparse_moe.switch_mlp.up_proj": {
|
| 426 |
+
"bits": 2,
|
| 427 |
+
"group_size": 128,
|
| 428 |
+
"mode": "affine"
|
| 429 |
+
},
|
| 430 |
+
"model.layers.9.self_attn.q_proj": {
|
| 431 |
+
"bits": 8,
|
| 432 |
+
"group_size": 128,
|
| 433 |
+
"mode": "affine"
|
| 434 |
+
},
|
| 435 |
+
"model.layers.9.self_attn.k_proj": {
|
| 436 |
+
"bits": 8,
|
| 437 |
+
"group_size": 128,
|
| 438 |
+
"mode": "affine"
|
| 439 |
+
},
|
| 440 |
+
"model.layers.9.self_attn.v_proj": {
|
| 441 |
+
"bits": 8,
|
| 442 |
+
"group_size": 128,
|
| 443 |
+
"mode": "affine"
|
| 444 |
+
},
|
| 445 |
+
"model.layers.9.self_attn.o_proj": {
|
| 446 |
+
"bits": 8,
|
| 447 |
+
"group_size": 128,
|
| 448 |
+
"mode": "affine"
|
| 449 |
+
},
|
| 450 |
+
"model.layers.9.block_sparse_moe.switch_mlp.gate_proj": {
|
| 451 |
+
"bits": 2,
|
| 452 |
+
"group_size": 128,
|
| 453 |
+
"mode": "affine"
|
| 454 |
+
},
|
| 455 |
+
"model.layers.9.block_sparse_moe.switch_mlp.down_proj": {
|
| 456 |
+
"bits": 4,
|
| 457 |
+
"group_size": 128,
|
| 458 |
+
"mode": "affine"
|
| 459 |
+
},
|
| 460 |
+
"model.layers.9.block_sparse_moe.switch_mlp.up_proj": {
|
| 461 |
+
"bits": 2,
|
| 462 |
+
"group_size": 128,
|
| 463 |
+
"mode": "affine"
|
| 464 |
+
},
|
| 465 |
+
"model.layers.10.self_attn.q_proj": {
|
| 466 |
+
"bits": 8,
|
| 467 |
+
"group_size": 128,
|
| 468 |
+
"mode": "affine"
|
| 469 |
+
},
|
| 470 |
+
"model.layers.10.self_attn.k_proj": {
|
| 471 |
+
"bits": 8,
|
| 472 |
+
"group_size": 128,
|
| 473 |
+
"mode": "affine"
|
| 474 |
+
},
|
| 475 |
+
"model.layers.10.self_attn.v_proj": {
|
| 476 |
+
"bits": 8,
|
| 477 |
+
"group_size": 128,
|
| 478 |
+
"mode": "affine"
|
| 479 |
+
},
|
| 480 |
+
"model.layers.10.self_attn.o_proj": {
|
| 481 |
+
"bits": 8,
|
| 482 |
+
"group_size": 128,
|
| 483 |
+
"mode": "affine"
|
| 484 |
+
},
|
| 485 |
+
"model.layers.10.block_sparse_moe.switch_mlp.gate_proj": {
|
| 486 |
+
"bits": 2,
|
| 487 |
+
"group_size": 128,
|
| 488 |
+
"mode": "affine"
|
| 489 |
+
},
|
| 490 |
+
"model.layers.10.block_sparse_moe.switch_mlp.down_proj": {
|
| 491 |
+
"bits": 4,
|
| 492 |
+
"group_size": 128,
|
| 493 |
+
"mode": "affine"
|
| 494 |
+
},
|
| 495 |
+
"model.layers.10.block_sparse_moe.switch_mlp.up_proj": {
|
| 496 |
+
"bits": 2,
|
| 497 |
+
"group_size": 128,
|
| 498 |
+
"mode": "affine"
|
| 499 |
+
},
|
| 500 |
+
"model.layers.11.self_attn.q_proj": {
|
| 501 |
+
"bits": 8,
|
| 502 |
+
"group_size": 128,
|
| 503 |
+
"mode": "affine"
|
| 504 |
+
},
|
| 505 |
+
"model.layers.11.self_attn.k_proj": {
|
| 506 |
+
"bits": 8,
|
| 507 |
+
"group_size": 128,
|
| 508 |
+
"mode": "affine"
|
| 509 |
+
},
|
| 510 |
+
"model.layers.11.self_attn.v_proj": {
|
| 511 |
+
"bits": 8,
|
| 512 |
+
"group_size": 128,
|
| 513 |
+
"mode": "affine"
|
| 514 |
+
},
|
| 515 |
+
"model.layers.11.self_attn.o_proj": {
|
| 516 |
+
"bits": 8,
|
| 517 |
+
"group_size": 128,
|
| 518 |
+
"mode": "affine"
|
| 519 |
+
},
|
| 520 |
+
"model.layers.11.block_sparse_moe.switch_mlp.gate_proj": {
|
| 521 |
+
"bits": 2,
|
| 522 |
+
"group_size": 128,
|
| 523 |
+
"mode": "affine"
|
| 524 |
+
},
|
| 525 |
+
"model.layers.11.block_sparse_moe.switch_mlp.down_proj": {
|
| 526 |
+
"bits": 4,
|
| 527 |
+
"group_size": 128,
|
| 528 |
+
"mode": "affine"
|
| 529 |
+
},
|
| 530 |
+
"model.layers.11.block_sparse_moe.switch_mlp.up_proj": {
|
| 531 |
+
"bits": 2,
|
| 532 |
+
"group_size": 128,
|
| 533 |
+
"mode": "affine"
|
| 534 |
+
},
|
| 535 |
+
"model.layers.12.self_attn.q_proj": {
|
| 536 |
+
"bits": 8,
|
| 537 |
+
"group_size": 128,
|
| 538 |
+
"mode": "affine"
|
| 539 |
+
},
|
| 540 |
+
"model.layers.12.self_attn.k_proj": {
|
| 541 |
+
"bits": 8,
|
| 542 |
+
"group_size": 128,
|
| 543 |
+
"mode": "affine"
|
| 544 |
+
},
|
| 545 |
+
"model.layers.12.self_attn.v_proj": {
|
| 546 |
+
"bits": 8,
|
| 547 |
+
"group_size": 128,
|
| 548 |
+
"mode": "affine"
|
| 549 |
+
},
|
| 550 |
+
"model.layers.12.self_attn.o_proj": {
|
| 551 |
+
"bits": 8,
|
| 552 |
+
"group_size": 128,
|
| 553 |
+
"mode": "affine"
|
| 554 |
+
},
|
| 555 |
+
"model.layers.12.block_sparse_moe.switch_mlp.gate_proj": {
|
| 556 |
+
"bits": 2,
|
| 557 |
+
"group_size": 128,
|
| 558 |
+
"mode": "affine"
|
| 559 |
+
},
|
| 560 |
+
"model.layers.12.block_sparse_moe.switch_mlp.down_proj": {
|
| 561 |
+
"bits": 4,
|
| 562 |
+
"group_size": 128,
|
| 563 |
+
"mode": "affine"
|
| 564 |
+
},
|
| 565 |
+
"model.layers.12.block_sparse_moe.switch_mlp.up_proj": {
|
| 566 |
+
"bits": 2,
|
| 567 |
+
"group_size": 128,
|
| 568 |
+
"mode": "affine"
|
| 569 |
+
},
|
| 570 |
+
"model.layers.13.self_attn.q_proj": {
|
| 571 |
+
"bits": 8,
|
| 572 |
+
"group_size": 128,
|
| 573 |
+
"mode": "affine"
|
| 574 |
+
},
|
| 575 |
+
"model.layers.13.self_attn.k_proj": {
|
| 576 |
+
"bits": 8,
|
| 577 |
+
"group_size": 128,
|
| 578 |
+
"mode": "affine"
|
| 579 |
+
},
|
| 580 |
+
"model.layers.13.self_attn.v_proj": {
|
| 581 |
+
"bits": 8,
|
| 582 |
+
"group_size": 128,
|
| 583 |
+
"mode": "affine"
|
| 584 |
+
},
|
| 585 |
+
"model.layers.13.self_attn.o_proj": {
|
| 586 |
+
"bits": 8,
|
| 587 |
+
"group_size": 128,
|
| 588 |
+
"mode": "affine"
|
| 589 |
+
},
|
| 590 |
+
"model.layers.13.block_sparse_moe.switch_mlp.gate_proj": {
|
| 591 |
+
"bits": 2,
|
| 592 |
+
"group_size": 128,
|
| 593 |
+
"mode": "affine"
|
| 594 |
+
},
|
| 595 |
+
"model.layers.13.block_sparse_moe.switch_mlp.down_proj": {
|
| 596 |
+
"bits": 4,
|
| 597 |
+
"group_size": 128,
|
| 598 |
+
"mode": "affine"
|
| 599 |
+
},
|
| 600 |
+
"model.layers.13.block_sparse_moe.switch_mlp.up_proj": {
|
| 601 |
+
"bits": 2,
|
| 602 |
+
"group_size": 128,
|
| 603 |
+
"mode": "affine"
|
| 604 |
+
},
|
| 605 |
+
"model.layers.14.self_attn.q_proj": {
|
| 606 |
+
"bits": 8,
|
| 607 |
+
"group_size": 128,
|
| 608 |
+
"mode": "affine"
|
| 609 |
+
},
|
| 610 |
+
"model.layers.14.self_attn.k_proj": {
|
| 611 |
+
"bits": 8,
|
| 612 |
+
"group_size": 128,
|
| 613 |
+
"mode": "affine"
|
| 614 |
+
},
|
| 615 |
+
"model.layers.14.self_attn.v_proj": {
|
| 616 |
+
"bits": 8,
|
| 617 |
+
"group_size": 128,
|
| 618 |
+
"mode": "affine"
|
| 619 |
+
},
|
| 620 |
+
"model.layers.14.self_attn.o_proj": {
|
| 621 |
+
"bits": 8,
|
| 622 |
+
"group_size": 128,
|
| 623 |
+
"mode": "affine"
|
| 624 |
+
},
|
| 625 |
+
"model.layers.14.block_sparse_moe.switch_mlp.gate_proj": {
|
| 626 |
+
"bits": 2,
|
| 627 |
+
"group_size": 128,
|
| 628 |
+
"mode": "affine"
|
| 629 |
+
},
|
| 630 |
+
"model.layers.14.block_sparse_moe.switch_mlp.down_proj": {
|
| 631 |
+
"bits": 4,
|
| 632 |
+
"group_size": 128,
|
| 633 |
+
"mode": "affine"
|
| 634 |
+
},
|
| 635 |
+
"model.layers.14.block_sparse_moe.switch_mlp.up_proj": {
|
| 636 |
+
"bits": 2,
|
| 637 |
+
"group_size": 128,
|
| 638 |
+
"mode": "affine"
|
| 639 |
+
},
|
| 640 |
+
"model.layers.15.self_attn.q_proj": {
|
| 641 |
+
"bits": 8,
|
| 642 |
+
"group_size": 128,
|
| 643 |
+
"mode": "affine"
|
| 644 |
+
},
|
| 645 |
+
"model.layers.15.self_attn.k_proj": {
|
| 646 |
+
"bits": 8,
|
| 647 |
+
"group_size": 128,
|
| 648 |
+
"mode": "affine"
|
| 649 |
+
},
|
| 650 |
+
"model.layers.15.self_attn.v_proj": {
|
| 651 |
+
"bits": 8,
|
| 652 |
+
"group_size": 128,
|
| 653 |
+
"mode": "affine"
|
| 654 |
+
},
|
| 655 |
+
"model.layers.15.self_attn.o_proj": {
|
| 656 |
+
"bits": 8,
|
| 657 |
+
"group_size": 128,
|
| 658 |
+
"mode": "affine"
|
| 659 |
+
},
|
| 660 |
+
"model.layers.15.block_sparse_moe.switch_mlp.gate_proj": {
|
| 661 |
+
"bits": 2,
|
| 662 |
+
"group_size": 128,
|
| 663 |
+
"mode": "affine"
|
| 664 |
+
},
|
| 665 |
+
"model.layers.15.block_sparse_moe.switch_mlp.down_proj": {
|
| 666 |
+
"bits": 4,
|
| 667 |
+
"group_size": 128,
|
| 668 |
+
"mode": "affine"
|
| 669 |
+
},
|
| 670 |
+
"model.layers.15.block_sparse_moe.switch_mlp.up_proj": {
|
| 671 |
+
"bits": 2,
|
| 672 |
+
"group_size": 128,
|
| 673 |
+
"mode": "affine"
|
| 674 |
+
},
|
| 675 |
+
"model.layers.16.self_attn.q_proj": {
|
| 676 |
+
"bits": 8,
|
| 677 |
+
"group_size": 128,
|
| 678 |
+
"mode": "affine"
|
| 679 |
+
},
|
| 680 |
+
"model.layers.16.self_attn.k_proj": {
|
| 681 |
+
"bits": 8,
|
| 682 |
+
"group_size": 128,
|
| 683 |
+
"mode": "affine"
|
| 684 |
+
},
|
| 685 |
+
"model.layers.16.self_attn.v_proj": {
|
| 686 |
+
"bits": 8,
|
| 687 |
+
"group_size": 128,
|
| 688 |
+
"mode": "affine"
|
| 689 |
+
},
|
| 690 |
+
"model.layers.16.self_attn.o_proj": {
|
| 691 |
+
"bits": 8,
|
| 692 |
+
"group_size": 128,
|
| 693 |
+
"mode": "affine"
|
| 694 |
+
},
|
| 695 |
+
"model.layers.16.block_sparse_moe.switch_mlp.gate_proj": {
|
| 696 |
+
"bits": 2,
|
| 697 |
+
"group_size": 128,
|
| 698 |
+
"mode": "affine"
|
| 699 |
+
},
|
| 700 |
+
"model.layers.16.block_sparse_moe.switch_mlp.down_proj": {
|
| 701 |
+
"bits": 4,
|
| 702 |
+
"group_size": 128,
|
| 703 |
+
"mode": "affine"
|
| 704 |
+
},
|
| 705 |
+
"model.layers.16.block_sparse_moe.switch_mlp.up_proj": {
|
| 706 |
+
"bits": 2,
|
| 707 |
+
"group_size": 128,
|
| 708 |
+
"mode": "affine"
|
| 709 |
+
},
|
| 710 |
+
"model.layers.17.self_attn.q_proj": {
|
| 711 |
+
"bits": 8,
|
| 712 |
+
"group_size": 128,
|
| 713 |
+
"mode": "affine"
|
| 714 |
+
},
|
| 715 |
+
"model.layers.17.self_attn.k_proj": {
|
| 716 |
+
"bits": 8,
|
| 717 |
+
"group_size": 128,
|
| 718 |
+
"mode": "affine"
|
| 719 |
+
},
|
| 720 |
+
"model.layers.17.self_attn.v_proj": {
|
| 721 |
+
"bits": 8,
|
| 722 |
+
"group_size": 128,
|
| 723 |
+
"mode": "affine"
|
| 724 |
+
},
|
| 725 |
+
"model.layers.17.self_attn.o_proj": {
|
| 726 |
+
"bits": 8,
|
| 727 |
+
"group_size": 128,
|
| 728 |
+
"mode": "affine"
|
| 729 |
+
},
|
| 730 |
+
"model.layers.17.block_sparse_moe.switch_mlp.gate_proj": {
|
| 731 |
+
"bits": 2,
|
| 732 |
+
"group_size": 128,
|
| 733 |
+
"mode": "affine"
|
| 734 |
+
},
|
| 735 |
+
"model.layers.17.block_sparse_moe.switch_mlp.down_proj": {
|
| 736 |
+
"bits": 4,
|
| 737 |
+
"group_size": 128,
|
| 738 |
+
"mode": "affine"
|
| 739 |
+
},
|
| 740 |
+
"model.layers.17.block_sparse_moe.switch_mlp.up_proj": {
|
| 741 |
+
"bits": 2,
|
| 742 |
+
"group_size": 128,
|
| 743 |
+
"mode": "affine"
|
| 744 |
+
},
|
| 745 |
+
"model.layers.18.self_attn.q_proj": {
|
| 746 |
+
"bits": 8,
|
| 747 |
+
"group_size": 128,
|
| 748 |
+
"mode": "affine"
|
| 749 |
+
},
|
| 750 |
+
"model.layers.18.self_attn.k_proj": {
|
| 751 |
+
"bits": 8,
|
| 752 |
+
"group_size": 128,
|
| 753 |
+
"mode": "affine"
|
| 754 |
+
},
|
| 755 |
+
"model.layers.18.self_attn.v_proj": {
|
| 756 |
+
"bits": 8,
|
| 757 |
+
"group_size": 128,
|
| 758 |
+
"mode": "affine"
|
| 759 |
+
},
|
| 760 |
+
"model.layers.18.self_attn.o_proj": {
|
| 761 |
+
"bits": 8,
|
| 762 |
+
"group_size": 128,
|
| 763 |
+
"mode": "affine"
|
| 764 |
+
},
|
| 765 |
+
"model.layers.18.block_sparse_moe.switch_mlp.gate_proj": {
|
| 766 |
+
"bits": 2,
|
| 767 |
+
"group_size": 128,
|
| 768 |
+
"mode": "affine"
|
| 769 |
+
},
|
| 770 |
+
"model.layers.18.block_sparse_moe.switch_mlp.down_proj": {
|
| 771 |
+
"bits": 4,
|
| 772 |
+
"group_size": 128,
|
| 773 |
+
"mode": "affine"
|
| 774 |
+
},
|
| 775 |
+
"model.layers.18.block_sparse_moe.switch_mlp.up_proj": {
|
| 776 |
+
"bits": 2,
|
| 777 |
+
"group_size": 128,
|
| 778 |
+
"mode": "affine"
|
| 779 |
+
},
|
| 780 |
+
"model.layers.19.self_attn.q_proj": {
|
| 781 |
+
"bits": 8,
|
| 782 |
+
"group_size": 128,
|
| 783 |
+
"mode": "affine"
|
| 784 |
+
},
|
| 785 |
+
"model.layers.19.self_attn.k_proj": {
|
| 786 |
+
"bits": 8,
|
| 787 |
+
"group_size": 128,
|
| 788 |
+
"mode": "affine"
|
| 789 |
+
},
|
| 790 |
+
"model.layers.19.self_attn.v_proj": {
|
| 791 |
+
"bits": 8,
|
| 792 |
+
"group_size": 128,
|
| 793 |
+
"mode": "affine"
|
| 794 |
+
},
|
| 795 |
+
"model.layers.19.self_attn.o_proj": {
|
| 796 |
+
"bits": 8,
|
| 797 |
+
"group_size": 128,
|
| 798 |
+
"mode": "affine"
|
| 799 |
+
},
|
| 800 |
+
"model.layers.19.block_sparse_moe.switch_mlp.gate_proj": {
|
| 801 |
+
"bits": 2,
|
| 802 |
+
"group_size": 128,
|
| 803 |
+
"mode": "affine"
|
| 804 |
+
},
|
| 805 |
+
"model.layers.19.block_sparse_moe.switch_mlp.down_proj": {
|
| 806 |
+
"bits": 4,
|
| 807 |
+
"group_size": 128,
|
| 808 |
+
"mode": "affine"
|
| 809 |
+
},
|
| 810 |
+
"model.layers.19.block_sparse_moe.switch_mlp.up_proj": {
|
| 811 |
+
"bits": 2,
|
| 812 |
+
"group_size": 128,
|
| 813 |
+
"mode": "affine"
|
| 814 |
+
},
|
| 815 |
+
"model.layers.20.self_attn.q_proj": {
|
| 816 |
+
"bits": 8,
|
| 817 |
+
"group_size": 128,
|
| 818 |
+
"mode": "affine"
|
| 819 |
+
},
|
| 820 |
+
"model.layers.20.self_attn.k_proj": {
|
| 821 |
+
"bits": 8,
|
| 822 |
+
"group_size": 128,
|
| 823 |
+
"mode": "affine"
|
| 824 |
+
},
|
| 825 |
+
"model.layers.20.self_attn.v_proj": {
|
| 826 |
+
"bits": 8,
|
| 827 |
+
"group_size": 128,
|
| 828 |
+
"mode": "affine"
|
| 829 |
+
},
|
| 830 |
+
"model.layers.20.self_attn.o_proj": {
|
| 831 |
+
"bits": 8,
|
| 832 |
+
"group_size": 128,
|
| 833 |
+
"mode": "affine"
|
| 834 |
+
},
|
| 835 |
+
"model.layers.20.block_sparse_moe.switch_mlp.gate_proj": {
|
| 836 |
+
"bits": 2,
|
| 837 |
+
"group_size": 128,
|
| 838 |
+
"mode": "affine"
|
| 839 |
+
},
|
| 840 |
+
"model.layers.20.block_sparse_moe.switch_mlp.down_proj": {
|
| 841 |
+
"bits": 4,
|
| 842 |
+
"group_size": 128,
|
| 843 |
+
"mode": "affine"
|
| 844 |
+
},
|
| 845 |
+
"model.layers.20.block_sparse_moe.switch_mlp.up_proj": {
|
| 846 |
+
"bits": 2,
|
| 847 |
+
"group_size": 128,
|
| 848 |
+
"mode": "affine"
|
| 849 |
+
},
|
| 850 |
+
"model.layers.21.self_attn.q_proj": {
|
| 851 |
+
"bits": 8,
|
| 852 |
+
"group_size": 128,
|
| 853 |
+
"mode": "affine"
|
| 854 |
+
},
|
| 855 |
+
"model.layers.21.self_attn.k_proj": {
|
| 856 |
+
"bits": 8,
|
| 857 |
+
"group_size": 128,
|
| 858 |
+
"mode": "affine"
|
| 859 |
+
},
|
| 860 |
+
"model.layers.21.self_attn.v_proj": {
|
| 861 |
+
"bits": 8,
|
| 862 |
+
"group_size": 128,
|
| 863 |
+
"mode": "affine"
|
| 864 |
+
},
|
| 865 |
+
"model.layers.21.self_attn.o_proj": {
|
| 866 |
+
"bits": 8,
|
| 867 |
+
"group_size": 128,
|
| 868 |
+
"mode": "affine"
|
| 869 |
+
},
|
| 870 |
+
"model.layers.21.block_sparse_moe.switch_mlp.gate_proj": {
|
| 871 |
+
"bits": 2,
|
| 872 |
+
"group_size": 128,
|
| 873 |
+
"mode": "affine"
|
| 874 |
+
},
|
| 875 |
+
"model.layers.21.block_sparse_moe.switch_mlp.down_proj": {
|
| 876 |
+
"bits": 4,
|
| 877 |
+
"group_size": 128,
|
| 878 |
+
"mode": "affine"
|
| 879 |
+
},
|
| 880 |
+
"model.layers.21.block_sparse_moe.switch_mlp.up_proj": {
|
| 881 |
+
"bits": 2,
|
| 882 |
+
"group_size": 128,
|
| 883 |
+
"mode": "affine"
|
| 884 |
+
},
|
| 885 |
+
"model.layers.22.self_attn.q_proj": {
|
| 886 |
+
"bits": 8,
|
| 887 |
+
"group_size": 128,
|
| 888 |
+
"mode": "affine"
|
| 889 |
+
},
|
| 890 |
+
"model.layers.22.self_attn.k_proj": {
|
| 891 |
+
"bits": 8,
|
| 892 |
+
"group_size": 128,
|
| 893 |
+
"mode": "affine"
|
| 894 |
+
},
|
| 895 |
+
"model.layers.22.self_attn.v_proj": {
|
| 896 |
+
"bits": 8,
|
| 897 |
+
"group_size": 128,
|
| 898 |
+
"mode": "affine"
|
| 899 |
+
},
|
| 900 |
+
"model.layers.22.self_attn.o_proj": {
|
| 901 |
+
"bits": 8,
|
| 902 |
+
"group_size": 128,
|
| 903 |
+
"mode": "affine"
|
| 904 |
+
},
|
| 905 |
+
"model.layers.22.block_sparse_moe.switch_mlp.gate_proj": {
|
| 906 |
+
"bits": 2,
|
| 907 |
+
"group_size": 128,
|
| 908 |
+
"mode": "affine"
|
| 909 |
+
},
|
| 910 |
+
"model.layers.22.block_sparse_moe.switch_mlp.down_proj": {
|
| 911 |
+
"bits": 4,
|
| 912 |
+
"group_size": 128,
|
| 913 |
+
"mode": "affine"
|
| 914 |
+
},
|
| 915 |
+
"model.layers.22.block_sparse_moe.switch_mlp.up_proj": {
|
| 916 |
+
"bits": 2,
|
| 917 |
+
"group_size": 128,
|
| 918 |
+
"mode": "affine"
|
| 919 |
+
},
|
| 920 |
+
"model.layers.23.self_attn.q_proj": {
|
| 921 |
+
"bits": 8,
|
| 922 |
+
"group_size": 128,
|
| 923 |
+
"mode": "affine"
|
| 924 |
+
},
|
| 925 |
+
"model.layers.23.self_attn.k_proj": {
|
| 926 |
+
"bits": 8,
|
| 927 |
+
"group_size": 128,
|
| 928 |
+
"mode": "affine"
|
| 929 |
+
},
|
| 930 |
+
"model.layers.23.self_attn.v_proj": {
|
| 931 |
+
"bits": 8,
|
| 932 |
+
"group_size": 128,
|
| 933 |
+
"mode": "affine"
|
| 934 |
+
},
|
| 935 |
+
"model.layers.23.self_attn.o_proj": {
|
| 936 |
+
"bits": 8,
|
| 937 |
+
"group_size": 128,
|
| 938 |
+
"mode": "affine"
|
| 939 |
+
},
|
| 940 |
+
"model.layers.23.block_sparse_moe.switch_mlp.gate_proj": {
|
| 941 |
+
"bits": 2,
|
| 942 |
+
"group_size": 128,
|
| 943 |
+
"mode": "affine"
|
| 944 |
+
},
|
| 945 |
+
"model.layers.23.block_sparse_moe.switch_mlp.down_proj": {
|
| 946 |
+
"bits": 4,
|
| 947 |
+
"group_size": 128,
|
| 948 |
+
"mode": "affine"
|
| 949 |
+
},
|
| 950 |
+
"model.layers.23.block_sparse_moe.switch_mlp.up_proj": {
|
| 951 |
+
"bits": 2,
|
| 952 |
+
"group_size": 128,
|
| 953 |
+
"mode": "affine"
|
| 954 |
+
},
|
| 955 |
+
"model.layers.24.self_attn.q_proj": {
|
| 956 |
+
"bits": 8,
|
| 957 |
+
"group_size": 128,
|
| 958 |
+
"mode": "affine"
|
| 959 |
+
},
|
| 960 |
+
"model.layers.24.self_attn.k_proj": {
|
| 961 |
+
"bits": 8,
|
| 962 |
+
"group_size": 128,
|
| 963 |
+
"mode": "affine"
|
| 964 |
+
},
|
| 965 |
+
"model.layers.24.self_attn.v_proj": {
|
| 966 |
+
"bits": 8,
|
| 967 |
+
"group_size": 128,
|
| 968 |
+
"mode": "affine"
|
| 969 |
+
},
|
| 970 |
+
"model.layers.24.self_attn.o_proj": {
|
| 971 |
+
"bits": 8,
|
| 972 |
+
"group_size": 128,
|
| 973 |
+
"mode": "affine"
|
| 974 |
+
},
|
| 975 |
+
"model.layers.24.block_sparse_moe.switch_mlp.gate_proj": {
|
| 976 |
+
"bits": 2,
|
| 977 |
+
"group_size": 128,
|
| 978 |
+
"mode": "affine"
|
| 979 |
+
},
|
| 980 |
+
"model.layers.24.block_sparse_moe.switch_mlp.down_proj": {
|
| 981 |
+
"bits": 4,
|
| 982 |
+
"group_size": 128,
|
| 983 |
+
"mode": "affine"
|
| 984 |
+
},
|
| 985 |
+
"model.layers.24.block_sparse_moe.switch_mlp.up_proj": {
|
| 986 |
+
"bits": 2,
|
| 987 |
+
"group_size": 128,
|
| 988 |
+
"mode": "affine"
|
| 989 |
+
},
|
| 990 |
+
"model.layers.25.self_attn.q_proj": {
|
| 991 |
+
"bits": 8,
|
| 992 |
+
"group_size": 128,
|
| 993 |
+
"mode": "affine"
|
| 994 |
+
},
|
| 995 |
+
"model.layers.25.self_attn.k_proj": {
|
| 996 |
+
"bits": 8,
|
| 997 |
+
"group_size": 128,
|
| 998 |
+
"mode": "affine"
|
| 999 |
+
},
|
| 1000 |
+
"model.layers.25.self_attn.v_proj": {
|
| 1001 |
+
"bits": 8,
|
| 1002 |
+
"group_size": 128,
|
| 1003 |
+
"mode": "affine"
|
| 1004 |
+
},
|
| 1005 |
+
"model.layers.25.self_attn.o_proj": {
|
| 1006 |
+
"bits": 8,
|
| 1007 |
+
"group_size": 128,
|
| 1008 |
+
"mode": "affine"
|
| 1009 |
+
},
|
| 1010 |
+
"model.layers.25.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1011 |
+
"bits": 2,
|
| 1012 |
+
"group_size": 128,
|
| 1013 |
+
"mode": "affine"
|
| 1014 |
+
},
|
| 1015 |
+
"model.layers.25.block_sparse_moe.switch_mlp.down_proj": {
|
| 1016 |
+
"bits": 4,
|
| 1017 |
+
"group_size": 128,
|
| 1018 |
+
"mode": "affine"
|
| 1019 |
+
},
|
| 1020 |
+
"model.layers.25.block_sparse_moe.switch_mlp.up_proj": {
|
| 1021 |
+
"bits": 2,
|
| 1022 |
+
"group_size": 128,
|
| 1023 |
+
"mode": "affine"
|
| 1024 |
+
},
|
| 1025 |
+
"model.layers.26.self_attn.q_proj": {
|
| 1026 |
+
"bits": 8,
|
| 1027 |
+
"group_size": 128,
|
| 1028 |
+
"mode": "affine"
|
| 1029 |
+
},
|
| 1030 |
+
"model.layers.26.self_attn.k_proj": {
|
| 1031 |
+
"bits": 8,
|
| 1032 |
+
"group_size": 128,
|
| 1033 |
+
"mode": "affine"
|
| 1034 |
+
},
|
| 1035 |
+
"model.layers.26.self_attn.v_proj": {
|
| 1036 |
+
"bits": 8,
|
| 1037 |
+
"group_size": 128,
|
| 1038 |
+
"mode": "affine"
|
| 1039 |
+
},
|
| 1040 |
+
"model.layers.26.self_attn.o_proj": {
|
| 1041 |
+
"bits": 8,
|
| 1042 |
+
"group_size": 128,
|
| 1043 |
+
"mode": "affine"
|
| 1044 |
+
},
|
| 1045 |
+
"model.layers.26.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1046 |
+
"bits": 2,
|
| 1047 |
+
"group_size": 128,
|
| 1048 |
+
"mode": "affine"
|
| 1049 |
+
},
|
| 1050 |
+
"model.layers.26.block_sparse_moe.switch_mlp.down_proj": {
|
| 1051 |
+
"bits": 4,
|
| 1052 |
+
"group_size": 128,
|
| 1053 |
+
"mode": "affine"
|
| 1054 |
+
},
|
| 1055 |
+
"model.layers.26.block_sparse_moe.switch_mlp.up_proj": {
|
| 1056 |
+
"bits": 2,
|
| 1057 |
+
"group_size": 128,
|
| 1058 |
+
"mode": "affine"
|
| 1059 |
+
},
|
| 1060 |
+
"model.layers.27.self_attn.q_proj": {
|
| 1061 |
+
"bits": 8,
|
| 1062 |
+
"group_size": 128,
|
| 1063 |
+
"mode": "affine"
|
| 1064 |
+
},
|
| 1065 |
+
"model.layers.27.self_attn.k_proj": {
|
| 1066 |
+
"bits": 8,
|
| 1067 |
+
"group_size": 128,
|
| 1068 |
+
"mode": "affine"
|
| 1069 |
+
},
|
| 1070 |
+
"model.layers.27.self_attn.v_proj": {
|
| 1071 |
+
"bits": 8,
|
| 1072 |
+
"group_size": 128,
|
| 1073 |
+
"mode": "affine"
|
| 1074 |
+
},
|
| 1075 |
+
"model.layers.27.self_attn.o_proj": {
|
| 1076 |
+
"bits": 8,
|
| 1077 |
+
"group_size": 128,
|
| 1078 |
+
"mode": "affine"
|
| 1079 |
+
},
|
| 1080 |
+
"model.layers.27.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1081 |
+
"bits": 2,
|
| 1082 |
+
"group_size": 128,
|
| 1083 |
+
"mode": "affine"
|
| 1084 |
+
},
|
| 1085 |
+
"model.layers.27.block_sparse_moe.switch_mlp.down_proj": {
|
| 1086 |
+
"bits": 4,
|
| 1087 |
+
"group_size": 128,
|
| 1088 |
+
"mode": "affine"
|
| 1089 |
+
},
|
| 1090 |
+
"model.layers.27.block_sparse_moe.switch_mlp.up_proj": {
|
| 1091 |
+
"bits": 2,
|
| 1092 |
+
"group_size": 128,
|
| 1093 |
+
"mode": "affine"
|
| 1094 |
+
},
|
| 1095 |
+
"model.layers.28.self_attn.q_proj": {
|
| 1096 |
+
"bits": 8,
|
| 1097 |
+
"group_size": 128,
|
| 1098 |
+
"mode": "affine"
|
| 1099 |
+
},
|
| 1100 |
+
"model.layers.28.self_attn.k_proj": {
|
| 1101 |
+
"bits": 8,
|
| 1102 |
+
"group_size": 128,
|
| 1103 |
+
"mode": "affine"
|
| 1104 |
+
},
|
| 1105 |
+
"model.layers.28.self_attn.v_proj": {
|
| 1106 |
+
"bits": 8,
|
| 1107 |
+
"group_size": 128,
|
| 1108 |
+
"mode": "affine"
|
| 1109 |
+
},
|
| 1110 |
+
"model.layers.28.self_attn.o_proj": {
|
| 1111 |
+
"bits": 8,
|
| 1112 |
+
"group_size": 128,
|
| 1113 |
+
"mode": "affine"
|
| 1114 |
+
},
|
| 1115 |
+
"model.layers.28.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1116 |
+
"bits": 2,
|
| 1117 |
+
"group_size": 128,
|
| 1118 |
+
"mode": "affine"
|
| 1119 |
+
},
|
| 1120 |
+
"model.layers.28.block_sparse_moe.switch_mlp.down_proj": {
|
| 1121 |
+
"bits": 4,
|
| 1122 |
+
"group_size": 128,
|
| 1123 |
+
"mode": "affine"
|
| 1124 |
+
},
|
| 1125 |
+
"model.layers.28.block_sparse_moe.switch_mlp.up_proj": {
|
| 1126 |
+
"bits": 2,
|
| 1127 |
+
"group_size": 128,
|
| 1128 |
+
"mode": "affine"
|
| 1129 |
+
},
|
| 1130 |
+
"model.layers.29.self_attn.q_proj": {
|
| 1131 |
+
"bits": 8,
|
| 1132 |
+
"group_size": 128,
|
| 1133 |
+
"mode": "affine"
|
| 1134 |
+
},
|
| 1135 |
+
"model.layers.29.self_attn.k_proj": {
|
| 1136 |
+
"bits": 8,
|
| 1137 |
+
"group_size": 128,
|
| 1138 |
+
"mode": "affine"
|
| 1139 |
+
},
|
| 1140 |
+
"model.layers.29.self_attn.v_proj": {
|
| 1141 |
+
"bits": 8,
|
| 1142 |
+
"group_size": 128,
|
| 1143 |
+
"mode": "affine"
|
| 1144 |
+
},
|
| 1145 |
+
"model.layers.29.self_attn.o_proj": {
|
| 1146 |
+
"bits": 8,
|
| 1147 |
+
"group_size": 128,
|
| 1148 |
+
"mode": "affine"
|
| 1149 |
+
},
|
| 1150 |
+
"model.layers.29.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1151 |
+
"bits": 2,
|
| 1152 |
+
"group_size": 128,
|
| 1153 |
+
"mode": "affine"
|
| 1154 |
+
},
|
| 1155 |
+
"model.layers.29.block_sparse_moe.switch_mlp.down_proj": {
|
| 1156 |
+
"bits": 4,
|
| 1157 |
+
"group_size": 128,
|
| 1158 |
+
"mode": "affine"
|
| 1159 |
+
},
|
| 1160 |
+
"model.layers.29.block_sparse_moe.switch_mlp.up_proj": {
|
| 1161 |
+
"bits": 2,
|
| 1162 |
+
"group_size": 128,
|
| 1163 |
+
"mode": "affine"
|
| 1164 |
+
},
|
| 1165 |
+
"model.layers.30.self_attn.q_proj": {
|
| 1166 |
+
"bits": 8,
|
| 1167 |
+
"group_size": 128,
|
| 1168 |
+
"mode": "affine"
|
| 1169 |
+
},
|
| 1170 |
+
"model.layers.30.self_attn.k_proj": {
|
| 1171 |
+
"bits": 8,
|
| 1172 |
+
"group_size": 128,
|
| 1173 |
+
"mode": "affine"
|
| 1174 |
+
},
|
| 1175 |
+
"model.layers.30.self_attn.v_proj": {
|
| 1176 |
+
"bits": 8,
|
| 1177 |
+
"group_size": 128,
|
| 1178 |
+
"mode": "affine"
|
| 1179 |
+
},
|
| 1180 |
+
"model.layers.30.self_attn.o_proj": {
|
| 1181 |
+
"bits": 8,
|
| 1182 |
+
"group_size": 128,
|
| 1183 |
+
"mode": "affine"
|
| 1184 |
+
},
|
| 1185 |
+
"model.layers.30.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1186 |
+
"bits": 2,
|
| 1187 |
+
"group_size": 128,
|
| 1188 |
+
"mode": "affine"
|
| 1189 |
+
},
|
| 1190 |
+
"model.layers.30.block_sparse_moe.switch_mlp.down_proj": {
|
| 1191 |
+
"bits": 4,
|
| 1192 |
+
"group_size": 128,
|
| 1193 |
+
"mode": "affine"
|
| 1194 |
+
},
|
| 1195 |
+
"model.layers.30.block_sparse_moe.switch_mlp.up_proj": {
|
| 1196 |
+
"bits": 2,
|
| 1197 |
+
"group_size": 128,
|
| 1198 |
+
"mode": "affine"
|
| 1199 |
+
},
|
| 1200 |
+
"model.layers.31.self_attn.q_proj": {
|
| 1201 |
+
"bits": 8,
|
| 1202 |
+
"group_size": 128,
|
| 1203 |
+
"mode": "affine"
|
| 1204 |
+
},
|
| 1205 |
+
"model.layers.31.self_attn.k_proj": {
|
| 1206 |
+
"bits": 8,
|
| 1207 |
+
"group_size": 128,
|
| 1208 |
+
"mode": "affine"
|
| 1209 |
+
},
|
| 1210 |
+
"model.layers.31.self_attn.v_proj": {
|
| 1211 |
+
"bits": 8,
|
| 1212 |
+
"group_size": 128,
|
| 1213 |
+
"mode": "affine"
|
| 1214 |
+
},
|
| 1215 |
+
"model.layers.31.self_attn.o_proj": {
|
| 1216 |
+
"bits": 8,
|
| 1217 |
+
"group_size": 128,
|
| 1218 |
+
"mode": "affine"
|
| 1219 |
+
},
|
| 1220 |
+
"model.layers.31.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1221 |
+
"bits": 2,
|
| 1222 |
+
"group_size": 128,
|
| 1223 |
+
"mode": "affine"
|
| 1224 |
+
},
|
| 1225 |
+
"model.layers.31.block_sparse_moe.switch_mlp.down_proj": {
|
| 1226 |
+
"bits": 4,
|
| 1227 |
+
"group_size": 128,
|
| 1228 |
+
"mode": "affine"
|
| 1229 |
+
},
|
| 1230 |
+
"model.layers.31.block_sparse_moe.switch_mlp.up_proj": {
|
| 1231 |
+
"bits": 2,
|
| 1232 |
+
"group_size": 128,
|
| 1233 |
+
"mode": "affine"
|
| 1234 |
+
},
|
| 1235 |
+
"model.layers.32.self_attn.q_proj": {
|
| 1236 |
+
"bits": 8,
|
| 1237 |
+
"group_size": 128,
|
| 1238 |
+
"mode": "affine"
|
| 1239 |
+
},
|
| 1240 |
+
"model.layers.32.self_attn.k_proj": {
|
| 1241 |
+
"bits": 8,
|
| 1242 |
+
"group_size": 128,
|
| 1243 |
+
"mode": "affine"
|
| 1244 |
+
},
|
| 1245 |
+
"model.layers.32.self_attn.v_proj": {
|
| 1246 |
+
"bits": 8,
|
| 1247 |
+
"group_size": 128,
|
| 1248 |
+
"mode": "affine"
|
| 1249 |
+
},
|
| 1250 |
+
"model.layers.32.self_attn.o_proj": {
|
| 1251 |
+
"bits": 8,
|
| 1252 |
+
"group_size": 128,
|
| 1253 |
+
"mode": "affine"
|
| 1254 |
+
},
|
| 1255 |
+
"model.layers.32.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1256 |
+
"bits": 2,
|
| 1257 |
+
"group_size": 128,
|
| 1258 |
+
"mode": "affine"
|
| 1259 |
+
},
|
| 1260 |
+
"model.layers.32.block_sparse_moe.switch_mlp.down_proj": {
|
| 1261 |
+
"bits": 4,
|
| 1262 |
+
"group_size": 128,
|
| 1263 |
+
"mode": "affine"
|
| 1264 |
+
},
|
| 1265 |
+
"model.layers.32.block_sparse_moe.switch_mlp.up_proj": {
|
| 1266 |
+
"bits": 2,
|
| 1267 |
+
"group_size": 128,
|
| 1268 |
+
"mode": "affine"
|
| 1269 |
+
},
|
| 1270 |
+
"model.layers.33.self_attn.q_proj": {
|
| 1271 |
+
"bits": 8,
|
| 1272 |
+
"group_size": 128,
|
| 1273 |
+
"mode": "affine"
|
| 1274 |
+
},
|
| 1275 |
+
"model.layers.33.self_attn.k_proj": {
|
| 1276 |
+
"bits": 8,
|
| 1277 |
+
"group_size": 128,
|
| 1278 |
+
"mode": "affine"
|
| 1279 |
+
},
|
| 1280 |
+
"model.layers.33.self_attn.v_proj": {
|
| 1281 |
+
"bits": 8,
|
| 1282 |
+
"group_size": 128,
|
| 1283 |
+
"mode": "affine"
|
| 1284 |
+
},
|
| 1285 |
+
"model.layers.33.self_attn.o_proj": {
|
| 1286 |
+
"bits": 8,
|
| 1287 |
+
"group_size": 128,
|
| 1288 |
+
"mode": "affine"
|
| 1289 |
+
},
|
| 1290 |
+
"model.layers.33.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1291 |
+
"bits": 2,
|
| 1292 |
+
"group_size": 128,
|
| 1293 |
+
"mode": "affine"
|
| 1294 |
+
},
|
| 1295 |
+
"model.layers.33.block_sparse_moe.switch_mlp.down_proj": {
|
| 1296 |
+
"bits": 4,
|
| 1297 |
+
"group_size": 128,
|
| 1298 |
+
"mode": "affine"
|
| 1299 |
+
},
|
| 1300 |
+
"model.layers.33.block_sparse_moe.switch_mlp.up_proj": {
|
| 1301 |
+
"bits": 2,
|
| 1302 |
+
"group_size": 128,
|
| 1303 |
+
"mode": "affine"
|
| 1304 |
+
},
|
| 1305 |
+
"model.layers.34.self_attn.q_proj": {
|
| 1306 |
+
"bits": 8,
|
| 1307 |
+
"group_size": 128,
|
| 1308 |
+
"mode": "affine"
|
| 1309 |
+
},
|
| 1310 |
+
"model.layers.34.self_attn.k_proj": {
|
| 1311 |
+
"bits": 8,
|
| 1312 |
+
"group_size": 128,
|
| 1313 |
+
"mode": "affine"
|
| 1314 |
+
},
|
| 1315 |
+
"model.layers.34.self_attn.v_proj": {
|
| 1316 |
+
"bits": 8,
|
| 1317 |
+
"group_size": 128,
|
| 1318 |
+
"mode": "affine"
|
| 1319 |
+
},
|
| 1320 |
+
"model.layers.34.self_attn.o_proj": {
|
| 1321 |
+
"bits": 8,
|
| 1322 |
+
"group_size": 128,
|
| 1323 |
+
"mode": "affine"
|
| 1324 |
+
},
|
| 1325 |
+
"model.layers.34.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1326 |
+
"bits": 2,
|
| 1327 |
+
"group_size": 128,
|
| 1328 |
+
"mode": "affine"
|
| 1329 |
+
},
|
| 1330 |
+
"model.layers.34.block_sparse_moe.switch_mlp.down_proj": {
|
| 1331 |
+
"bits": 4,
|
| 1332 |
+
"group_size": 128,
|
| 1333 |
+
"mode": "affine"
|
| 1334 |
+
},
|
| 1335 |
+
"model.layers.34.block_sparse_moe.switch_mlp.up_proj": {
|
| 1336 |
+
"bits": 2,
|
| 1337 |
+
"group_size": 128,
|
| 1338 |
+
"mode": "affine"
|
| 1339 |
+
},
|
| 1340 |
+
"model.layers.35.self_attn.q_proj": {
|
| 1341 |
+
"bits": 8,
|
| 1342 |
+
"group_size": 128,
|
| 1343 |
+
"mode": "affine"
|
| 1344 |
+
},
|
| 1345 |
+
"model.layers.35.self_attn.k_proj": {
|
| 1346 |
+
"bits": 8,
|
| 1347 |
+
"group_size": 128,
|
| 1348 |
+
"mode": "affine"
|
| 1349 |
+
},
|
| 1350 |
+
"model.layers.35.self_attn.v_proj": {
|
| 1351 |
+
"bits": 8,
|
| 1352 |
+
"group_size": 128,
|
| 1353 |
+
"mode": "affine"
|
| 1354 |
+
},
|
| 1355 |
+
"model.layers.35.self_attn.o_proj": {
|
| 1356 |
+
"bits": 8,
|
| 1357 |
+
"group_size": 128,
|
| 1358 |
+
"mode": "affine"
|
| 1359 |
+
},
|
| 1360 |
+
"model.layers.35.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1361 |
+
"bits": 2,
|
| 1362 |
+
"group_size": 128,
|
| 1363 |
+
"mode": "affine"
|
| 1364 |
+
},
|
| 1365 |
+
"model.layers.35.block_sparse_moe.switch_mlp.down_proj": {
|
| 1366 |
+
"bits": 4,
|
| 1367 |
+
"group_size": 128,
|
| 1368 |
+
"mode": "affine"
|
| 1369 |
+
},
|
| 1370 |
+
"model.layers.35.block_sparse_moe.switch_mlp.up_proj": {
|
| 1371 |
+
"bits": 2,
|
| 1372 |
+
"group_size": 128,
|
| 1373 |
+
"mode": "affine"
|
| 1374 |
+
},
|
| 1375 |
+
"model.layers.36.self_attn.q_proj": {
|
| 1376 |
+
"bits": 8,
|
| 1377 |
+
"group_size": 128,
|
| 1378 |
+
"mode": "affine"
|
| 1379 |
+
},
|
| 1380 |
+
"model.layers.36.self_attn.k_proj": {
|
| 1381 |
+
"bits": 8,
|
| 1382 |
+
"group_size": 128,
|
| 1383 |
+
"mode": "affine"
|
| 1384 |
+
},
|
| 1385 |
+
"model.layers.36.self_attn.v_proj": {
|
| 1386 |
+
"bits": 8,
|
| 1387 |
+
"group_size": 128,
|
| 1388 |
+
"mode": "affine"
|
| 1389 |
+
},
|
| 1390 |
+
"model.layers.36.self_attn.o_proj": {
|
| 1391 |
+
"bits": 8,
|
| 1392 |
+
"group_size": 128,
|
| 1393 |
+
"mode": "affine"
|
| 1394 |
+
},
|
| 1395 |
+
"model.layers.36.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1396 |
+
"bits": 2,
|
| 1397 |
+
"group_size": 128,
|
| 1398 |
+
"mode": "affine"
|
| 1399 |
+
},
|
| 1400 |
+
"model.layers.36.block_sparse_moe.switch_mlp.down_proj": {
|
| 1401 |
+
"bits": 4,
|
| 1402 |
+
"group_size": 128,
|
| 1403 |
+
"mode": "affine"
|
| 1404 |
+
},
|
| 1405 |
+
"model.layers.36.block_sparse_moe.switch_mlp.up_proj": {
|
| 1406 |
+
"bits": 2,
|
| 1407 |
+
"group_size": 128,
|
| 1408 |
+
"mode": "affine"
|
| 1409 |
+
},
|
| 1410 |
+
"model.layers.37.self_attn.q_proj": {
|
| 1411 |
+
"bits": 8,
|
| 1412 |
+
"group_size": 128,
|
| 1413 |
+
"mode": "affine"
|
| 1414 |
+
},
|
| 1415 |
+
"model.layers.37.self_attn.k_proj": {
|
| 1416 |
+
"bits": 8,
|
| 1417 |
+
"group_size": 128,
|
| 1418 |
+
"mode": "affine"
|
| 1419 |
+
},
|
| 1420 |
+
"model.layers.37.self_attn.v_proj": {
|
| 1421 |
+
"bits": 8,
|
| 1422 |
+
"group_size": 128,
|
| 1423 |
+
"mode": "affine"
|
| 1424 |
+
},
|
| 1425 |
+
"model.layers.37.self_attn.o_proj": {
|
| 1426 |
+
"bits": 8,
|
| 1427 |
+
"group_size": 128,
|
| 1428 |
+
"mode": "affine"
|
| 1429 |
+
},
|
| 1430 |
+
"model.layers.37.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1431 |
+
"bits": 2,
|
| 1432 |
+
"group_size": 128,
|
| 1433 |
+
"mode": "affine"
|
| 1434 |
+
},
|
| 1435 |
+
"model.layers.37.block_sparse_moe.switch_mlp.down_proj": {
|
| 1436 |
+
"bits": 4,
|
| 1437 |
+
"group_size": 128,
|
| 1438 |
+
"mode": "affine"
|
| 1439 |
+
},
|
| 1440 |
+
"model.layers.37.block_sparse_moe.switch_mlp.up_proj": {
|
| 1441 |
+
"bits": 2,
|
| 1442 |
+
"group_size": 128,
|
| 1443 |
+
"mode": "affine"
|
| 1444 |
+
},
|
| 1445 |
+
"model.layers.38.self_attn.q_proj": {
|
| 1446 |
+
"bits": 8,
|
| 1447 |
+
"group_size": 128,
|
| 1448 |
+
"mode": "affine"
|
| 1449 |
+
},
|
| 1450 |
+
"model.layers.38.self_attn.k_proj": {
|
| 1451 |
+
"bits": 8,
|
| 1452 |
+
"group_size": 128,
|
| 1453 |
+
"mode": "affine"
|
| 1454 |
+
},
|
| 1455 |
+
"model.layers.38.self_attn.v_proj": {
|
| 1456 |
+
"bits": 8,
|
| 1457 |
+
"group_size": 128,
|
| 1458 |
+
"mode": "affine"
|
| 1459 |
+
},
|
| 1460 |
+
"model.layers.38.self_attn.o_proj": {
|
| 1461 |
+
"bits": 8,
|
| 1462 |
+
"group_size": 128,
|
| 1463 |
+
"mode": "affine"
|
| 1464 |
+
},
|
| 1465 |
+
"model.layers.38.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1466 |
+
"bits": 2,
|
| 1467 |
+
"group_size": 128,
|
| 1468 |
+
"mode": "affine"
|
| 1469 |
+
},
|
| 1470 |
+
"model.layers.38.block_sparse_moe.switch_mlp.down_proj": {
|
| 1471 |
+
"bits": 4,
|
| 1472 |
+
"group_size": 128,
|
| 1473 |
+
"mode": "affine"
|
| 1474 |
+
},
|
| 1475 |
+
"model.layers.38.block_sparse_moe.switch_mlp.up_proj": {
|
| 1476 |
+
"bits": 2,
|
| 1477 |
+
"group_size": 128,
|
| 1478 |
+
"mode": "affine"
|
| 1479 |
+
},
|
| 1480 |
+
"model.layers.39.self_attn.q_proj": {
|
| 1481 |
+
"bits": 8,
|
| 1482 |
+
"group_size": 128,
|
| 1483 |
+
"mode": "affine"
|
| 1484 |
+
},
|
| 1485 |
+
"model.layers.39.self_attn.k_proj": {
|
| 1486 |
+
"bits": 8,
|
| 1487 |
+
"group_size": 128,
|
| 1488 |
+
"mode": "affine"
|
| 1489 |
+
},
|
| 1490 |
+
"model.layers.39.self_attn.v_proj": {
|
| 1491 |
+
"bits": 8,
|
| 1492 |
+
"group_size": 128,
|
| 1493 |
+
"mode": "affine"
|
| 1494 |
+
},
|
| 1495 |
+
"model.layers.39.self_attn.o_proj": {
|
| 1496 |
+
"bits": 8,
|
| 1497 |
+
"group_size": 128,
|
| 1498 |
+
"mode": "affine"
|
| 1499 |
+
},
|
| 1500 |
+
"model.layers.39.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1501 |
+
"bits": 2,
|
| 1502 |
+
"group_size": 128,
|
| 1503 |
+
"mode": "affine"
|
| 1504 |
+
},
|
| 1505 |
+
"model.layers.39.block_sparse_moe.switch_mlp.down_proj": {
|
| 1506 |
+
"bits": 4,
|
| 1507 |
+
"group_size": 128,
|
| 1508 |
+
"mode": "affine"
|
| 1509 |
+
},
|
| 1510 |
+
"model.layers.39.block_sparse_moe.switch_mlp.up_proj": {
|
| 1511 |
+
"bits": 2,
|
| 1512 |
+
"group_size": 128,
|
| 1513 |
+
"mode": "affine"
|
| 1514 |
+
},
|
| 1515 |
+
"model.layers.40.self_attn.q_proj": {
|
| 1516 |
+
"bits": 8,
|
| 1517 |
+
"group_size": 128,
|
| 1518 |
+
"mode": "affine"
|
| 1519 |
+
},
|
| 1520 |
+
"model.layers.40.self_attn.k_proj": {
|
| 1521 |
+
"bits": 8,
|
| 1522 |
+
"group_size": 128,
|
| 1523 |
+
"mode": "affine"
|
| 1524 |
+
},
|
| 1525 |
+
"model.layers.40.self_attn.v_proj": {
|
| 1526 |
+
"bits": 8,
|
| 1527 |
+
"group_size": 128,
|
| 1528 |
+
"mode": "affine"
|
| 1529 |
+
},
|
| 1530 |
+
"model.layers.40.self_attn.o_proj": {
|
| 1531 |
+
"bits": 8,
|
| 1532 |
+
"group_size": 128,
|
| 1533 |
+
"mode": "affine"
|
| 1534 |
+
},
|
| 1535 |
+
"model.layers.40.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1536 |
+
"bits": 2,
|
| 1537 |
+
"group_size": 128,
|
| 1538 |
+
"mode": "affine"
|
| 1539 |
+
},
|
| 1540 |
+
"model.layers.40.block_sparse_moe.switch_mlp.down_proj": {
|
| 1541 |
+
"bits": 4,
|
| 1542 |
+
"group_size": 128,
|
| 1543 |
+
"mode": "affine"
|
| 1544 |
+
},
|
| 1545 |
+
"model.layers.40.block_sparse_moe.switch_mlp.up_proj": {
|
| 1546 |
+
"bits": 2,
|
| 1547 |
+
"group_size": 128,
|
| 1548 |
+
"mode": "affine"
|
| 1549 |
+
},
|
| 1550 |
+
"model.layers.41.self_attn.q_proj": {
|
| 1551 |
+
"bits": 8,
|
| 1552 |
+
"group_size": 128,
|
| 1553 |
+
"mode": "affine"
|
| 1554 |
+
},
|
| 1555 |
+
"model.layers.41.self_attn.k_proj": {
|
| 1556 |
+
"bits": 8,
|
| 1557 |
+
"group_size": 128,
|
| 1558 |
+
"mode": "affine"
|
| 1559 |
+
},
|
| 1560 |
+
"model.layers.41.self_attn.v_proj": {
|
| 1561 |
+
"bits": 8,
|
| 1562 |
+
"group_size": 128,
|
| 1563 |
+
"mode": "affine"
|
| 1564 |
+
},
|
| 1565 |
+
"model.layers.41.self_attn.o_proj": {
|
| 1566 |
+
"bits": 8,
|
| 1567 |
+
"group_size": 128,
|
| 1568 |
+
"mode": "affine"
|
| 1569 |
+
},
|
| 1570 |
+
"model.layers.41.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1571 |
+
"bits": 2,
|
| 1572 |
+
"group_size": 128,
|
| 1573 |
+
"mode": "affine"
|
| 1574 |
+
},
|
| 1575 |
+
"model.layers.41.block_sparse_moe.switch_mlp.down_proj": {
|
| 1576 |
+
"bits": 4,
|
| 1577 |
+
"group_size": 128,
|
| 1578 |
+
"mode": "affine"
|
| 1579 |
+
},
|
| 1580 |
+
"model.layers.41.block_sparse_moe.switch_mlp.up_proj": {
|
| 1581 |
+
"bits": 2,
|
| 1582 |
+
"group_size": 128,
|
| 1583 |
+
"mode": "affine"
|
| 1584 |
+
},
|
| 1585 |
+
"model.layers.42.self_attn.q_proj": {
|
| 1586 |
+
"bits": 8,
|
| 1587 |
+
"group_size": 128,
|
| 1588 |
+
"mode": "affine"
|
| 1589 |
+
},
|
| 1590 |
+
"model.layers.42.self_attn.k_proj": {
|
| 1591 |
+
"bits": 8,
|
| 1592 |
+
"group_size": 128,
|
| 1593 |
+
"mode": "affine"
|
| 1594 |
+
},
|
| 1595 |
+
"model.layers.42.self_attn.v_proj": {
|
| 1596 |
+
"bits": 8,
|
| 1597 |
+
"group_size": 128,
|
| 1598 |
+
"mode": "affine"
|
| 1599 |
+
},
|
| 1600 |
+
"model.layers.42.self_attn.o_proj": {
|
| 1601 |
+
"bits": 8,
|
| 1602 |
+
"group_size": 128,
|
| 1603 |
+
"mode": "affine"
|
| 1604 |
+
},
|
| 1605 |
+
"model.layers.42.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1606 |
+
"bits": 2,
|
| 1607 |
+
"group_size": 128,
|
| 1608 |
+
"mode": "affine"
|
| 1609 |
+
},
|
| 1610 |
+
"model.layers.42.block_sparse_moe.switch_mlp.down_proj": {
|
| 1611 |
+
"bits": 4,
|
| 1612 |
+
"group_size": 128,
|
| 1613 |
+
"mode": "affine"
|
| 1614 |
+
},
|
| 1615 |
+
"model.layers.42.block_sparse_moe.switch_mlp.up_proj": {
|
| 1616 |
+
"bits": 2,
|
| 1617 |
+
"group_size": 128,
|
| 1618 |
+
"mode": "affine"
|
| 1619 |
+
},
|
| 1620 |
+
"model.layers.43.self_attn.q_proj": {
|
| 1621 |
+
"bits": 8,
|
| 1622 |
+
"group_size": 128,
|
| 1623 |
+
"mode": "affine"
|
| 1624 |
+
},
|
| 1625 |
+
"model.layers.43.self_attn.k_proj": {
|
| 1626 |
+
"bits": 8,
|
| 1627 |
+
"group_size": 128,
|
| 1628 |
+
"mode": "affine"
|
| 1629 |
+
},
|
| 1630 |
+
"model.layers.43.self_attn.v_proj": {
|
| 1631 |
+
"bits": 8,
|
| 1632 |
+
"group_size": 128,
|
| 1633 |
+
"mode": "affine"
|
| 1634 |
+
},
|
| 1635 |
+
"model.layers.43.self_attn.o_proj": {
|
| 1636 |
+
"bits": 8,
|
| 1637 |
+
"group_size": 128,
|
| 1638 |
+
"mode": "affine"
|
| 1639 |
+
},
|
| 1640 |
+
"model.layers.43.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1641 |
+
"bits": 2,
|
| 1642 |
+
"group_size": 128,
|
| 1643 |
+
"mode": "affine"
|
| 1644 |
+
},
|
| 1645 |
+
"model.layers.43.block_sparse_moe.switch_mlp.down_proj": {
|
| 1646 |
+
"bits": 4,
|
| 1647 |
+
"group_size": 128,
|
| 1648 |
+
"mode": "affine"
|
| 1649 |
+
},
|
| 1650 |
+
"model.layers.43.block_sparse_moe.switch_mlp.up_proj": {
|
| 1651 |
+
"bits": 2,
|
| 1652 |
+
"group_size": 128,
|
| 1653 |
+
"mode": "affine"
|
| 1654 |
+
},
|
| 1655 |
+
"model.layers.44.self_attn.q_proj": {
|
| 1656 |
+
"bits": 8,
|
| 1657 |
+
"group_size": 128,
|
| 1658 |
+
"mode": "affine"
|
| 1659 |
+
},
|
| 1660 |
+
"model.layers.44.self_attn.k_proj": {
|
| 1661 |
+
"bits": 8,
|
| 1662 |
+
"group_size": 128,
|
| 1663 |
+
"mode": "affine"
|
| 1664 |
+
},
|
| 1665 |
+
"model.layers.44.self_attn.v_proj": {
|
| 1666 |
+
"bits": 8,
|
| 1667 |
+
"group_size": 128,
|
| 1668 |
+
"mode": "affine"
|
| 1669 |
+
},
|
| 1670 |
+
"model.layers.44.self_attn.o_proj": {
|
| 1671 |
+
"bits": 8,
|
| 1672 |
+
"group_size": 128,
|
| 1673 |
+
"mode": "affine"
|
| 1674 |
+
},
|
| 1675 |
+
"model.layers.44.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1676 |
+
"bits": 2,
|
| 1677 |
+
"group_size": 128,
|
| 1678 |
+
"mode": "affine"
|
| 1679 |
+
},
|
| 1680 |
+
"model.layers.44.block_sparse_moe.switch_mlp.down_proj": {
|
| 1681 |
+
"bits": 4,
|
| 1682 |
+
"group_size": 128,
|
| 1683 |
+
"mode": "affine"
|
| 1684 |
+
},
|
| 1685 |
+
"model.layers.44.block_sparse_moe.switch_mlp.up_proj": {
|
| 1686 |
+
"bits": 2,
|
| 1687 |
+
"group_size": 128,
|
| 1688 |
+
"mode": "affine"
|
| 1689 |
+
},
|
| 1690 |
+
"model.layers.45.self_attn.q_proj": {
|
| 1691 |
+
"bits": 8,
|
| 1692 |
+
"group_size": 128,
|
| 1693 |
+
"mode": "affine"
|
| 1694 |
+
},
|
| 1695 |
+
"model.layers.45.self_attn.k_proj": {
|
| 1696 |
+
"bits": 8,
|
| 1697 |
+
"group_size": 128,
|
| 1698 |
+
"mode": "affine"
|
| 1699 |
+
},
|
| 1700 |
+
"model.layers.45.self_attn.v_proj": {
|
| 1701 |
+
"bits": 8,
|
| 1702 |
+
"group_size": 128,
|
| 1703 |
+
"mode": "affine"
|
| 1704 |
+
},
|
| 1705 |
+
"model.layers.45.self_attn.o_proj": {
|
| 1706 |
+
"bits": 8,
|
| 1707 |
+
"group_size": 128,
|
| 1708 |
+
"mode": "affine"
|
| 1709 |
+
},
|
| 1710 |
+
"model.layers.45.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1711 |
+
"bits": 2,
|
| 1712 |
+
"group_size": 128,
|
| 1713 |
+
"mode": "affine"
|
| 1714 |
+
},
|
| 1715 |
+
"model.layers.45.block_sparse_moe.switch_mlp.down_proj": {
|
| 1716 |
+
"bits": 4,
|
| 1717 |
+
"group_size": 128,
|
| 1718 |
+
"mode": "affine"
|
| 1719 |
+
},
|
| 1720 |
+
"model.layers.45.block_sparse_moe.switch_mlp.up_proj": {
|
| 1721 |
+
"bits": 2,
|
| 1722 |
+
"group_size": 128,
|
| 1723 |
+
"mode": "affine"
|
| 1724 |
+
},
|
| 1725 |
+
"model.layers.46.self_attn.q_proj": {
|
| 1726 |
+
"bits": 8,
|
| 1727 |
+
"group_size": 128,
|
| 1728 |
+
"mode": "affine"
|
| 1729 |
+
},
|
| 1730 |
+
"model.layers.46.self_attn.k_proj": {
|
| 1731 |
+
"bits": 8,
|
| 1732 |
+
"group_size": 128,
|
| 1733 |
+
"mode": "affine"
|
| 1734 |
+
},
|
| 1735 |
+
"model.layers.46.self_attn.v_proj": {
|
| 1736 |
+
"bits": 8,
|
| 1737 |
+
"group_size": 128,
|
| 1738 |
+
"mode": "affine"
|
| 1739 |
+
},
|
| 1740 |
+
"model.layers.46.self_attn.o_proj": {
|
| 1741 |
+
"bits": 8,
|
| 1742 |
+
"group_size": 128,
|
| 1743 |
+
"mode": "affine"
|
| 1744 |
+
},
|
| 1745 |
+
"model.layers.46.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1746 |
+
"bits": 2,
|
| 1747 |
+
"group_size": 128,
|
| 1748 |
+
"mode": "affine"
|
| 1749 |
+
},
|
| 1750 |
+
"model.layers.46.block_sparse_moe.switch_mlp.down_proj": {
|
| 1751 |
+
"bits": 4,
|
| 1752 |
+
"group_size": 128,
|
| 1753 |
+
"mode": "affine"
|
| 1754 |
+
},
|
| 1755 |
+
"model.layers.46.block_sparse_moe.switch_mlp.up_proj": {
|
| 1756 |
+
"bits": 2,
|
| 1757 |
+
"group_size": 128,
|
| 1758 |
+
"mode": "affine"
|
| 1759 |
+
},
|
| 1760 |
+
"model.layers.47.self_attn.q_proj": {
|
| 1761 |
+
"bits": 8,
|
| 1762 |
+
"group_size": 128,
|
| 1763 |
+
"mode": "affine"
|
| 1764 |
+
},
|
| 1765 |
+
"model.layers.47.self_attn.k_proj": {
|
| 1766 |
+
"bits": 8,
|
| 1767 |
+
"group_size": 128,
|
| 1768 |
+
"mode": "affine"
|
| 1769 |
+
},
|
| 1770 |
+
"model.layers.47.self_attn.v_proj": {
|
| 1771 |
+
"bits": 8,
|
| 1772 |
+
"group_size": 128,
|
| 1773 |
+
"mode": "affine"
|
| 1774 |
+
},
|
| 1775 |
+
"model.layers.47.self_attn.o_proj": {
|
| 1776 |
+
"bits": 8,
|
| 1777 |
+
"group_size": 128,
|
| 1778 |
+
"mode": "affine"
|
| 1779 |
+
},
|
| 1780 |
+
"model.layers.47.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1781 |
+
"bits": 2,
|
| 1782 |
+
"group_size": 128,
|
| 1783 |
+
"mode": "affine"
|
| 1784 |
+
},
|
| 1785 |
+
"model.layers.47.block_sparse_moe.switch_mlp.down_proj": {
|
| 1786 |
+
"bits": 4,
|
| 1787 |
+
"group_size": 128,
|
| 1788 |
+
"mode": "affine"
|
| 1789 |
+
},
|
| 1790 |
+
"model.layers.47.block_sparse_moe.switch_mlp.up_proj": {
|
| 1791 |
+
"bits": 2,
|
| 1792 |
+
"group_size": 128,
|
| 1793 |
+
"mode": "affine"
|
| 1794 |
+
},
|
| 1795 |
+
"model.layers.48.self_attn.q_proj": {
|
| 1796 |
+
"bits": 8,
|
| 1797 |
+
"group_size": 128,
|
| 1798 |
+
"mode": "affine"
|
| 1799 |
+
},
|
| 1800 |
+
"model.layers.48.self_attn.k_proj": {
|
| 1801 |
+
"bits": 8,
|
| 1802 |
+
"group_size": 128,
|
| 1803 |
+
"mode": "affine"
|
| 1804 |
+
},
|
| 1805 |
+
"model.layers.48.self_attn.v_proj": {
|
| 1806 |
+
"bits": 8,
|
| 1807 |
+
"group_size": 128,
|
| 1808 |
+
"mode": "affine"
|
| 1809 |
+
},
|
| 1810 |
+
"model.layers.48.self_attn.o_proj": {
|
| 1811 |
+
"bits": 8,
|
| 1812 |
+
"group_size": 128,
|
| 1813 |
+
"mode": "affine"
|
| 1814 |
+
},
|
| 1815 |
+
"model.layers.48.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1816 |
+
"bits": 2,
|
| 1817 |
+
"group_size": 128,
|
| 1818 |
+
"mode": "affine"
|
| 1819 |
+
},
|
| 1820 |
+
"model.layers.48.block_sparse_moe.switch_mlp.down_proj": {
|
| 1821 |
+
"bits": 4,
|
| 1822 |
+
"group_size": 128,
|
| 1823 |
+
"mode": "affine"
|
| 1824 |
+
},
|
| 1825 |
+
"model.layers.48.block_sparse_moe.switch_mlp.up_proj": {
|
| 1826 |
+
"bits": 2,
|
| 1827 |
+
"group_size": 128,
|
| 1828 |
+
"mode": "affine"
|
| 1829 |
+
},
|
| 1830 |
+
"model.layers.49.self_attn.q_proj": {
|
| 1831 |
+
"bits": 8,
|
| 1832 |
+
"group_size": 128,
|
| 1833 |
+
"mode": "affine"
|
| 1834 |
+
},
|
| 1835 |
+
"model.layers.49.self_attn.k_proj": {
|
| 1836 |
+
"bits": 8,
|
| 1837 |
+
"group_size": 128,
|
| 1838 |
+
"mode": "affine"
|
| 1839 |
+
},
|
| 1840 |
+
"model.layers.49.self_attn.v_proj": {
|
| 1841 |
+
"bits": 8,
|
| 1842 |
+
"group_size": 128,
|
| 1843 |
+
"mode": "affine"
|
| 1844 |
+
},
|
| 1845 |
+
"model.layers.49.self_attn.o_proj": {
|
| 1846 |
+
"bits": 8,
|
| 1847 |
+
"group_size": 128,
|
| 1848 |
+
"mode": "affine"
|
| 1849 |
+
},
|
| 1850 |
+
"model.layers.49.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1851 |
+
"bits": 2,
|
| 1852 |
+
"group_size": 128,
|
| 1853 |
+
"mode": "affine"
|
| 1854 |
+
},
|
| 1855 |
+
"model.layers.49.block_sparse_moe.switch_mlp.down_proj": {
|
| 1856 |
+
"bits": 4,
|
| 1857 |
+
"group_size": 128,
|
| 1858 |
+
"mode": "affine"
|
| 1859 |
+
},
|
| 1860 |
+
"model.layers.49.block_sparse_moe.switch_mlp.up_proj": {
|
| 1861 |
+
"bits": 2,
|
| 1862 |
+
"group_size": 128,
|
| 1863 |
+
"mode": "affine"
|
| 1864 |
+
},
|
| 1865 |
+
"model.layers.50.self_attn.q_proj": {
|
| 1866 |
+
"bits": 8,
|
| 1867 |
+
"group_size": 128,
|
| 1868 |
+
"mode": "affine"
|
| 1869 |
+
},
|
| 1870 |
+
"model.layers.50.self_attn.k_proj": {
|
| 1871 |
+
"bits": 8,
|
| 1872 |
+
"group_size": 128,
|
| 1873 |
+
"mode": "affine"
|
| 1874 |
+
},
|
| 1875 |
+
"model.layers.50.self_attn.v_proj": {
|
| 1876 |
+
"bits": 8,
|
| 1877 |
+
"group_size": 128,
|
| 1878 |
+
"mode": "affine"
|
| 1879 |
+
},
|
| 1880 |
+
"model.layers.50.self_attn.o_proj": {
|
| 1881 |
+
"bits": 8,
|
| 1882 |
+
"group_size": 128,
|
| 1883 |
+
"mode": "affine"
|
| 1884 |
+
},
|
| 1885 |
+
"model.layers.50.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1886 |
+
"bits": 2,
|
| 1887 |
+
"group_size": 128,
|
| 1888 |
+
"mode": "affine"
|
| 1889 |
+
},
|
| 1890 |
+
"model.layers.50.block_sparse_moe.switch_mlp.down_proj": {
|
| 1891 |
+
"bits": 4,
|
| 1892 |
+
"group_size": 128,
|
| 1893 |
+
"mode": "affine"
|
| 1894 |
+
},
|
| 1895 |
+
"model.layers.50.block_sparse_moe.switch_mlp.up_proj": {
|
| 1896 |
+
"bits": 2,
|
| 1897 |
+
"group_size": 128,
|
| 1898 |
+
"mode": "affine"
|
| 1899 |
+
},
|
| 1900 |
+
"model.layers.51.self_attn.q_proj": {
|
| 1901 |
+
"bits": 8,
|
| 1902 |
+
"group_size": 128,
|
| 1903 |
+
"mode": "affine"
|
| 1904 |
+
},
|
| 1905 |
+
"model.layers.51.self_attn.k_proj": {
|
| 1906 |
+
"bits": 8,
|
| 1907 |
+
"group_size": 128,
|
| 1908 |
+
"mode": "affine"
|
| 1909 |
+
},
|
| 1910 |
+
"model.layers.51.self_attn.v_proj": {
|
| 1911 |
+
"bits": 8,
|
| 1912 |
+
"group_size": 128,
|
| 1913 |
+
"mode": "affine"
|
| 1914 |
+
},
|
| 1915 |
+
"model.layers.51.self_attn.o_proj": {
|
| 1916 |
+
"bits": 8,
|
| 1917 |
+
"group_size": 128,
|
| 1918 |
+
"mode": "affine"
|
| 1919 |
+
},
|
| 1920 |
+
"model.layers.51.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1921 |
+
"bits": 2,
|
| 1922 |
+
"group_size": 128,
|
| 1923 |
+
"mode": "affine"
|
| 1924 |
+
},
|
| 1925 |
+
"model.layers.51.block_sparse_moe.switch_mlp.down_proj": {
|
| 1926 |
+
"bits": 4,
|
| 1927 |
+
"group_size": 128,
|
| 1928 |
+
"mode": "affine"
|
| 1929 |
+
},
|
| 1930 |
+
"model.layers.51.block_sparse_moe.switch_mlp.up_proj": {
|
| 1931 |
+
"bits": 2,
|
| 1932 |
+
"group_size": 128,
|
| 1933 |
+
"mode": "affine"
|
| 1934 |
+
},
|
| 1935 |
+
"model.layers.52.self_attn.q_proj": {
|
| 1936 |
+
"bits": 8,
|
| 1937 |
+
"group_size": 128,
|
| 1938 |
+
"mode": "affine"
|
| 1939 |
+
},
|
| 1940 |
+
"model.layers.52.self_attn.k_proj": {
|
| 1941 |
+
"bits": 8,
|
| 1942 |
+
"group_size": 128,
|
| 1943 |
+
"mode": "affine"
|
| 1944 |
+
},
|
| 1945 |
+
"model.layers.52.self_attn.v_proj": {
|
| 1946 |
+
"bits": 8,
|
| 1947 |
+
"group_size": 128,
|
| 1948 |
+
"mode": "affine"
|
| 1949 |
+
},
|
| 1950 |
+
"model.layers.52.self_attn.o_proj": {
|
| 1951 |
+
"bits": 8,
|
| 1952 |
+
"group_size": 128,
|
| 1953 |
+
"mode": "affine"
|
| 1954 |
+
},
|
| 1955 |
+
"model.layers.52.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1956 |
+
"bits": 2,
|
| 1957 |
+
"group_size": 128,
|
| 1958 |
+
"mode": "affine"
|
| 1959 |
+
},
|
| 1960 |
+
"model.layers.52.block_sparse_moe.switch_mlp.down_proj": {
|
| 1961 |
+
"bits": 4,
|
| 1962 |
+
"group_size": 128,
|
| 1963 |
+
"mode": "affine"
|
| 1964 |
+
},
|
| 1965 |
+
"model.layers.52.block_sparse_moe.switch_mlp.up_proj": {
|
| 1966 |
+
"bits": 2,
|
| 1967 |
+
"group_size": 128,
|
| 1968 |
+
"mode": "affine"
|
| 1969 |
+
},
|
| 1970 |
+
"model.layers.53.self_attn.q_proj": {
|
| 1971 |
+
"bits": 8,
|
| 1972 |
+
"group_size": 128,
|
| 1973 |
+
"mode": "affine"
|
| 1974 |
+
},
|
| 1975 |
+
"model.layers.53.self_attn.k_proj": {
|
| 1976 |
+
"bits": 8,
|
| 1977 |
+
"group_size": 128,
|
| 1978 |
+
"mode": "affine"
|
| 1979 |
+
},
|
| 1980 |
+
"model.layers.53.self_attn.v_proj": {
|
| 1981 |
+
"bits": 8,
|
| 1982 |
+
"group_size": 128,
|
| 1983 |
+
"mode": "affine"
|
| 1984 |
+
},
|
| 1985 |
+
"model.layers.53.self_attn.o_proj": {
|
| 1986 |
+
"bits": 8,
|
| 1987 |
+
"group_size": 128,
|
| 1988 |
+
"mode": "affine"
|
| 1989 |
+
},
|
| 1990 |
+
"model.layers.53.block_sparse_moe.switch_mlp.gate_proj": {
|
| 1991 |
+
"bits": 2,
|
| 1992 |
+
"group_size": 128,
|
| 1993 |
+
"mode": "affine"
|
| 1994 |
+
},
|
| 1995 |
+
"model.layers.53.block_sparse_moe.switch_mlp.down_proj": {
|
| 1996 |
+
"bits": 4,
|
| 1997 |
+
"group_size": 128,
|
| 1998 |
+
"mode": "affine"
|
| 1999 |
+
},
|
| 2000 |
+
"model.layers.53.block_sparse_moe.switch_mlp.up_proj": {
|
| 2001 |
+
"bits": 2,
|
| 2002 |
+
"group_size": 128,
|
| 2003 |
+
"mode": "affine"
|
| 2004 |
+
},
|
| 2005 |
+
"model.layers.54.self_attn.q_proj": {
|
| 2006 |
+
"bits": 8,
|
| 2007 |
+
"group_size": 128,
|
| 2008 |
+
"mode": "affine"
|
| 2009 |
+
},
|
| 2010 |
+
"model.layers.54.self_attn.k_proj": {
|
| 2011 |
+
"bits": 8,
|
| 2012 |
+
"group_size": 128,
|
| 2013 |
+
"mode": "affine"
|
| 2014 |
+
},
|
| 2015 |
+
"model.layers.54.self_attn.v_proj": {
|
| 2016 |
+
"bits": 8,
|
| 2017 |
+
"group_size": 128,
|
| 2018 |
+
"mode": "affine"
|
| 2019 |
+
},
|
| 2020 |
+
"model.layers.54.self_attn.o_proj": {
|
| 2021 |
+
"bits": 8,
|
| 2022 |
+
"group_size": 128,
|
| 2023 |
+
"mode": "affine"
|
| 2024 |
+
},
|
| 2025 |
+
"model.layers.54.block_sparse_moe.switch_mlp.gate_proj": {
|
| 2026 |
+
"bits": 2,
|
| 2027 |
+
"group_size": 128,
|
| 2028 |
+
"mode": "affine"
|
| 2029 |
+
},
|
| 2030 |
+
"model.layers.54.block_sparse_moe.switch_mlp.down_proj": {
|
| 2031 |
+
"bits": 4,
|
| 2032 |
+
"group_size": 128,
|
| 2033 |
+
"mode": "affine"
|
| 2034 |
+
},
|
| 2035 |
+
"model.layers.54.block_sparse_moe.switch_mlp.up_proj": {
|
| 2036 |
+
"bits": 2,
|
| 2037 |
+
"group_size": 128,
|
| 2038 |
+
"mode": "affine"
|
| 2039 |
+
},
|
| 2040 |
+
"model.layers.55.self_attn.q_proj": {
|
| 2041 |
+
"bits": 8,
|
| 2042 |
+
"group_size": 128,
|
| 2043 |
+
"mode": "affine"
|
| 2044 |
+
},
|
| 2045 |
+
"model.layers.55.self_attn.k_proj": {
|
| 2046 |
+
"bits": 8,
|
| 2047 |
+
"group_size": 128,
|
| 2048 |
+
"mode": "affine"
|
| 2049 |
+
},
|
| 2050 |
+
"model.layers.55.self_attn.v_proj": {
|
| 2051 |
+
"bits": 8,
|
| 2052 |
+
"group_size": 128,
|
| 2053 |
+
"mode": "affine"
|
| 2054 |
+
},
|
| 2055 |
+
"model.layers.55.self_attn.o_proj": {
|
| 2056 |
+
"bits": 8,
|
| 2057 |
+
"group_size": 128,
|
| 2058 |
+
"mode": "affine"
|
| 2059 |
+
},
|
| 2060 |
+
"model.layers.55.block_sparse_moe.switch_mlp.gate_proj": {
|
| 2061 |
+
"bits": 2,
|
| 2062 |
+
"group_size": 128,
|
| 2063 |
+
"mode": "affine"
|
| 2064 |
+
},
|
| 2065 |
+
"model.layers.55.block_sparse_moe.switch_mlp.down_proj": {
|
| 2066 |
+
"bits": 4,
|
| 2067 |
+
"group_size": 128,
|
| 2068 |
+
"mode": "affine"
|
| 2069 |
+
},
|
| 2070 |
+
"model.layers.55.block_sparse_moe.switch_mlp.up_proj": {
|
| 2071 |
+
"bits": 2,
|
| 2072 |
+
"group_size": 128,
|
| 2073 |
+
"mode": "affine"
|
| 2074 |
+
},
|
| 2075 |
+
"model.layers.56.self_attn.q_proj": {
|
| 2076 |
+
"bits": 8,
|
| 2077 |
+
"group_size": 128,
|
| 2078 |
+
"mode": "affine"
|
| 2079 |
+
},
|
| 2080 |
+
"model.layers.56.self_attn.k_proj": {
|
| 2081 |
+
"bits": 8,
|
| 2082 |
+
"group_size": 128,
|
| 2083 |
+
"mode": "affine"
|
| 2084 |
+
},
|
| 2085 |
+
"model.layers.56.self_attn.v_proj": {
|
| 2086 |
+
"bits": 8,
|
| 2087 |
+
"group_size": 128,
|
| 2088 |
+
"mode": "affine"
|
| 2089 |
+
},
|
| 2090 |
+
"model.layers.56.self_attn.o_proj": {
|
| 2091 |
+
"bits": 8,
|
| 2092 |
+
"group_size": 128,
|
| 2093 |
+
"mode": "affine"
|
| 2094 |
+
},
|
| 2095 |
+
"model.layers.56.block_sparse_moe.switch_mlp.gate_proj": {
|
| 2096 |
+
"bits": 2,
|
| 2097 |
+
"group_size": 128,
|
| 2098 |
+
"mode": "affine"
|
| 2099 |
+
},
|
| 2100 |
+
"model.layers.56.block_sparse_moe.switch_mlp.down_proj": {
|
| 2101 |
+
"bits": 4,
|
| 2102 |
+
"group_size": 128,
|
| 2103 |
+
"mode": "affine"
|
| 2104 |
+
},
|
| 2105 |
+
"model.layers.56.block_sparse_moe.switch_mlp.up_proj": {
|
| 2106 |
+
"bits": 2,
|
| 2107 |
+
"group_size": 128,
|
| 2108 |
+
"mode": "affine"
|
| 2109 |
+
},
|
| 2110 |
+
"model.layers.57.self_attn.q_proj": {
|
| 2111 |
+
"bits": 8,
|
| 2112 |
+
"group_size": 128,
|
| 2113 |
+
"mode": "affine"
|
| 2114 |
+
},
|
| 2115 |
+
"model.layers.57.self_attn.k_proj": {
|
| 2116 |
+
"bits": 8,
|
| 2117 |
+
"group_size": 128,
|
| 2118 |
+
"mode": "affine"
|
| 2119 |
+
},
|
| 2120 |
+
"model.layers.57.self_attn.v_proj": {
|
| 2121 |
+
"bits": 8,
|
| 2122 |
+
"group_size": 128,
|
| 2123 |
+
"mode": "affine"
|
| 2124 |
+
},
|
| 2125 |
+
"model.layers.57.self_attn.o_proj": {
|
| 2126 |
+
"bits": 8,
|
| 2127 |
+
"group_size": 128,
|
| 2128 |
+
"mode": "affine"
|
| 2129 |
+
},
|
| 2130 |
+
"model.layers.57.block_sparse_moe.switch_mlp.gate_proj": {
|
| 2131 |
+
"bits": 2,
|
| 2132 |
+
"group_size": 128,
|
| 2133 |
+
"mode": "affine"
|
| 2134 |
+
},
|
| 2135 |
+
"model.layers.57.block_sparse_moe.switch_mlp.down_proj": {
|
| 2136 |
+
"bits": 4,
|
| 2137 |
+
"group_size": 128,
|
| 2138 |
+
"mode": "affine"
|
| 2139 |
+
},
|
| 2140 |
+
"model.layers.57.block_sparse_moe.switch_mlp.up_proj": {
|
| 2141 |
+
"bits": 2,
|
| 2142 |
+
"group_size": 128,
|
| 2143 |
+
"mode": "affine"
|
| 2144 |
+
},
|
| 2145 |
+
"model.layers.58.self_attn.q_proj": {
|
| 2146 |
+
"bits": 8,
|
| 2147 |
+
"group_size": 128,
|
| 2148 |
+
"mode": "affine"
|
| 2149 |
+
},
|
| 2150 |
+
"model.layers.58.self_attn.k_proj": {
|
| 2151 |
+
"bits": 8,
|
| 2152 |
+
"group_size": 128,
|
| 2153 |
+
"mode": "affine"
|
| 2154 |
+
},
|
| 2155 |
+
"model.layers.58.self_attn.v_proj": {
|
| 2156 |
+
"bits": 8,
|
| 2157 |
+
"group_size": 128,
|
| 2158 |
+
"mode": "affine"
|
| 2159 |
+
},
|
| 2160 |
+
"model.layers.58.self_attn.o_proj": {
|
| 2161 |
+
"bits": 8,
|
| 2162 |
+
"group_size": 128,
|
| 2163 |
+
"mode": "affine"
|
| 2164 |
+
},
|
| 2165 |
+
"model.layers.58.block_sparse_moe.switch_mlp.gate_proj": {
|
| 2166 |
+
"bits": 2,
|
| 2167 |
+
"group_size": 128,
|
| 2168 |
+
"mode": "affine"
|
| 2169 |
+
},
|
| 2170 |
+
"model.layers.58.block_sparse_moe.switch_mlp.down_proj": {
|
| 2171 |
+
"bits": 4,
|
| 2172 |
+
"group_size": 128,
|
| 2173 |
+
"mode": "affine"
|
| 2174 |
+
},
|
| 2175 |
+
"model.layers.58.block_sparse_moe.switch_mlp.up_proj": {
|
| 2176 |
+
"bits": 2,
|
| 2177 |
+
"group_size": 128,
|
| 2178 |
+
"mode": "affine"
|
| 2179 |
+
},
|
| 2180 |
+
"model.layers.59.self_attn.q_proj": {
|
| 2181 |
+
"bits": 8,
|
| 2182 |
+
"group_size": 128,
|
| 2183 |
+
"mode": "affine"
|
| 2184 |
+
},
|
| 2185 |
+
"model.layers.59.self_attn.k_proj": {
|
| 2186 |
+
"bits": 8,
|
| 2187 |
+
"group_size": 128,
|
| 2188 |
+
"mode": "affine"
|
| 2189 |
+
},
|
| 2190 |
+
"model.layers.59.self_attn.v_proj": {
|
| 2191 |
+
"bits": 8,
|
| 2192 |
+
"group_size": 128,
|
| 2193 |
+
"mode": "affine"
|
| 2194 |
+
},
|
| 2195 |
+
"model.layers.59.self_attn.o_proj": {
|
| 2196 |
+
"bits": 8,
|
| 2197 |
+
"group_size": 128,
|
| 2198 |
+
"mode": "affine"
|
| 2199 |
+
},
|
| 2200 |
+
"model.layers.59.block_sparse_moe.switch_mlp.gate_proj": {
|
| 2201 |
+
"bits": 2,
|
| 2202 |
+
"group_size": 128,
|
| 2203 |
+
"mode": "affine"
|
| 2204 |
+
},
|
| 2205 |
+
"model.layers.59.block_sparse_moe.switch_mlp.down_proj": {
|
| 2206 |
+
"bits": 4,
|
| 2207 |
+
"group_size": 128,
|
| 2208 |
+
"mode": "affine"
|
| 2209 |
+
},
|
| 2210 |
+
"model.layers.59.block_sparse_moe.switch_mlp.up_proj": {
|
| 2211 |
+
"bits": 2,
|
| 2212 |
+
"group_size": 128,
|
| 2213 |
+
"mode": "affine"
|
| 2214 |
+
},
|
| 2215 |
+
"model.layers.60.self_attn.q_proj": {
|
| 2216 |
+
"bits": 8,
|
| 2217 |
+
"group_size": 128,
|
| 2218 |
+
"mode": "affine"
|
| 2219 |
+
},
|
| 2220 |
+
"model.layers.60.self_attn.k_proj": {
|
| 2221 |
+
"bits": 8,
|
| 2222 |
+
"group_size": 128,
|
| 2223 |
+
"mode": "affine"
|
| 2224 |
+
},
|
| 2225 |
+
"model.layers.60.self_attn.v_proj": {
|
| 2226 |
+
"bits": 8,
|
| 2227 |
+
"group_size": 128,
|
| 2228 |
+
"mode": "affine"
|
| 2229 |
+
},
|
| 2230 |
+
"model.layers.60.self_attn.o_proj": {
|
| 2231 |
+
"bits": 8,
|
| 2232 |
+
"group_size": 128,
|
| 2233 |
+
"mode": "affine"
|
| 2234 |
+
},
|
| 2235 |
+
"model.layers.60.block_sparse_moe.switch_mlp.gate_proj": {
|
| 2236 |
+
"bits": 2,
|
| 2237 |
+
"group_size": 128,
|
| 2238 |
+
"mode": "affine"
|
| 2239 |
+
},
|
| 2240 |
+
"model.layers.60.block_sparse_moe.switch_mlp.down_proj": {
|
| 2241 |
+
"bits": 4,
|
| 2242 |
+
"group_size": 128,
|
| 2243 |
+
"mode": "affine"
|
| 2244 |
+
},
|
| 2245 |
+
"model.layers.60.block_sparse_moe.switch_mlp.up_proj": {
|
| 2246 |
+
"bits": 2,
|
| 2247 |
+
"group_size": 128,
|
| 2248 |
+
"mode": "affine"
|
| 2249 |
+
},
|
| 2250 |
+
"model.layers.61.self_attn.q_proj": {
|
| 2251 |
+
"bits": 8,
|
| 2252 |
+
"group_size": 128,
|
| 2253 |
+
"mode": "affine"
|
| 2254 |
+
},
|
| 2255 |
+
"model.layers.61.self_attn.k_proj": {
|
| 2256 |
+
"bits": 8,
|
| 2257 |
+
"group_size": 128,
|
| 2258 |
+
"mode": "affine"
|
| 2259 |
+
},
|
| 2260 |
+
"model.layers.61.self_attn.v_proj": {
|
| 2261 |
+
"bits": 8,
|
| 2262 |
+
"group_size": 128,
|
| 2263 |
+
"mode": "affine"
|
| 2264 |
+
},
|
| 2265 |
+
"model.layers.61.self_attn.o_proj": {
|
| 2266 |
+
"bits": 8,
|
| 2267 |
+
"group_size": 128,
|
| 2268 |
+
"mode": "affine"
|
| 2269 |
+
},
|
| 2270 |
+
"model.layers.61.block_sparse_moe.switch_mlp.gate_proj": {
|
| 2271 |
+
"bits": 2,
|
| 2272 |
+
"group_size": 128,
|
| 2273 |
+
"mode": "affine"
|
| 2274 |
+
},
|
| 2275 |
+
"model.layers.61.block_sparse_moe.switch_mlp.down_proj": {
|
| 2276 |
+
"bits": 4,
|
| 2277 |
+
"group_size": 128,
|
| 2278 |
+
"mode": "affine"
|
| 2279 |
+
},
|
| 2280 |
+
"model.layers.61.block_sparse_moe.switch_mlp.up_proj": {
|
| 2281 |
+
"bits": 2,
|
| 2282 |
+
"group_size": 128,
|
| 2283 |
+
"mode": "affine"
|
| 2284 |
+
}
|
| 2285 |
+
},
|
| 2286 |
+
"torch_dtype": "bfloat16"
|
| 2287 |
+
}
|
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 |
+
}
|
jang_config.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"format": "jang",
|
| 3 |
+
"format_version": "2.0",
|
| 4 |
+
"quantization": {
|
| 5 |
+
"method": "jang-affine-mixed",
|
| 6 |
+
"profile": "JANG_K",
|
| 7 |
+
"block_size": 128,
|
| 8 |
+
"mode": "affine",
|
| 9 |
+
"bit_widths_used": [
|
| 10 |
+
2,
|
| 11 |
+
4,
|
| 12 |
+
6,
|
| 13 |
+
8
|
| 14 |
+
],
|
| 15 |
+
"routed_avg_bits": 2.667,
|
| 16 |
+
"awq": {
|
| 17 |
+
"enabled": true,
|
| 18 |
+
"alpha": 0.5,
|
| 19 |
+
"scope": "routed_experts.gate_proj+up_proj (joint per-layer)",
|
| 20 |
+
"fold_target": "post_attention_layernorm.weight",
|
| 21 |
+
"scale_floor": 1.0
|
| 22 |
+
}
|
| 23 |
+
},
|
| 24 |
+
"source_model": {
|
| 25 |
+
"name": "MiniMax-M2.7-FP8",
|
| 26 |
+
"dtype": "fp8_e4m3",
|
| 27 |
+
"parameters": "227.6B"
|
| 28 |
+
},
|
| 29 |
+
"architecture": {
|
| 30 |
+
"type": "moe",
|
| 31 |
+
"attention": "gqa",
|
| 32 |
+
"has_vision": false,
|
| 33 |
+
"has_ssm": false,
|
| 34 |
+
"has_moe": true
|
| 35 |
+
},
|
| 36 |
+
"capabilities": {
|
| 37 |
+
"reasoning_parser": "qwen3",
|
| 38 |
+
"tool_parser": "minimax",
|
| 39 |
+
"think_in_template": true,
|
| 40 |
+
"supports_tools": true,
|
| 41 |
+
"supports_thinking": true,
|
| 42 |
+
"family": "minimax_m2",
|
| 43 |
+
"modality": "text",
|
| 44 |
+
"cache_type": "kv"
|
| 45 |
+
}
|
| 46 |
+
}
|
jangq-logo.png
ADDED
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model-00001-of-00018.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4d37edb74d6372488727d2756ca9fb83d8e06775aa5483b166b4d7cbc460c635
|
| 3 |
+
size 4841151704
|
model-00002-of-00018.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b0ff9848f4dc9f4dcd076adbbe645046ae0c1ae7d3d0658020cf3e6f705510a4
|
| 3 |
+
size 4501039112
|
model-00003-of-00018.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3f18089b19ce81c44e935805bb15848c2d4c9db8ec95d6230aa30f38da92b7ad
|
| 3 |
+
size 5076539576
|
model-00004-of-00018.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c48ba94fb30a81adda90d776a04e483d40c53e2dd319f8f39d94684cedecf1c4
|
| 3 |
+
size 4501039192
|
model-00005-of-00018.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:891a89c181c06ff17fc307f9873ad1a0ed3a0fd3651c3b4cd86899fe249d4681
|
| 3 |
+
size 5076539680
|
model-00006-of-00018.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e0d8f25fddabf22939d0afd003b9a73dfd9c47627d0d70e6f1c3e4a06c58b16e
|
| 3 |
+
size 4501039200
|
model-00007-of-00018.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:66c1533480205f6912b36539ae569e8d35834f12834f2402ed98abdf6e583d6c
|
| 3 |
+
size 5076539680
|
model-00008-of-00018.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5655cd13490b62068984f4d3804b2221a6bb96f4736dac221d9fc6a6abda0947
|
| 3 |
+
size 4501039200
|
model-00009-of-00018.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4e94592a0541c74f286b484f35421ccf9340d1bd8e82c409e397f4253a842e3b
|
| 3 |
+
size 5076539680
|
model-00010-of-00018.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2e8bea14a4ac55fd8d813bb60581ddaec195fa5919baf9998316f3cd45058e91
|
| 3 |
+
size 4501039200
|
model-00011-of-00018.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e82511ae8083e1e08ec06d915adc730eec777007f9b7c4c9a05db1fa8eb37381
|
| 3 |
+
size 5076539680
|
model-00012-of-00018.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cb15d103177df1ae9f94389d8d6a801fca6c71a0eb7670ee572174130fa892ff
|
| 3 |
+
size 4501039200
|
model-00013-of-00018.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8472d5b374b182bfc15a2b9c9b704f63d7f154e7641585c192966bef60b00dcc
|
| 3 |
+
size 5076539680
|
model-00014-of-00018.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:274b17148e1355e85d2fa544c26b749fc98cc0abb0e3c5f4223b59ac86f619c3
|
| 3 |
+
size 4501039200
|
model-00015-of-00018.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6b43bcd323d1f0beba6de50dc12a5d2827aa7411fdaf3c4b3ac53f6e31130151
|
| 3 |
+
size 5076539680
|
model-00016-of-00018.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:91fdadf71aabbe354166768c0073091960cab55a4e49365c7fec9d0ec1c6d49e
|
| 3 |
+
size 4501039200
|
model-00017-of-00018.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:98d53cbde4eea356ac6848456be34976acc7ee506d1251afe3b3f48b44199cfe
|
| 3 |
+
size 5076539680
|
model-00018-of-00018.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cec8b00a52997d596329e8af204f677bb5c991e93bf2dd8769066c6ecc6cc24d
|
| 3 |
+
size 4482164720
|
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 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,496 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"added_tokens_decoder": {
|
| 3 |
+
"200000": {
|
| 4 |
+
"content": "]!p~[",
|
| 5 |
+
"lstrip": false,
|
| 6 |
+
"normalized": false,
|
| 7 |
+
"rstrip": false,
|
| 8 |
+
"single_word": false,
|
| 9 |
+
"special": true
|
| 10 |
+
},
|
| 11 |
+
"200001": {
|
| 12 |
+
"content": "<fim_prefix>",
|
| 13 |
+
"lstrip": false,
|
| 14 |
+
"normalized": false,
|
| 15 |
+
"rstrip": false,
|
| 16 |
+
"single_word": false,
|
| 17 |
+
"special": true
|
| 18 |
+
},
|
| 19 |
+
"200002": {
|
| 20 |
+
"content": "<fim_middle>",
|
| 21 |
+
"lstrip": false,
|
| 22 |
+
"normalized": false,
|
| 23 |
+
"rstrip": false,
|
| 24 |
+
"single_word": false,
|
| 25 |
+
"special": true
|
| 26 |
+
},
|
| 27 |
+
"200003": {
|
| 28 |
+
"content": "<fim_suffix>",
|
| 29 |
+
"lstrip": false,
|
| 30 |
+
"normalized": false,
|
| 31 |
+
"rstrip": false,
|
| 32 |
+
"single_word": false,
|
| 33 |
+
"special": true
|
| 34 |
+
},
|
| 35 |
+
"200004": {
|
| 36 |
+
"content": "<fim_pad>",
|
| 37 |
+
"lstrip": false,
|
| 38 |
+
"normalized": false,
|
| 39 |
+
"rstrip": false,
|
| 40 |
+
"single_word": false,
|
| 41 |
+
"special": true
|
| 42 |
+
},
|
| 43 |
+
"200005": {
|
| 44 |
+
"content": "<reponame>",
|
| 45 |
+
"lstrip": false,
|
| 46 |
+
"normalized": false,
|
| 47 |
+
"rstrip": false,
|
| 48 |
+
"single_word": false,
|
| 49 |
+
"special": true
|
| 50 |
+
},
|
| 51 |
+
"200006": {
|
| 52 |
+
"content": "<filename>",
|
| 53 |
+
"lstrip": false,
|
| 54 |
+
"normalized": false,
|
| 55 |
+
"rstrip": false,
|
| 56 |
+
"single_word": false,
|
| 57 |
+
"special": true
|
| 58 |
+
},
|
| 59 |
+
"200007": {
|
| 60 |
+
"content": "<gh_stars>",
|
| 61 |
+
"lstrip": false,
|
| 62 |
+
"normalized": false,
|
| 63 |
+
"rstrip": false,
|
| 64 |
+
"single_word": false,
|
| 65 |
+
"special": true
|
| 66 |
+
},
|
| 67 |
+
"200008": {
|
| 68 |
+
"content": "<issue_start>",
|
| 69 |
+
"lstrip": false,
|
| 70 |
+
"normalized": false,
|
| 71 |
+
"rstrip": false,
|
| 72 |
+
"single_word": false,
|
| 73 |
+
"special": true
|
| 74 |
+
},
|
| 75 |
+
"200009": {
|
| 76 |
+
"content": "<issue_comment>",
|
| 77 |
+
"lstrip": false,
|
| 78 |
+
"normalized": false,
|
| 79 |
+
"rstrip": false,
|
| 80 |
+
"single_word": false,
|
| 81 |
+
"special": true
|
| 82 |
+
},
|
| 83 |
+
"200010": {
|
| 84 |
+
"content": "<issue_closed>",
|
| 85 |
+
"lstrip": false,
|
| 86 |
+
"normalized": false,
|
| 87 |
+
"rstrip": false,
|
| 88 |
+
"single_word": false,
|
| 89 |
+
"special": true
|
| 90 |
+
},
|
| 91 |
+
"200011": {
|
| 92 |
+
"content": "<jupyter_start>",
|
| 93 |
+
"lstrip": false,
|
| 94 |
+
"normalized": false,
|
| 95 |
+
"rstrip": false,
|
| 96 |
+
"single_word": false,
|
| 97 |
+
"special": true
|
| 98 |
+
},
|
| 99 |
+
"200012": {
|
| 100 |
+
"content": "<jupyter_text>",
|
| 101 |
+
"lstrip": false,
|
| 102 |
+
"normalized": false,
|
| 103 |
+
"rstrip": false,
|
| 104 |
+
"single_word": false,
|
| 105 |
+
"special": true
|
| 106 |
+
},
|
| 107 |
+
"200013": {
|
| 108 |
+
"content": "<jupyter_code>",
|
| 109 |
+
"lstrip": false,
|
| 110 |
+
"normalized": false,
|
| 111 |
+
"rstrip": false,
|
| 112 |
+
"single_word": false,
|
| 113 |
+
"special": true
|
| 114 |
+
},
|
| 115 |
+
"200014": {
|
| 116 |
+
"content": "<jupyter_output>",
|
| 117 |
+
"lstrip": false,
|
| 118 |
+
"normalized": false,
|
| 119 |
+
"rstrip": false,
|
| 120 |
+
"single_word": false,
|
| 121 |
+
"special": true
|
| 122 |
+
},
|
| 123 |
+
"200015": {
|
| 124 |
+
"content": "<empty_output>",
|
| 125 |
+
"lstrip": false,
|
| 126 |
+
"normalized": false,
|
| 127 |
+
"rstrip": false,
|
| 128 |
+
"single_word": false,
|
| 129 |
+
"special": true
|
| 130 |
+
},
|
| 131 |
+
"200016": {
|
| 132 |
+
"content": "<commit_before>",
|
| 133 |
+
"lstrip": false,
|
| 134 |
+
"normalized": false,
|
| 135 |
+
"rstrip": false,
|
| 136 |
+
"single_word": false,
|
| 137 |
+
"special": true
|
| 138 |
+
},
|
| 139 |
+
"200017": {
|
| 140 |
+
"content": "<commit_msg>",
|
| 141 |
+
"lstrip": false,
|
| 142 |
+
"normalized": false,
|
| 143 |
+
"rstrip": false,
|
| 144 |
+
"single_word": false,
|
| 145 |
+
"special": true
|
| 146 |
+
},
|
| 147 |
+
"200018": {
|
| 148 |
+
"content": "<commit_after>",
|
| 149 |
+
"lstrip": false,
|
| 150 |
+
"normalized": false,
|
| 151 |
+
"rstrip": false,
|
| 152 |
+
"single_word": false,
|
| 153 |
+
"special": true
|
| 154 |
+
},
|
| 155 |
+
"200019": {
|
| 156 |
+
"content": "]~b]",
|
| 157 |
+
"lstrip": false,
|
| 158 |
+
"normalized": false,
|
| 159 |
+
"rstrip": false,
|
| 160 |
+
"single_word": false,
|
| 161 |
+
"special": true
|
| 162 |
+
},
|
| 163 |
+
"200020": {
|
| 164 |
+
"content": "[e~[",
|
| 165 |
+
"lstrip": false,
|
| 166 |
+
"normalized": false,
|
| 167 |
+
"rstrip": false,
|
| 168 |
+
"single_word": false,
|
| 169 |
+
"special": true
|
| 170 |
+
},
|
| 171 |
+
"200021": {
|
| 172 |
+
"content": "]!d~[",
|
| 173 |
+
"lstrip": false,
|
| 174 |
+
"normalized": false,
|
| 175 |
+
"rstrip": false,
|
| 176 |
+
"single_word": false,
|
| 177 |
+
"special": true
|
| 178 |
+
},
|
| 179 |
+
"200022": {
|
| 180 |
+
"content": "<function_call>",
|
| 181 |
+
"lstrip": false,
|
| 182 |
+
"normalized": false,
|
| 183 |
+
"rstrip": false,
|
| 184 |
+
"single_word": false,
|
| 185 |
+
"special": true
|
| 186 |
+
},
|
| 187 |
+
"200023": {
|
| 188 |
+
"content": "<code_interpreter>",
|
| 189 |
+
"lstrip": false,
|
| 190 |
+
"normalized": false,
|
| 191 |
+
"rstrip": false,
|
| 192 |
+
"single_word": false,
|
| 193 |
+
"special": true
|
| 194 |
+
},
|
| 195 |
+
"200024": {
|
| 196 |
+
"content": "]<]speech[>[",
|
| 197 |
+
"lstrip": false,
|
| 198 |
+
"normalized": false,
|
| 199 |
+
"rstrip": false,
|
| 200 |
+
"single_word": false,
|
| 201 |
+
"special": true
|
| 202 |
+
},
|
| 203 |
+
"200025": {
|
| 204 |
+
"content": "]<]image[>[",
|
| 205 |
+
"lstrip": false,
|
| 206 |
+
"normalized": false,
|
| 207 |
+
"rstrip": false,
|
| 208 |
+
"single_word": false,
|
| 209 |
+
"special": true
|
| 210 |
+
},
|
| 211 |
+
"200026": {
|
| 212 |
+
"content": "]<]video[>[",
|
| 213 |
+
"lstrip": false,
|
| 214 |
+
"normalized": false,
|
| 215 |
+
"rstrip": false,
|
| 216 |
+
"single_word": false,
|
| 217 |
+
"special": true
|
| 218 |
+
},
|
| 219 |
+
"200027": {
|
| 220 |
+
"content": "]<]start of speech[>[",
|
| 221 |
+
"lstrip": false,
|
| 222 |
+
"normalized": false,
|
| 223 |
+
"rstrip": false,
|
| 224 |
+
"single_word": false,
|
| 225 |
+
"special": true
|
| 226 |
+
},
|
| 227 |
+
"200028": {
|
| 228 |
+
"content": "]<]end of speech[>[",
|
| 229 |
+
"lstrip": false,
|
| 230 |
+
"normalized": false,
|
| 231 |
+
"rstrip": false,
|
| 232 |
+
"single_word": false,
|
| 233 |
+
"special": true
|
| 234 |
+
},
|
| 235 |
+
"200029": {
|
| 236 |
+
"content": "]<]start of image[>[",
|
| 237 |
+
"lstrip": false,
|
| 238 |
+
"normalized": false,
|
| 239 |
+
"rstrip": false,
|
| 240 |
+
"single_word": false,
|
| 241 |
+
"special": true
|
| 242 |
+
},
|
| 243 |
+
"200030": {
|
| 244 |
+
"content": "]<]end of image[>[",
|
| 245 |
+
"lstrip": false,
|
| 246 |
+
"normalized": false,
|
| 247 |
+
"rstrip": false,
|
| 248 |
+
"single_word": false,
|
| 249 |
+
"special": true
|
| 250 |
+
},
|
| 251 |
+
"200031": {
|
| 252 |
+
"content": "]<]start of video[>[",
|
| 253 |
+
"lstrip": false,
|
| 254 |
+
"normalized": false,
|
| 255 |
+
"rstrip": false,
|
| 256 |
+
"single_word": false,
|
| 257 |
+
"special": true
|
| 258 |
+
},
|
| 259 |
+
"200032": {
|
| 260 |
+
"content": "]<]end of video[>[",
|
| 261 |
+
"lstrip": false,
|
| 262 |
+
"normalized": false,
|
| 263 |
+
"rstrip": false,
|
| 264 |
+
"single_word": false,
|
| 265 |
+
"special": true
|
| 266 |
+
},
|
| 267 |
+
"200033": {
|
| 268 |
+
"content": "]<]vision pad[>[",
|
| 269 |
+
"lstrip": false,
|
| 270 |
+
"normalized": false,
|
| 271 |
+
"rstrip": false,
|
| 272 |
+
"single_word": false,
|
| 273 |
+
"special": true
|
| 274 |
+
},
|
| 275 |
+
"200034": {
|
| 276 |
+
"content": "]~!b[",
|
| 277 |
+
"lstrip": false,
|
| 278 |
+
"normalized": false,
|
| 279 |
+
"rstrip": false,
|
| 280 |
+
"single_word": false,
|
| 281 |
+
"special": true
|
| 282 |
+
},
|
| 283 |
+
"200035": {
|
| 284 |
+
"content": "<jupyter_error>",
|
| 285 |
+
"lstrip": false,
|
| 286 |
+
"normalized": false,
|
| 287 |
+
"rstrip": false,
|
| 288 |
+
"single_word": false,
|
| 289 |
+
"special": true
|
| 290 |
+
},
|
| 291 |
+
"200036": {
|
| 292 |
+
"content": "<add_file>",
|
| 293 |
+
"single_word": false,
|
| 294 |
+
"lstrip": false,
|
| 295 |
+
"rstrip": false,
|
| 296 |
+
"normalized": false,
|
| 297 |
+
"special": true
|
| 298 |
+
},
|
| 299 |
+
"200037": {
|
| 300 |
+
"content": "<delete_file>",
|
| 301 |
+
"lstrip": false,
|
| 302 |
+
"normalized": false,
|
| 303 |
+
"rstrip": false,
|
| 304 |
+
"single_word": false,
|
| 305 |
+
"special": true
|
| 306 |
+
},
|
| 307 |
+
"200038": {
|
| 308 |
+
"content": "<rename_file>",
|
| 309 |
+
"lstrip": false,
|
| 310 |
+
"normalized": false,
|
| 311 |
+
"rstrip": false,
|
| 312 |
+
"single_word": false,
|
| 313 |
+
"special": true
|
| 314 |
+
},
|
| 315 |
+
"200039": {
|
| 316 |
+
"content": "<edit_file>",
|
| 317 |
+
"lstrip": false,
|
| 318 |
+
"normalized": false,
|
| 319 |
+
"rstrip": false,
|
| 320 |
+
"single_word": false,
|
| 321 |
+
"special": true
|
| 322 |
+
},
|
| 323 |
+
"200040": {
|
| 324 |
+
"content": "<commit_message>",
|
| 325 |
+
"lstrip": false,
|
| 326 |
+
"normalized": false,
|
| 327 |
+
"rstrip": false,
|
| 328 |
+
"single_word": false,
|
| 329 |
+
"special": true
|
| 330 |
+
},
|
| 331 |
+
"200041": {
|
| 332 |
+
"content": "<empty_source_file>",
|
| 333 |
+
"lstrip": false,
|
| 334 |
+
"normalized": false,
|
| 335 |
+
"rstrip": false,
|
| 336 |
+
"single_word": false,
|
| 337 |
+
"special": true
|
| 338 |
+
},
|
| 339 |
+
"200042": {
|
| 340 |
+
"content": "<repo_struct>",
|
| 341 |
+
"lstrip": false,
|
| 342 |
+
"normalized": false,
|
| 343 |
+
"rstrip": false,
|
| 344 |
+
"single_word": false,
|
| 345 |
+
"special": true
|
| 346 |
+
},
|
| 347 |
+
"200043": {
|
| 348 |
+
"content": "<code_context>",
|
| 349 |
+
"single_word": false,
|
| 350 |
+
"lstrip": false,
|
| 351 |
+
"rstrip": false,
|
| 352 |
+
"normalized": false,
|
| 353 |
+
"special": true
|
| 354 |
+
},
|
| 355 |
+
"200044": {
|
| 356 |
+
"content": "<file_content>",
|
| 357 |
+
"single_word": false,
|
| 358 |
+
"lstrip": false,
|
| 359 |
+
"rstrip": false,
|
| 360 |
+
"normalized": false,
|
| 361 |
+
"special": true
|
| 362 |
+
},
|
| 363 |
+
"200045": {
|
| 364 |
+
"content": "<source_files>",
|
| 365 |
+
"single_word": false,
|
| 366 |
+
"lstrip": false,
|
| 367 |
+
"rstrip": false,
|
| 368 |
+
"normalized": false,
|
| 369 |
+
"special": true
|
| 370 |
+
},
|
| 371 |
+
"200046": {
|
| 372 |
+
"content": "<pr_start>",
|
| 373 |
+
"single_word": false,
|
| 374 |
+
"lstrip": false,
|
| 375 |
+
"rstrip": false,
|
| 376 |
+
"normalized": false,
|
| 377 |
+
"special": true
|
| 378 |
+
},
|
| 379 |
+
"200047": {
|
| 380 |
+
"content": "<review_comment>",
|
| 381 |
+
"single_word": false,
|
| 382 |
+
"lstrip": false,
|
| 383 |
+
"rstrip": false,
|
| 384 |
+
"normalized": false,
|
| 385 |
+
"special": true
|
| 386 |
+
},
|
| 387 |
+
"200048": {
|
| 388 |
+
"content": "<filepath>",
|
| 389 |
+
"single_word": false,
|
| 390 |
+
"lstrip": false,
|
| 391 |
+
"rstrip": false,
|
| 392 |
+
"normalized": false,
|
| 393 |
+
"special": true
|
| 394 |
+
},
|
| 395 |
+
"200049": {
|
| 396 |
+
"content": "<file_sep>",
|
| 397 |
+
"single_word": false,
|
| 398 |
+
"lstrip": false,
|
| 399 |
+
"rstrip": false,
|
| 400 |
+
"normalized": false,
|
| 401 |
+
"special": true
|
| 402 |
+
},
|
| 403 |
+
"200050": {
|
| 404 |
+
"content": "<think>",
|
| 405 |
+
"single_word": false,
|
| 406 |
+
"lstrip": false,
|
| 407 |
+
"rstrip": false,
|
| 408 |
+
"normalized": false,
|
| 409 |
+
"special": false
|
| 410 |
+
},
|
| 411 |
+
"200051": {
|
| 412 |
+
"content": "</think>",
|
| 413 |
+
"single_word": false,
|
| 414 |
+
"lstrip": false,
|
| 415 |
+
"rstrip": false,
|
| 416 |
+
"normalized": false,
|
| 417 |
+
"special": false
|
| 418 |
+
},
|
| 419 |
+
"200052": {
|
| 420 |
+
"content": "<minimax:tool_call>",
|
| 421 |
+
"single_word": false,
|
| 422 |
+
"lstrip": false,
|
| 423 |
+
"rstrip": false,
|
| 424 |
+
"normalized": false,
|
| 425 |
+
"special": false
|
| 426 |
+
},
|
| 427 |
+
"200053": {
|
| 428 |
+
"content": "</minimax:tool_call>",
|
| 429 |
+
"single_word": false,
|
| 430 |
+
"lstrip": false,
|
| 431 |
+
"rstrip": false,
|
| 432 |
+
"normalized": false,
|
| 433 |
+
"special": false
|
| 434 |
+
}
|
| 435 |
+
},
|
| 436 |
+
"additional_special_tokens": [
|
| 437 |
+
"<code_interpreter>",
|
| 438 |
+
"<commit_after>",
|
| 439 |
+
"<commit_before>",
|
| 440 |
+
"<commit_msg>",
|
| 441 |
+
"<empty_output>",
|
| 442 |
+
"<filename>",
|
| 443 |
+
"<fim_middle>",
|
| 444 |
+
"<fim_pad>",
|
| 445 |
+
"<fim_prefix>",
|
| 446 |
+
"<fim_suffix>",
|
| 447 |
+
"<function_call>",
|
| 448 |
+
"<gh_stars>",
|
| 449 |
+
"]<]speech[>[",
|
| 450 |
+
"]<]image[>[",
|
| 451 |
+
"]<]video[>[",
|
| 452 |
+
"]<]start of speech[>[",
|
| 453 |
+
"]<]end of speech[>[",
|
| 454 |
+
"]<]start of image[>[",
|
| 455 |
+
"]<]end of image[>[",
|
| 456 |
+
"]<]start of video[>[",
|
| 457 |
+
"]<]end of video[>[",
|
| 458 |
+
"]<]vision pad[>[",
|
| 459 |
+
"]~!b[",
|
| 460 |
+
"<issue_closed>",
|
| 461 |
+
"<issue_comment>",
|
| 462 |
+
"<issue_start>",
|
| 463 |
+
"<jupyter_code>",
|
| 464 |
+
"<jupyter_output>",
|
| 465 |
+
"<jupyter_start>",
|
| 466 |
+
"<jupyter_text>",
|
| 467 |
+
"<reponame>",
|
| 468 |
+
"[e~[",
|
| 469 |
+
"]!d~[",
|
| 470 |
+
"]!p~[",
|
| 471 |
+
"]~b]",
|
| 472 |
+
"<jupyter_error>",
|
| 473 |
+
"<add_file>",
|
| 474 |
+
"<delete_file>",
|
| 475 |
+
"<rename_file>",
|
| 476 |
+
"<edit_file>",
|
| 477 |
+
"<commit_message>",
|
| 478 |
+
"<empty_source_file>",
|
| 479 |
+
"<repo_struct>",
|
| 480 |
+
"<code_context>",
|
| 481 |
+
"<file_content>",
|
| 482 |
+
"<source_files>",
|
| 483 |
+
"<pr_start>",
|
| 484 |
+
"<review_comment>",
|
| 485 |
+
"<filepath>",
|
| 486 |
+
"<file_sep>"
|
| 487 |
+
],
|
| 488 |
+
"add_prefix_space": false,
|
| 489 |
+
"bos_token": "]~!b[",
|
| 490 |
+
"clean_up_tokenization_spaces": false,
|
| 491 |
+
"eos_token": "[e~[",
|
| 492 |
+
"model_max_length": 40960000,
|
| 493 |
+
"tokenizer_class": "GPT2Tokenizer",
|
| 494 |
+
"unk_token": "]!d~[",
|
| 495 |
+
"chat_template": "{# ----------‑‑‑ special token variables ‑‑‑---------- #}\n{%- set toolcall_begin_token = '<minimax:tool_call>' -%}\n{%- set toolcall_end_token = '</minimax:tool_call>' -%}\n{#- Tool Rendering Functions ============================================== -#}\n{%- macro render_tool_namespace(namespace_name, tool_list) -%}\n{%- for tool in tool_list -%}\n<tool>{{ tool.function | tojson(ensure_ascii=False) }}</tool>\n{% endfor -%}\n{%- endmacro -%}\n{%- macro visible_text(content) -%}\n {%- if content is string -%}\n {{ content }}\n {%- elif content is iterable and content is not mapping -%}\n {%- for item in content -%}\n {%- if item is mapping and item.type == 'text' -%}\n {{- item.text }}\n {%- elif item is string -%}\n {{- item }}\n {%- endif -%}\n {%- endfor -%}\n {%- else -%}\n {{- content }}\n {%- endif -%}\n{%- endmacro -%}\n{#- System Message Construction ============================================ -#}\n{%- macro build_system_message(system_message) -%}\n {%- if system_message and system_message.content -%}\n {{- visible_text(system_message.content) }}\n {%- else -%}\n {%- if model_identity is not defined -%}\n {%- set model_identity = \"You are a helpful assistant. Your name is MiniMax-M2.7 and is built by MiniMax.\" -%}\n {%- endif -%}\n {{- model_identity }}\n {%- endif -%}\n \n {#- Handle current_date -#}\n {%- if system_message and system_message.current_date -%}\n {{- '\\n' ~ 'Current date: ' + system_message.current_date }}\n {%- endif -%}\n {#- Handle current_location -#}\n {%- if system_message and system_message.current_location -%}\n {{- '\\n' ~ 'Current location: ' + system_message.current_location }}\n {%- endif -%}\n{%- endmacro -%}\n{#- Main Template Logic ================================================= -#}\n{#- Extract system message (only first message if it's system) -#}\n{%- set system_message = none -%}\n{%- set conversation_messages = messages -%}\n{%- if messages and messages[0].role == \"system\" -%}\n {%- set system_message = messages[0] -%}\n {%- set conversation_messages = messages[1:] -%}\n{%- endif -%}\n{#- Get the last user message turn, for interleved thinking -#}\n{%- set ns = namespace(last_user_index=-1) %}\n{% for m in conversation_messages %}\n {%- if m.role == 'user' %}\n {% set ns.last_user_index = loop.index0 -%}\n {%- endif %}\n{%- endfor %}\n{#- Render system message -#}\n{{- ']~!b[' ~ ']~b]system' ~ '\\n' }}\n{{- build_system_message(system_message) }}\n{#- Render tools if available -#}\n{%- if tools -%}\n {{- '\\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 {{- '\\n' ~ '<tools>' ~ '\\n' }}\n {{- render_tool_namespace(\"functions\", tools) }}\n {{- '</tools>' ~ '\\n\\n' }}\n{{- 'When making tool calls, use XML format to invoke tools and pass parameters:' ~ '\\n' }}\n{{- '\\n' ~ toolcall_begin_token }}\n<invoke name=\"tool-name-1\">\n<parameter name=\"param-key-1\">param-value-1</parameter>\n<parameter name=\"param-key-2\">param-value-2</parameter>\n...\n</invoke>\n{{- '\\n' ~ toolcall_end_token }}\n{%- endif -%}\n{{- '[e~[\\n' }}\n\n{#- Render messages -#}\n{%- set last_tool_call = namespace(name=none) -%}\n{%- for message in conversation_messages -%}\n {%- if message.role == 'assistant' -%}\n {#- Only render reasoning_content if no user message follows -#}\n {{- ']~b]ai' ~ '\\n' }}\n\n {%- set reasoning_content = '' %}\n {%- set content = visible_text(message.content) %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].strip('\\n').split('<think>')[-1].strip('\\n') %}\n {%- set content = content.split('</think>')[-1].strip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- if reasoning_content and loop.index0 > ns.last_user_index -%}\n {{- '<think>' ~ '\\n' ~ reasoning_content ~ '\\n' ~ '</think>' ~ '\\n\\n' }}\n {%- endif -%}\n {%- if content -%}\n {{- content }}\n {%- endif -%}\n {%- if message.tool_calls -%}\n {{- '\\n' ~ toolcall_begin_token ~ '\\n' }}\n\n {%- for tool_call in message.tool_calls -%}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<invoke name=\"' + tool_call.name + '\">' }}\n {% set _args = tool_call.arguments %}\n {%- for k, v in _args.items() %}\n {{- '<parameter name=\"' + k + '\">' }}\n {{- v | tojson(ensure_ascii=False) if v is not string else v }}\n {{- '</parameter>' }}\n {% endfor %}\n {{- '</invoke>' ~ '\\n' }}\n {%- endfor -%}\n \n {{- toolcall_end_token}}\n {%- set last_tool_call.name = message.tool_calls[-1].name -%}\n {%- else -%}\n {%- set last_tool_call.name = none -%}\n {%- endif -%}\n {{- '[e~[' ~ '\\n' }}\n \n {%- elif message.role == 'tool' -%}\n {%- if last_tool_call.name is none -%}\n {{- raise_exception(\"Message has tool role, but there was no previous assistant message with a tool call!\") }}\n {%- endif -%}\n {%- if loop.first or (conversation_messages[loop.index0 - 1].role != 'tool') -%}\n {{- ']~b]tool' }}\n {%- endif -%}\n {%- if message.content is string -%}\n {{- '\\n<response>' }}\n {{- message.content }}\n {{- '</response>' }}\n {%- else -%}\n {%- for tr in message.content -%}\n {{- '\\n<response>' }}\n {{- tr.output if tr.output is defined else (tr.text if tr.type == 'text' and tr.text is defined else tr) }}\n {{- '\\n</response>' }}\n {%- endfor -%}\n {%- endif -%}\n {%- if loop.last or (conversation_messages[loop.index0 + 1].role != 'tool') -%}\n {{- '[e~[\\n' -}}\n {%- endif -%}\n \n {%- elif message.role == 'user' -%}\n {{- ']~b]user' ~ '\\n' }}\n {{- visible_text(message.content) }}\n {{- '[e~[' ~ '\\n' }}\n {%- endif -%}\n{%- endfor -%}\n\n{#- Generation prompt -#}\n{%- if add_generation_prompt -%}\n{{- ']~b]ai' ~ '\\n' }}\n {%- if enable_thinking is defined and enable_thinking is false -%}\n {%- else -%}\n {{- '<think>' ~ '\\n' }}\n {%- endif -%}\n{%- endif -%}\n"
|
| 496 |
+
}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|