HuggingFace Container User
commited on
Commit
·
3c4bc8b
1
Parent(s):
b36db0c
fork: 05.11.2025
Browse files- .gitattributes +2 -0
- README.md +436 -3
- chat_template.jinja +159 -0
- config.json +3 -0
- configuration.json +3 -0
- docs/function_call_guide.md +482 -0
- docs/function_call_guide_cn.md +482 -0
- docs/vllm_deploy_guide.md +88 -0
- docs/vllm_deploy_guide_cn.md +85 -0
- figures/Bench.png +3 -0
- generation_config.json +3 -0
- merges.txt +0 -0
- model.safetensors.index.json +3 -0
- tokenizer.json +3 -0
- tokenizer_config.json +3 -0
- vocab.json +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
*.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,3 +1,436 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
tags:
|
| 6 |
+
- vLLM
|
| 7 |
+
- AWQ
|
| 8 |
+
base_model:
|
| 9 |
+
- MiniMaxAI/MiniMax-M2
|
| 10 |
+
base_model_relation: quantized
|
| 11 |
+
|
| 12 |
+
---
|
| 13 |
+
# MiniMax-M2-AWQ
|
| 14 |
+
Base model: [MiniMaxAI/MiniMax-M2](https://huggingface.co/MiniMaxAI/MiniMax-M2)
|
| 15 |
+
|
| 16 |
+
### 【Dependencies / Installation】
|
| 17 |
+
As of **2025-10-28**, create a fresh Python environment and run:
|
| 18 |
+
```bash
|
| 19 |
+
pip install -U pip
|
| 20 |
+
pip install vllm --pre --extra-index-url https://wheels.vllm.ai/nightly
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
[vLLM Official Guide](https://docs.vllm.ai/projects/recipes/en/latest/MiniMax/MiniMax-M2.html)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
<details>
|
| 27 |
+
|
| 28 |
+
<summary>testing environment</summary>
|
| 29 |
+
|
| 30 |
+
```
|
| 31 |
+
Package Version
|
| 32 |
+
---------------------------------- --------------------------------
|
| 33 |
+
aiohappyeyeballs 2.6.1
|
| 34 |
+
aiohttp 3.13.1
|
| 35 |
+
aiosignal 1.4.0
|
| 36 |
+
annotated-doc 0.0.3
|
| 37 |
+
annotated-types 0.7.0
|
| 38 |
+
anthropic 0.71.0
|
| 39 |
+
anyio 4.11.0
|
| 40 |
+
apache-tvm-ffi 0.1.0b15
|
| 41 |
+
astor 0.8.1
|
| 42 |
+
attrs 25.4.0
|
| 43 |
+
blake3 1.0.8
|
| 44 |
+
cachetools 6.2.1
|
| 45 |
+
cbor2 5.7.1
|
| 46 |
+
certifi 2025.10.5
|
| 47 |
+
cffi 2.0.0
|
| 48 |
+
charset-normalizer 3.4.4
|
| 49 |
+
click 8.2.1
|
| 50 |
+
cloudpickle 3.1.1
|
| 51 |
+
compressed-tensors 0.12.2
|
| 52 |
+
cuda-bindings 13.0.3
|
| 53 |
+
cuda-pathfinder 1.3.1
|
| 54 |
+
cuda-python 13.0.3
|
| 55 |
+
cupy-cuda12x 13.6.0
|
| 56 |
+
depyf 0.20.0
|
| 57 |
+
dill 0.4.0
|
| 58 |
+
diskcache 5.6.3
|
| 59 |
+
distro 1.9.0
|
| 60 |
+
dnspython 2.8.0
|
| 61 |
+
docstring_parser 0.17.0
|
| 62 |
+
einops 0.8.1
|
| 63 |
+
email-validator 2.3.0
|
| 64 |
+
fastapi 0.120.1
|
| 65 |
+
fastapi-cli 0.0.14
|
| 66 |
+
fastapi-cloud-cli 0.3.1
|
| 67 |
+
fastrlock 0.8.3
|
| 68 |
+
filelock 3.20.0
|
| 69 |
+
flashinfer-python 0.4.1
|
| 70 |
+
frozenlist 1.8.0
|
| 71 |
+
fsspec 2025.9.0
|
| 72 |
+
gguf 0.17.1
|
| 73 |
+
h11 0.16.0
|
| 74 |
+
hf-xet 1.2.0
|
| 75 |
+
httpcore 1.0.9
|
| 76 |
+
httptools 0.7.1
|
| 77 |
+
httpx 0.28.1
|
| 78 |
+
huggingface-hub 0.36.0
|
| 79 |
+
idna 3.11
|
| 80 |
+
importlib_metadata 8.7.0
|
| 81 |
+
iniconfig 2.3.0
|
| 82 |
+
interegular 0.3.3
|
| 83 |
+
Jinja2 3.1.6
|
| 84 |
+
jiter 0.11.1
|
| 85 |
+
jsonschema 4.25.1
|
| 86 |
+
jsonschema-specifications 2025.9.1
|
| 87 |
+
lark 1.2.2
|
| 88 |
+
llguidance 0.7.30
|
| 89 |
+
llvmlite 0.44.0
|
| 90 |
+
lm-format-enforcer 0.11.3
|
| 91 |
+
loguru 0.7.3
|
| 92 |
+
markdown-it-py 4.0.0
|
| 93 |
+
MarkupSafe 3.0.3
|
| 94 |
+
mdurl 0.1.2
|
| 95 |
+
mistral_common 1.8.5
|
| 96 |
+
mpmath 1.3.0
|
| 97 |
+
msgpack 1.1.2
|
| 98 |
+
msgspec 0.19.0
|
| 99 |
+
multidict 6.7.0
|
| 100 |
+
networkx 3.5
|
| 101 |
+
ninja 1.13.0
|
| 102 |
+
numba 0.61.2
|
| 103 |
+
numpy 2.2.6
|
| 104 |
+
nvidia-cublas-cu12 12.8.4.1
|
| 105 |
+
nvidia-cuda-cupti-cu12 12.8.90
|
| 106 |
+
nvidia-cuda-nvrtc-cu12 12.8.93
|
| 107 |
+
nvidia-cuda-runtime-cu12 12.8.90
|
| 108 |
+
nvidia-cudnn-cu12 9.10.2.21
|
| 109 |
+
nvidia-cudnn-frontend 1.15.0
|
| 110 |
+
nvidia-cufft-cu12 11.3.3.83
|
| 111 |
+
nvidia-cufile-cu12 1.13.1.3
|
| 112 |
+
nvidia-curand-cu12 10.3.9.90
|
| 113 |
+
nvidia-cusolver-cu12 11.7.3.90
|
| 114 |
+
nvidia-cusparse-cu12 12.5.8.93
|
| 115 |
+
nvidia-cusparselt-cu12 0.7.1
|
| 116 |
+
nvidia-cutlass-dsl 4.3.0.dev0
|
| 117 |
+
nvidia-ml-py 13.580.82
|
| 118 |
+
nvidia-nccl-cu12 2.27.5
|
| 119 |
+
nvidia-nvjitlink-cu12 12.8.93
|
| 120 |
+
nvidia-nvshmem-cu12 3.3.20
|
| 121 |
+
nvidia-nvtx-cu12 12.8.90
|
| 122 |
+
openai 2.6.1
|
| 123 |
+
openai-harmony 0.0.4
|
| 124 |
+
opencv-python-headless 4.12.0.88
|
| 125 |
+
opentelemetry-api 1.38.0
|
| 126 |
+
opentelemetry-sdk 1.38.0
|
| 127 |
+
opentelemetry-semantic-conventions 0.59b0
|
| 128 |
+
outlines_core 0.2.11
|
| 129 |
+
packaging 25.0
|
| 130 |
+
partial-json-parser 0.2.1.1.post6
|
| 131 |
+
pillow 12.0.0
|
| 132 |
+
pip 25.3
|
| 133 |
+
pluggy 1.6.0
|
| 134 |
+
prometheus_client 0.23.1
|
| 135 |
+
prometheus-fastapi-instrumentator 7.1.0
|
| 136 |
+
propcache 0.4.1
|
| 137 |
+
protobuf 6.33.0
|
| 138 |
+
psutil 7.1.2
|
| 139 |
+
py-cpuinfo 9.0.0
|
| 140 |
+
pybase64 1.4.2
|
| 141 |
+
pycountry 24.6.1
|
| 142 |
+
pycparser 2.23
|
| 143 |
+
pydantic 2.12.3
|
| 144 |
+
pydantic_core 2.41.4
|
| 145 |
+
pydantic-extra-types 2.10.6
|
| 146 |
+
Pygments 2.19.2
|
| 147 |
+
pytest 8.4.2
|
| 148 |
+
python-dotenv 1.2.1
|
| 149 |
+
python-json-logger 4.0.0
|
| 150 |
+
python-multipart 0.0.20
|
| 151 |
+
PyYAML 6.0.3
|
| 152 |
+
pyzmq 27.1.0
|
| 153 |
+
ray 2.50.1
|
| 154 |
+
referencing 0.37.0
|
| 155 |
+
regex 2025.10.23
|
| 156 |
+
requests 2.32.5
|
| 157 |
+
rich 14.2.0
|
| 158 |
+
rich-toolkit 0.15.1
|
| 159 |
+
rignore 0.7.1
|
| 160 |
+
rpds-py 0.28.0
|
| 161 |
+
safetensors 0.6.2
|
| 162 |
+
scipy 1.16.2
|
| 163 |
+
sentencepiece 0.2.1
|
| 164 |
+
sentry-sdk 3.0.0a7
|
| 165 |
+
setproctitle 1.3.7
|
| 166 |
+
setuptools 79.0.1
|
| 167 |
+
shellingham 1.5.4
|
| 168 |
+
six 1.17.0
|
| 169 |
+
sniffio 1.3.1
|
| 170 |
+
soundfile 0.13.1
|
| 171 |
+
soxr 1.0.0
|
| 172 |
+
starlette 0.48.0
|
| 173 |
+
sympy 1.14.0
|
| 174 |
+
tabulate 0.9.0
|
| 175 |
+
tiktoken 0.12.0
|
| 176 |
+
tokenizers 0.22.1
|
| 177 |
+
torch 2.9.0
|
| 178 |
+
torchaudio 2.9.0
|
| 179 |
+
torchvision 0.24.0
|
| 180 |
+
tqdm 4.67.1
|
| 181 |
+
transformers 4.57.1
|
| 182 |
+
triton 3.5.0
|
| 183 |
+
triton_kernels 1.0.0
|
| 184 |
+
typer 0.20.0
|
| 185 |
+
typing_extensions 4.15.0
|
| 186 |
+
typing-inspection 0.4.2
|
| 187 |
+
urllib3 2.5.0
|
| 188 |
+
uv 0.9.5
|
| 189 |
+
uvicorn 0.38.0
|
| 190 |
+
uvloop 0.22.1
|
| 191 |
+
vllm 0.11.1rc4.dev38+g69f064062.cu129
|
| 192 |
+
watchfiles 1.1.1
|
| 193 |
+
websockets 15.0.1
|
| 194 |
+
xgrammar 0.1.25
|
| 195 |
+
yarl 1.22.0
|
| 196 |
+
zipp 3.23.0
|
| 197 |
+
```
|
| 198 |
+
|
| 199 |
+
</details>
|
| 200 |
+
|
| 201 |
+
### 【vLLM Startup Command】
|
| 202 |
+
<i>Note: When launching with TP=8, include `--enable-expert-parallel`;
|
| 203 |
+
otherwise the expert tensors wouldn’t be evenly sharded across GPU devices.</i>
|
| 204 |
+
|
| 205 |
+
```
|
| 206 |
+
CONTEXT_LENGTH=32768
|
| 207 |
+
vllm serve \
|
| 208 |
+
tclf90/MiniMax-M2-AWQ \
|
| 209 |
+
--served-model-name MY_MODEL \
|
| 210 |
+
--enable-auto-tool-choice \
|
| 211 |
+
--tool-call-parser minimax_m2 \
|
| 212 |
+
--reasoning-parser minimax_m2_append_think \
|
| 213 |
+
--swap-space 16 \
|
| 214 |
+
--max-num-seqs 32 \
|
| 215 |
+
--max-model-len $CONTEXT_LENGTH \
|
| 216 |
+
--gpu-memory-utilization 0.9 \
|
| 217 |
+
--tensor-parallel-size 8 \
|
| 218 |
+
--enable-expert-parallel \
|
| 219 |
+
--trust-remote-code \
|
| 220 |
+
--disable-log-requests \
|
| 221 |
+
--host 0.0.0.0 \
|
| 222 |
+
--port 8000
|
| 223 |
+
```
|
| 224 |
+
|
| 225 |
+
### 【Logs】
|
| 226 |
+
```
|
| 227 |
+
2025-11-03
|
| 228 |
+
1.Due to my oversight, I have now completed the missing files and fully validated them on a 2xA100 setup.
|
| 229 |
+
|
| 230 |
+
Upload model-00018-of-00041.safetensors
|
| 231 |
+
Upload model-00019-of-00041.safetensors
|
| 232 |
+
Upload model-00021-of-00041.safetensors
|
| 233 |
+
Upload model-00023-of-00041.safetensors
|
| 234 |
+
Upload model-00025-of-00041.safetensors
|
| 235 |
+
Upload model-00027-of-00041.safetensors
|
| 236 |
+
Upload model-00030-of-00041.safetensors
|
| 237 |
+
Upload model-00035-of-00041.safetensors
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
2025-10-28
|
| 241 |
+
1. Initial commit
|
| 242 |
+
```
|
| 243 |
+
|
| 244 |
+
### 【Model Files】
|
| 245 |
+
| File Size | Last Updated |
|
| 246 |
+
|-----------|--------------|
|
| 247 |
+
| `113GiB` | `2025-10-28` |
|
| 248 |
+
|
| 249 |
+
### 【Model Download】
|
| 250 |
+
```python
|
| 251 |
+
from huggingface_hub import snapshot_download
|
| 252 |
+
snapshot_download('QuantTrio/MiniMax-M2-AWQ', cache_dir="your_local_path")
|
| 253 |
+
```
|
| 254 |
+
|
| 255 |
+
### 【Overview】
|
| 256 |
+
<svg width="60%" height="auto" viewBox="0 0 144 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
| 257 |
+
<path d="M26.6782 7.96523C26.6782 7.02436 25.913 6.26087 24.9739 6.26087C24.0348 6.26087 23.2695 7.0261 23.2695 7.96523V36.2139C23.2695 38.4 21.4904 40.1791 19.3043 40.1791C17.1183 40.1791 15.3391 38.4 15.3391 36.2139V18.0904C15.3391 17.1496 14.5739 16.3861 13.6348 16.3861C12.6956 16.3861 11.9304 17.1513 11.9304 18.0904V25.7722C11.9304 27.9583 10.1513 29.7374 7.96518 29.7374C5.7791 29.7374 4 27.9583 4 25.7722V22.9878C4 22.3635 4.50609 21.8574 5.13043 21.8574C5.75478 21.8574 6.26087 22.3635 6.26087 22.9878V25.7722C6.26087 26.713 7.02605 27.4765 7.96518 27.4765C8.90431 27.4765 9.66954 26.7113 9.66954 25.7722V18.0904C9.66954 15.9044 11.4487 14.1252 13.6348 14.1252C15.8209 14.1252 17.6 15.9044 17.6 18.0904V36.2139C17.6 37.1548 18.3652 37.9183 19.3043 37.9183C20.2435 37.9183 21.0087 37.153 21.0087 36.2139V25.1322V7.96523C21.0087 5.77914 22.7878 4 24.9739 4C27.16 4 28.9391 5.77914 28.9391 7.96523V31.3565C28.9391 31.9809 28.433 32.487 27.8087 32.487C27.1843 32.487 26.6782 31.9809 26.6782 31.3565V7.96523ZM47.6539 14.1252C45.4678 14.1252 43.6887 15.9044 43.6887 18.0904V33.2296C43.6887 34.1704 42.9235 34.9339 41.9843 34.9339C41.0452 34.9339 40.28 34.1687 40.28 33.2296V7.96523C40.28 5.77914 38.5008 4 36.3148 4C34.1287 4 32.3496 5.77914 32.3496 7.96523V40.0348C32.3496 40.9756 31.5843 41.7391 30.6452 41.7391C29.7061 41.7391 28.9409 40.9739 28.9409 40.0348V36.0643C28.9409 35.44 28.4348 34.9339 27.8104 34.9339C27.1861 34.9339 26.68 35.44 26.68 36.0643V40.0348C26.68 42.2209 28.4591 44 30.6452 44C32.8313 44 34.6104 42.2209 34.6104 40.0348V7.96523C34.6104 7.02436 35.3756 6.26087 36.3148 6.26087C37.2539 6.26087 38.0191 7.0261 38.0191 7.96523V33.2296C38.0191 35.4156 39.7982 37.1948 41.9843 37.1948C44.1704 37.1948 45.9496 35.4156 45.9496 33.2296V18.0904C45.9496 17.1496 46.7148 16.3861 47.6539 16.3861C48.593 16.3861 49.3582 17.1513 49.3582 18.0904V31.3565C49.3582 31.9809 49.8643 32.487 50.4887 32.487C51.113 32.487 51.6191 31.9809 51.6191 31.3565V18.0904C51.6191 15.9044 49.84 14.1252 47.6539 14.1252Z" fill="url(#paint0_linear_17_483)"/>
|
| 258 |
+
<path d="M68.7671 16.5615H71.2541C71.3254 16.5615 71.3845 16.5859 71.435 16.6363C71.4836 16.6868 71.5097 16.7459 71.5097 16.8172V31.1824C71.5097 31.2537 71.4854 31.3128 71.435 31.3633C71.3845 31.4137 71.3254 31.4381 71.2541 31.4381H68.7671C68.6958 31.4381 68.6367 31.4137 68.5862 31.3633C68.5358 31.3146 68.5115 31.2537 68.5115 31.1824V21.812C68.5115 21.7563 68.4976 21.7268 68.4697 21.7268C68.4419 21.7268 68.4123 21.7476 68.3845 21.7911L66.1323 25.318C66.061 25.4311 65.9619 25.4885 65.8349 25.4885H64.581C64.4541 25.4885 64.3549 25.4328 64.2836 25.318L62.0315 21.7911C62.0036 21.7494 61.9741 21.7302 61.9462 21.7372C61.9184 21.7441 61.9045 21.7772 61.9045 21.8328V31.1824C61.9045 31.2537 61.8802 31.3128 61.8297 31.3633C61.7793 31.4137 61.7202 31.4381 61.6489 31.4381H59.1619C59.0906 31.4381 59.0315 31.4137 58.981 31.3633C58.9306 31.3146 58.9062 31.2537 58.9062 31.1824V16.8172C58.9062 16.7459 58.9306 16.6868 58.981 16.6363C59.0315 16.5859 59.0906 16.5615 59.1619 16.5615H61.6489C61.7758 16.5615 61.8749 16.6189 61.9462 16.732L65.1341 21.6833C65.1758 21.7685 65.2193 21.7685 65.261 21.6833L68.4697 16.732C68.541 16.6189 68.6402 16.5615 68.7671 16.5615Z" fill="currentColor"/>
|
| 259 |
+
<path d="M74.1764 31.3633C74.1259 31.3146 74.1016 31.2537 74.1016 31.1824V16.8172C74.1016 16.7459 74.1259 16.6868 74.1764 16.6363C74.2268 16.5859 74.2859 16.5615 74.3572 16.5615H76.8442C76.9155 16.5615 76.9746 16.5859 77.0251 16.6363C77.0737 16.6868 77.0998 16.7459 77.0998 16.8172V31.1824C77.0998 31.2537 77.0755 31.3128 77.0251 31.3633C76.9746 31.4137 76.9155 31.4381 76.8442 31.4381H74.3572C74.2859 31.4381 74.2268 31.4137 74.1764 31.3633Z" fill="currentColor"/>
|
| 260 |
+
<path d="M88.3066 16.6361C88.3553 16.5874 88.4162 16.5613 88.4875 16.5613H90.9744C91.0457 16.5613 91.1049 16.5857 91.1553 16.6361C91.204 16.6865 91.2301 16.7457 91.2301 16.817V31.1822C91.2301 31.2535 91.2057 31.3126 91.1553 31.363C91.1049 31.4135 91.0457 31.4378 90.9744 31.4378H88.5727C88.4301 31.4378 88.331 31.3822 88.2753 31.2674L82.771 22.1717C82.7431 22.13 82.7136 22.1109 82.6858 22.1178C82.6579 22.1248 82.644 22.1578 82.644 22.2135L82.6858 31.1805C82.6858 31.2518 82.6614 31.3109 82.611 31.3613C82.5606 31.4117 82.5014 31.4361 82.4301 31.4361H79.9431C79.8718 31.4361 79.8127 31.4117 79.7623 31.3613C79.7118 31.3126 79.6875 31.2518 79.6875 31.1805V16.8152C79.6875 16.7439 79.7118 16.6848 79.7623 16.6344C79.8127 16.5839 79.8718 16.5596 79.9431 16.5596H82.3449C82.4858 16.5596 82.5849 16.617 82.6423 16.73L88.124 25.7822C88.1518 25.8239 88.1797 25.8431 88.2092 25.8361C88.2371 25.8292 88.251 25.7978 88.251 25.7404L88.2301 16.8152C88.2301 16.7439 88.2545 16.6848 88.3049 16.6344L88.3066 16.6361Z" fill="currentColor"/>
|
| 261 |
+
<path d="M93.8951 31.3633C93.8446 31.3146 93.8203 31.2537 93.8203 31.1824V16.8172C93.8203 16.7459 93.8446 16.6868 93.8951 16.6363C93.9455 16.5859 94.0047 16.5615 94.076 16.5615H96.5629C96.6342 16.5615 96.6934 16.5859 96.7438 16.6363C96.7925 16.6868 96.8186 16.7459 96.8186 16.8172V31.1824C96.8186 31.2537 96.7942 31.3128 96.7438 31.3633C96.6934 31.4137 96.6342 31.4381 96.5629 31.4381H94.076C94.0047 31.4381 93.9455 31.4137 93.8951 31.3633Z" fill="currentColor"/>
|
| 262 |
+
<path d="M109.267 16.5615H111.754C111.825 16.5615 111.885 16.5859 111.935 16.6363C111.984 16.6868 112.01 16.7459 112.01 16.8172V31.1824C112.01 31.2537 111.985 31.3128 111.935 31.3633C111.885 31.4137 111.825 31.4381 111.754 31.4381H109.267C109.196 31.4381 109.137 31.4137 109.086 31.3633C109.036 31.3146 109.011 31.2537 109.011 31.1824V21.812C109.011 21.7563 108.998 21.7268 108.97 21.7268C108.942 21.7268 108.912 21.7476 108.885 21.7911L106.632 25.318C106.561 25.4311 106.462 25.4885 106.335 25.4885H105.081C104.954 25.4885 104.855 25.4328 104.784 25.318L102.531 21.7911C102.504 21.7494 102.474 21.7302 102.446 21.7372C102.418 21.7441 102.405 21.7772 102.405 21.8328V31.1824C102.405 31.2537 102.38 31.3128 102.33 31.3633C102.279 31.4137 102.22 31.4381 102.149 31.4381H99.6619C99.5906 31.4381 99.5315 31.4137 99.481 31.3633C99.4306 31.3146 99.4062 31.2537 99.4062 31.1824V16.8172C99.4062 16.7459 99.4306 16.6868 99.481 16.6363C99.5315 16.5859 99.5906 16.5615 99.6619 16.5615H102.149C102.276 16.5615 102.375 16.6189 102.446 16.732L105.634 21.6833C105.676 21.7685 105.719 21.7685 105.761 21.6833L108.97 16.732C109.041 16.6189 109.14 16.5615 109.267 16.5615Z" fill="currentColor"/>
|
| 263 |
+
<path d="M123.782 31.2241L123.144 29.1424C123.116 29.0867 123.079 29.0572 123.038 29.0572H117.81C117.768 29.0572 117.732 29.085 117.704 29.1424L117.088 31.2241C117.046 31.3668 116.954 31.4363 116.812 31.4363H114.112C114.027 31.4363 113.963 31.412 113.921 31.3615C113.879 31.3128 113.871 31.2381 113.9 31.1389L118.49 16.7737C118.532 16.6328 118.624 16.5615 118.766 16.5615H122.102C122.243 16.5615 122.335 16.6328 122.379 16.7737L126.968 31.1389C126.982 31.1668 126.989 31.2033 126.989 31.245C126.989 31.372 126.911 31.4363 126.756 31.4363H124.057C123.916 31.4363 123.824 31.365 123.78 31.2241H123.782ZM118.554 26.7407H122.295C122.38 26.7407 122.408 26.6989 122.38 26.6137L120.467 20.3024C120.453 20.2467 120.432 20.2207 120.403 20.2276C120.375 20.2346 120.352 20.2589 120.339 20.3024L118.469 26.6137C118.455 26.6989 118.483 26.7407 118.554 26.7407Z" fill="currentColor"/>
|
| 264 |
+
<path d="M128.222 31.353C128.18 31.2974 128.187 31.2261 128.243 31.1409L132.365 24.0643C132.393 24.0226 132.393 23.9791 132.365 23.9374L128.243 16.8609L128.201 16.7339C128.201 16.6209 128.28 16.5635 128.434 16.5635H131.133C131.274 16.5635 131.38 16.6209 131.452 16.7339L134.213 21.6C134.255 21.6852 134.299 21.6852 134.34 21.6L137.102 16.7339C137.173 16.6209 137.28 16.5635 137.42 16.5635H140.099C140.198 16.5635 140.269 16.5913 140.311 16.6487C140.353 16.7061 140.346 16.7756 140.29 16.8609L136.168 23.9374C136.154 23.9791 136.154 24.0226 136.168 24.0643L140.29 31.1409L140.332 31.2678C140.332 31.3809 140.253 31.4383 140.099 31.4383H137.42C137.278 31.4383 137.172 31.3826 137.102 31.2678L134.34 26.4226C134.299 26.3374 134.255 26.3374 134.213 26.4226L131.429 31.2678C131.358 31.3809 131.252 31.4383 131.111 31.4383H128.433C128.333 31.4383 128.262 31.4104 128.22 31.353H128.222Z" fill="currentColor"/>
|
| 265 |
+
<defs>
|
| 266 |
+
<linearGradient id="paint0_linear_17_483" x1="3.99826" y1="24" x2="51.6208" y2="24" gradientUnits="userSpaceOnUse">
|
| 267 |
+
<stop stop-color="#E21680"/>
|
| 268 |
+
<stop offset="1" stop-color="#FF633A"/>
|
| 269 |
+
</linearGradient>
|
| 270 |
+
</defs>
|
| 271 |
+
</svg>
|
| 272 |
+
|
| 273 |
+
</div>
|
| 274 |
+
<hr>
|
| 275 |
+
|
| 276 |
+
<div align="center" style="line-height: 1;">
|
| 277 |
+
<a href="https://www.minimax.io" target="_blank" style="margin: 2px;">
|
| 278 |
+
<img alt="Homepage" src="https://img.shields.io/badge/_Homepage-MiniMax-FF4040?style=flat-square&labelColor=2C3E50&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgNDkwLjE2IDQxMS43Ij48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2ZmZjt9PC9zdHlsZT48L2RlZnM+PHBhdGggY2xhc3M9ImNscy0xIiBkPSJNMjMzLjQ1LDQwLjgxYTE3LjU1LDE3LjU1LDAsMSwwLTM1LjEsMFYzMzEuNTZhNDAuODIsNDAuODIsMCwwLDEtODEuNjMsMFYxNDVhMTcuNTUsMTcuNTUsMCwxLDAtMzUuMDksMHY3OS4wNmE0MC44Miw0MC44MiwwLDAsMS04MS42MywwVjE5NS40MmExMS42MywxMS42MywwLDAsMSwyMy4yNiwwdjI4LjY2YTE3LjU1LDE3LjU1LDAsMCwwLDM1LjEsMFYxNDVBNDAuODIsNDAuODIsMCwwLDEsMTQwLDE0NVYzMzEuNTZhMTcuNTUsMTcuNTUsMCwwLDAsMzUuMSwwVjIxNy41aDBWNDAuODFhNDAuODEsNDAuODEsMCwxLDEsODEuNjIsMFYyODEuNTZhMTEuNjMsMTEuNjMsMCwxLDEtMjMuMjYsMFptMjE1LjksNjMuNEE0MC44Niw0MC44NiwwLDAsMCw0MDguNTMsMTQ1VjMwMC44NWExNy41NSwxNy41NSwwLDAsMS0zNS4wOSwwdi0yNjBhNDAuODIsNDAuODIsMCwwLDAtODEuNjMsMFYzNzAuODlhMTcuNTUsMTcuNTUsMCwwLDEtMzUuMSwwVjMzMGExMS42MywxMS42MywwLDEsMC0yMy4yNiwwdjQwLjg2YTQwLjgxLDQwLjgxLDAsMCwwLDgxLjYyLDBWNDAuODFhMTcuNTUsMTcuNTUsMCwwLDEsMzUuMSwwdjI2MGE0MC44Miw0MC44MiwwLDAsMCw4MS42MywwVjE0NWExNy41NSwxNy41NSwwLDEsMSwzNS4xLDBWMjgxLjU2YTExLjYzLDExLjYzLDAsMCwwLDIzLjI2LDBWMTQ1QTQwLjg1LDQwLjg1LDAsMCwwLDQ0OS4zNSwxMDQuMjFaIi8+PC9zdmc+&logoWidth=20" style="display: inline-block; vertical-align: middle;"/>
|
| 279 |
+
</a>
|
| 280 |
+
<a href="https://agent.minimax.io/" target="_blank" style="margin: 2px;">
|
| 281 |
+
<img alt="Agent" src="https://img.shields.io/badge/_MiniMax_Agent-FF4040?style=flat-square&labelColor=2C3E50&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgNDkwLjE2IDQxMS43Ij48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2ZmZjt9PC9zdHlsZT48L2RlZnM+PHBhdGggY2xhc3M9ImNscy0xIiBkPSJNMjMzLjQ1LDQwLjgxYTE3LjU1LDE3LjU1LDAsMSwwLTM1LjEsMFYzMzEuNTZhNDAuODIsNDAuODIsMCwwLDEtODEuNjMsMFYxNDVhMTcuNTUsMTcuNTUsMCwxLDAtMzUuMDksMHY3OS4wNmE0MC44Miw0MC44MiwwLDAsMS04MS42MywwVjE5NS40MmExMS42MywxMS42MywwLDAsMSwyMy4yNiwwdjI4LjY2YTE3LjU1LDE3LjU1LDAsMCwwLDM1LjEsMFYxNDVBNDAuODIsNDAuODIsMCwwLDEsMTQwLDE0NVYzMzEuNTZhMTcuNTUsMTcuNTUsMCwwLDAsMzUuMSwwVjIxNy41aDBWNDAuODFhNDAuODEsNDAuODEsMCwxLDEsODEuNjIsMFYyODEuNTZhMTEuNjMsMTEuNjMsMCwxLDEtMjMuMjYsMFptMjE1LjksNjMuNEE0MC44Niw0MC44NiwwLDAsMCw0MDguNTMsMTQ1VjMwMC44NWExNy41NSwxNy41NSwwLDAsMS0zNS4wOSwwdi0yNjBhNDAuODIsNDAuODIsMCwwLDAtODEuNjMsMFYzNzAuODlhMTcuNTUsMTcuNTUsMCwwLDEtMzUuMSwwVjMzMGExMS42MywxMS42MywwLDEsMC0yMy4yNiwwdjQwLjg2YTQwLjgxLDQwLjgxLDAsMCwwLDgxLjYyLDBWNDAuODFhMTcuNTUsMTcuNTUsMCwwLDEsMzUuMSwwdjI2MGE0MC44Miw0MC44MiwwLDAsMCw4MS42MywwVjE0NWExNy41NSwxNy41NSwwLDEsMSwzNS4xLDBWMjgxLjU2YTExLjYzLDExLjYzLDAsMCwwLDIzLjI2LDBWMTQ1QTQwLjg1LDQwLjg1LDAsMCwwLDQ0OS4zNSwxMDQuMjFaIi8+PC9zdmc+&logoWidth=20" style="display: inline-block; vertical-align: middle;"/>
|
| 282 |
+
</a>
|
| 283 |
+
<a href="https://www.minimax.io/platform" style="margin: 2px;">
|
| 284 |
+
<img alt="API" src="https://img.shields.io/badge/⚡_API-Platform-FF4040?style=flat-square&labelColor=2C3E50" style="display: inline-block; vertical-align: middle;"/>
|
| 285 |
+
</a>
|
| 286 |
+
<a href="https://github.com/MiniMax-AI/MiniMax-MCP" style="margin: 2px;">
|
| 287 |
+
<img alt="MCP" src="https://img.shields.io/badge/🚀_MCP-MiniMax_MCP-FF4040?style=flat-square&labelColor=2C3E50" style="display: inline-block; vertical-align: middle;"/>
|
| 288 |
+
</a>
|
| 289 |
+
</div>
|
| 290 |
+
<div align="center" style="line-height: 1;">
|
| 291 |
+
<a href="https://huggingface.co/MiniMaxAI" target="_blank" style="margin: 2px;">
|
| 292 |
+
<img alt="Hugging Face" src="https://img.shields.io/badge/🤗_Hugging_Face-MiniMax-FF4040?style=flat-square&labelColor=2C3E50" style="display: inline-block; vertical-align: middle;"/>
|
| 293 |
+
</a>
|
| 294 |
+
<a href="https://github.com/MiniMax-AI/MiniMax-M2" target="_blank" style="margin: 2px;">
|
| 295 |
+
<img alt="GitHub" src="https://img.shields.io/badge/🐙_GitHub-MiniMax-FF4040?style=flat-square&labelColor=2C3E50" style="display: inline-block; vertical-align: middle;"/>
|
| 296 |
+
</a>
|
| 297 |
+
<a href="https://www.modelscope.cn/organization/MiniMax" target="_blank" style="margin: 2px;">
|
| 298 |
+
<img alt="ModelScope" src="https://img.shields.io/badge/🤖️_ModelScope-MiniMax-FF4040?style=flat-square&labelColor=2C3E50" style="display: inline-block; vertical-align: middle;"/>
|
| 299 |
+
</a>
|
| 300 |
+
<a href="https://github.com/MiniMax-AI/MiniMax-M2/blob/main/LICENSE" style="margin: 2px;">
|
| 301 |
+
<img alt="License" src="https://img.shields.io/badge/⚖️_License-MIT-FF4040?style=flat-square&labelColor=2C3E50" style="display: inline-block; vertical-align: middle;"/>
|
| 302 |
+
</a>
|
| 303 |
+
<a href="https://github.com/MiniMax-AI/MiniMax-AI.github.io/blob/main/images/wechat-qrcode.jpeg" target="_blank" style="margin: 2px;">
|
| 304 |
+
<img alt="WeChat" src="https://img.shields.io/badge/💬_WeChat-MiniMax-FF4040?style=flat-square&labelColor=2C3E50" style="display: inline-block; vertical-align: middle;"/>
|
| 305 |
+
</a>
|
| 306 |
+
</div>
|
| 307 |
+
|
| 308 |
+
# Meet MiniMax-M2
|
| 309 |
+
|
| 310 |
+
Today, we release and open source MiniMax-M2, a **Mini** model built for **Max** coding & agentic workflows.
|
| 311 |
+
|
| 312 |
+
**MiniMax-M2** redefines efficiency for agents. It's a compact, fast, and cost-effective MoE model (230 billion total parameters with 10 billion active parameters) built for elite performance in coding and agentic tasks, all while maintaining powerful general intelligence. With just 10 billion activated parameters, MiniMax-M2 provides the sophisticated, end-to-end tool use performance expected from today's leading models, but in a streamlined form factor that makes deployment and scaling easier than ever.
|
| 313 |
+
|
| 314 |
+
<p align="center">
|
| 315 |
+
<img width="100%" src="figures/Bench.png">
|
| 316 |
+
</p>
|
| 317 |
+
|
| 318 |
+
---
|
| 319 |
+
|
| 320 |
+
## Highlights
|
| 321 |
+
|
| 322 |
+
**Superior Intelligence**. According to benchmarks from Artificial Analysis, MiniMax-M2 demonstrates highly competitive general intelligence across mathematics, science, instruction following, coding, and agentic tool use. **Its composite score ranks #1 among open-source models globally**.
|
| 323 |
+
|
| 324 |
+
**Advanced Coding**. Engineered for end-to-end developer workflows, MiniMax-M2 excels at multi-file edits, coding-run-fix loops, and test-validated repairs. Strong performance on Terminal-Bench and (Multi-)SWE-Bench–style tasks demonstrates practical effectiveness in terminals, IDEs, and CI across languages.
|
| 325 |
+
|
| 326 |
+
**Agent Performance**. MiniMax-M2 plans and executes complex, long-horizon toolchains across shell, browser, retrieval, and code runners. In BrowseComp-style evaluations, it consistently locates hard-to-surface sources, maintains evidence traceable, and gracefully recovers from flaky steps.
|
| 327 |
+
|
| 328 |
+
**Efficient Design**. With 10 billion activated parameters (230 billion in total), MiniMax-M2 delivers lower latency, lower cost, and higher throughput for interactive agents and batched sampling—perfectly aligned with the shift toward highly deployable models that still shine on coding and agentic tasks.
|
| 329 |
+
|
| 330 |
+
---
|
| 331 |
+
|
| 332 |
+
## Coding & Agentic Benchmarks
|
| 333 |
+
|
| 334 |
+
These comprehensive evaluations test real-world end-to-end coding and agentic tool use: editing real repos, executing commands, browsing the web, and delivering functional solutions. Performance on this suite correlates with day-to-day developer experience in terminals, IDEs, and CI.
|
| 335 |
+
|
| 336 |
+
| **Benchmark** | **MiniMax-M2** | **Claude Sonnet 4** | **Claude Sonnet 4.5** | **Gemini 2.5 Pro** | **GPT-5 (thinking)** | **GLM-4.6** | **Kimi K2 0905** | **DeepSeek-V3.2** |
|
| 337 |
+
|-----------|------------|-----------------|-------------------|-----------------|------------------|---------|---------------|----------------|
|
| 338 |
+
| **SWE-bench Verified** | 69.4 | 72.7 * | 77.2 * | 63.8 * | 74.9 * | 68 * | 69.2 * | 67.8 * |
|
| 339 |
+
| **Multi-SWE-Bench** | 36.2 | 35.7 * | 44.3 | / | / | 30 | 33.5 | 30.6 |
|
| 340 |
+
| **SWE-bench Multilingual** | 56.5 | 56.9 * | 68 | / | / | 53.8 | 55.9 * | 57.9 * |
|
| 341 |
+
| **Terminal-Bench** | 46.3 | 36.4 * | 50 * | 25.3 * | 43.8 * | 40.5 * | 44.5 * | 37.7 * |
|
| 342 |
+
| **ArtifactsBench** | 66.8 | 57.3* | 61.5 | 57.7* | 73* | 59.8 | 54.2 | 55.8 |
|
| 343 |
+
| **BrowseComp** | 44 | 12.2 | 19.6 | 9.9 | 54.9* | 45.1* | 14.1 | 40.1* |
|
| 344 |
+
| **BrowseComp-zh** | 48.5 | 29.1 | 40.8 | 32.2 | 65 | 49.5 | 28.8 | 47.9* |
|
| 345 |
+
| **GAIA (text only)** | 75.7 | 68.3 | 71.2 | 60.2 | 76.4 | 71.9 | 60.2 | 63.5 |
|
| 346 |
+
| **xbench-DeepSearch** | 72 | 64.6 | 66 | 56 | 77.8 | 70 | 61 | 71 |
|
| 347 |
+
| **HLE (w/ tools)** | 31.8 | 20.3 | 24.5 | 28.4 * | 35.2 * | 30.4 * | 26.9 * | 27.2 * |
|
| 348 |
+
| **τ²-Bench** | 77.2 | 65.5* | 84.7* | 59.2 | 80.1* | 75.9* | 70.3 | 66.7 |
|
| 349 |
+
| **FinSearchComp-global** | 65.5 | 42 | 60.8 | 42.6* | 63.9* | 29.2 | 29.5* | 26.2 |
|
| 350 |
+
| **AgentCompany** | 36 | 37 | 41 | 39.3* | / | 35 | 30 | 34 |
|
| 351 |
+
|
| 352 |
+
>Notes: Data points marked with an asterisk (*) are taken directly from the model's official tech report or blog. All other metrics were obtained using the evaluation methods described below.
|
| 353 |
+
>- SWE-bench Verified: We use the same scaffold as [R2E-Gym](https://arxiv.org/pdf/2504.07164) (Jain et al. 2025) on top of OpenHands to test with agents on SWE tasks. All scores are validated on our internal infrastructure with 128k context length, 100 max steps, and no test-time scaling. All git-related content is removed to ensure agent sees only the code at the issue point.
|
| 354 |
+
>- Multi-SWE-Bench & SWE-bench Multilingual: All scores are averaged across 8 runs using the [claude-code](https://github.com/anthropics/claude-code) CLI (300 max steps) as the evaluation scaffold.
|
| 355 |
+
>- Terminal-Bench: All scores are evaluated with the official claude-code from the original [Terminal-Bench](https://www.tbench.ai/) repository(commit `94bf692`), averaged over 8 runs to report the mean pass rate.
|
| 356 |
+
>- ArtifactsBench: All Scores are computed by averaging three runs with the official implementation of [ArtifactsBench](https://github.com/Tencent-Hunyuan/ArtifactsBenchmark), using the stable Gemini-2.5-Pro as the judge model.
|
| 357 |
+
>- BrowseComp & BrowseComp-zh & GAIA (text only) & xbench-DeepSearch: All scores reported use the same agent framework as [WebExplorer](https://arxiv.org/pdf/2509.06501) (Liu et al. 2025), with minor tools description adjustment. We use the 103-sample text-only GAIA validation subset following [WebExplorer](https://arxiv.org/pdf/2509.06501) (Liu et al. 2025).
|
| 358 |
+
>- HLE (w/ tools): All reported scores are obtained using search tools and a Python tool. The search tools employ the same agent framework as [WebExplorer](https://arxiv.org/pdf/2509.06501) (Liu et al. 2025), and the Python tool runs in a Jupyter environment. We use the text-only HLE subset.
|
| 359 |
+
>- τ²-Bench: All scores reported use "extended thinking with tool use", and employ GPT-4.1 as the user simulator.
|
| 360 |
+
>- FinSearchComp-global: Official results are reported for GPT-5-Thinking, Gemini 2.5 Pro, and Kimi-K2. Other models are evaluated using the open-source [FinSearchComp](https://arxiv.org/pdf/2509.13160) (Hu et al. 2025) framework using both search and Python tools, launched simultaneously for consistency.
|
| 361 |
+
>- AgentCompany: All scores reported use OpenHands 0.42 agent framework.
|
| 362 |
+
|
| 363 |
+
---
|
| 364 |
+
|
| 365 |
+
## Intelligence Benchmarks
|
| 366 |
+
|
| 367 |
+
We align with **Artificial Analysis**, which aggregates challenging benchmarks using a consistent methodology to reflect a model’s broader **intelligence profile** across math, science, instruction following, coding, and agentic tool use.
|
| 368 |
+
|
| 369 |
+
| **Metric (AA)** | **MiniMax-M2** | **Claude Sonnet 4** | **Claude Sonnet 4.5** | **Gemini 2.5 Pro** | **GPT-5 (thinking)** | **GLM-4.6** | **Kimi K2 0905** | **DeepSeek-V3.2** |
|
| 370 |
+
|-----------------|----------------|---------------------|------------------------|---------------------|----------------------|-------------|------------------|-------------------|
|
| 371 |
+
| AIME25 | 78 | 74 | 88 | 88 | 94 | 86 | 57 | 88 |
|
| 372 |
+
| MMLU-Pro | 82 | 84 | 88 | 86 | 87 | 83 | 82 | 85 |
|
| 373 |
+
| GPQA-Diamond | 78 | 78 | 83 | 84 | 85 | 78 | 77 | 80 |
|
| 374 |
+
| HLE (w/o tools) | 12.5 | 9.6 | 17.3 | 21.1 | 26.5 | 13.3 | 6.3 | 13.8 |
|
| 375 |
+
| LiveCodeBench (LCB) | 83 | 66 | 71 | 80 | 85 | 70 | 61 | 79 |
|
| 376 |
+
| SciCode | 36 | 40 | 45 | 43 | 43 | 38 | 31 | 38 |
|
| 377 |
+
| IFBench | 72 | 55 | 57 | 49 | 73 | 43 | 42 | 54 |
|
| 378 |
+
| AA-LCR | 61 | 65 | 66 | 66 | 76 | 54 | 52 | 69 |
|
| 379 |
+
| τ²-Bench-Telecom | 87 | 65 | 78 | 54 | 85 | 71 | 73 | 34 |
|
| 380 |
+
| Terminal-Bench-Hard | 24 | 30 | 33 | 25 | 31 | 23 | 23 | 29 |
|
| 381 |
+
| **AA Intelligence** | 61 | 57 | 63 | 60 | 69 | 56 | 50 | 57 |
|
| 382 |
+
|
| 383 |
+
>AA: All scores of MiniMax-M2 aligned with Artificial Analysis Intelligence Benchmarking Methodology (https://artificialanalysis.ai/methodology/intelligence-benchmarking). All scores of other models reported from https://artificialanalysis.ai/.
|
| 384 |
+
|
| 385 |
+
---
|
| 386 |
+
|
| 387 |
+
## Why activation size matters
|
| 388 |
+
|
| 389 |
+
By maintaining activations around **10B** , the plan → act → verify loop in the agentic workflow is streamlined, improving responsiveness and reducing compute overhead:
|
| 390 |
+
|
| 391 |
+
- **Faster feedback cycles** in compile-run-test and browse-retrieve-cite chains.
|
| 392 |
+
|
| 393 |
+
- **More concurrent runs** on the same budget for regression suites and multi-seed explorations.
|
| 394 |
+
|
| 395 |
+
- **Simpler capacity planning** with smaller per-request memory and steadier tail latency.
|
| 396 |
+
|
| 397 |
+
In short: **10B activations = responsive agent loops + better unit economics**.
|
| 398 |
+
|
| 399 |
+
## At a glance
|
| 400 |
+
|
| 401 |
+
If you need frontier-style coding and agents without frontier-scale costs, **MiniMax-M2** hits the sweet spot: fast inference speeds, robust tool-use capabilities, and a deployment-friendly footprint.
|
| 402 |
+
|
| 403 |
+
We look forward to your feedback and to collaborating with developers and researchers to bring the future of intelligent collaboration one step closer.
|
| 404 |
+
|
| 405 |
+
## How to Use
|
| 406 |
+
|
| 407 |
+
- Our product **MiniMax Agent**, built on MiniMax-M2, is now **publicly available and free** for a limited time: https://agent.minimaxi.io/
|
| 408 |
+
|
| 409 |
+
- The MiniMax-M2 API is now live on the **MiniMax Open Platform** and is **free** for a limited time: https://platform.minimax.io/docs/guides/text-generation
|
| 410 |
+
|
| 411 |
+
- The MiniMax-M2 model weights are now **open-source**, allowing for local deployment and use: https://huggingface.co/MiniMaxAI/MiniMax-M2.
|
| 412 |
+
|
| 413 |
+
## Local Deployment Guide
|
| 414 |
+
|
| 415 |
+
Download the model from HuggingFace repository: https://huggingface.co/MiniMaxAI/MiniMax-M2. We recommend using the following inference frameworks (listed alphabetically) to serve the model:
|
| 416 |
+
|
| 417 |
+
### SGLang
|
| 418 |
+
|
| 419 |
+
We recommend using [SGLang](https://docs.sglang.ai/) to serve MiniMax-M2. SGLang provides solid day-0 support for MiniMax-M2 model. Please refer to our [SGLang Deployment Guide](https://huggingface.co/MiniMaxAI/MiniMax-M2/blob/main/docs/sglang_deploy_guide.md) for more details, and thanks so much for our collaboration with the SGLang team.
|
| 420 |
+
|
| 421 |
+
### vLLM
|
| 422 |
+
|
| 423 |
+
We recommend using [vLLM](https://docs.vllm.ai/en/stable/) to serve MiniMax-M2. vLLM provides efficient day-0 support of MiniMax-M2 model, check https://docs.vllm.ai/projects/recipes/en/latest/MiniMaxAI/MiniMax-M2.html for latest deployment guide. We also provide our [vLLM Deployment Guide](https://huggingface.co/MiniMaxAI/MiniMax-M2/blob/main/docs/vllm_deploy_guide.md).
|
| 424 |
+
|
| 425 |
+
### Inference Parameters
|
| 426 |
+
We recommend using the following parameters for best performance: `temperature=1.0`, `top_p = 0.95`, `top_k = 40`.
|
| 427 |
+
|
| 428 |
+
**IMPORTANT:** MiniMax-M2 is an interleaved thinking model. Therefore, when using it, it is important to retain the thinking content from the assistant's turns within the historical messages. In the model's output content, we use the `<think>...</think>` format to wrap the assistant's thinking content. When using the model, you must ensure that the historical content is passed back in its original format. Do not remove the `<think>...</think>` part, otherwise, the model's performance will be negatively affected.
|
| 429 |
+
|
| 430 |
+
## Tool Calling Guide
|
| 431 |
+
|
| 432 |
+
Please refer to our [Tool Calling Guide](https://huggingface.co/MiniMaxAI/MiniMax-M2/blob/main/docs/tool_calling_guide.md).
|
| 433 |
+
|
| 434 |
+
# Contact Us
|
| 435 |
+
|
| 436 |
+
Contact us at [model@minimax.io](mailto:model@minimax.io).
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{# ----------‑‑‑ special token variables ‑‑‑---------- #}
|
| 2 |
+
{%- set toolcall_begin_token = '<minimax:tool_call>' -%}
|
| 3 |
+
{%- set toolcall_end_token = '</minimax:tool_call>' -%}
|
| 4 |
+
{#- Tool Rendering Functions ============================================== -#}
|
| 5 |
+
{%- macro render_tool_namespace(namespace_name, tool_list) -%}
|
| 6 |
+
{%- for tool in tool_list -%}
|
| 7 |
+
<tool>{{ tool.function | tojson(ensure_ascii=False) }}</tool>
|
| 8 |
+
{% endfor -%}
|
| 9 |
+
{%- endmacro -%}
|
| 10 |
+
{%- macro visible_text(content) -%}
|
| 11 |
+
{%- if content is string -%}
|
| 12 |
+
{{ content }}
|
| 13 |
+
{%- elif content is iterable and content is not mapping -%}
|
| 14 |
+
{%- for item in content -%}
|
| 15 |
+
{%- if item is mapping and item.type == 'text' -%}
|
| 16 |
+
{{- item.text }}
|
| 17 |
+
{%- elif item is string -%}
|
| 18 |
+
{{- item }}
|
| 19 |
+
{%- endif -%}
|
| 20 |
+
{%- endfor -%}
|
| 21 |
+
{%- else -%}
|
| 22 |
+
{{- content }}
|
| 23 |
+
{%- endif -%}
|
| 24 |
+
{%- endmacro -%}
|
| 25 |
+
{#- System Message Construction ============================================ -#}
|
| 26 |
+
{%- macro build_system_message(system_message) -%}
|
| 27 |
+
{%- if system_message and system_message.content -%}
|
| 28 |
+
{{- visible_text(system_message.content) }}
|
| 29 |
+
{%- else -%}
|
| 30 |
+
{%- if model_identity is not defined -%}
|
| 31 |
+
{%- set model_identity = "You are a helpful assistant." -%}
|
| 32 |
+
{%- endif -%}
|
| 33 |
+
{{- model_identity }}
|
| 34 |
+
{%- endif -%}
|
| 35 |
+
|
| 36 |
+
{#- Handle current_date -#}
|
| 37 |
+
{%- if system_message and system_message.current_date -%}
|
| 38 |
+
{{- '\n' ~ 'Current date: ' + system_message.current_date }}
|
| 39 |
+
{%- endif -%}
|
| 40 |
+
{#- Handle current_location -#}
|
| 41 |
+
{%- if system_message and system_message.current_location -%}
|
| 42 |
+
{{- '\n' ~ 'Current location: ' + system_message.current_location }}
|
| 43 |
+
{%- endif -%}
|
| 44 |
+
{%- endmacro -%}
|
| 45 |
+
{#- Main Template Logic ================================================= -#}
|
| 46 |
+
{#- Extract system message (only first message if it's system) -#}
|
| 47 |
+
{%- set system_message = none -%}
|
| 48 |
+
{%- set conversation_messages = messages -%}
|
| 49 |
+
{%- if messages and messages[0].role == "system" -%}
|
| 50 |
+
{%- set system_message = messages[0] -%}
|
| 51 |
+
{%- set conversation_messages = messages[1:] -%}
|
| 52 |
+
{%- endif -%}
|
| 53 |
+
{#- Get the last user message turn, for interleved thinking -#}
|
| 54 |
+
{%- set ns = namespace(last_user_index=-1) %}
|
| 55 |
+
{% for m in conversation_messages %}
|
| 56 |
+
{%- if m.role == 'user' %}
|
| 57 |
+
{% set ns.last_user_index = loop.index0 -%}
|
| 58 |
+
{%- endif %}
|
| 59 |
+
{%- endfor %}
|
| 60 |
+
{#- Render system message -#}
|
| 61 |
+
{{- ']~!b[' ~ ']~b]system' ~ '\n' }}
|
| 62 |
+
{{- build_system_message(system_message) }}
|
| 63 |
+
{#- Render tools if available -#}
|
| 64 |
+
{%- if tools -%}
|
| 65 |
+
{{- '\n\n' ~ '# Tools' ~ '\n' ~ 'You may call one or more tools to assist with the user query.\nHere are the tools available in JSONSchema format:' ~ '\n' }}
|
| 66 |
+
{{- '\n' ~ '<tools>' ~ '\n' }}
|
| 67 |
+
{{- render_tool_namespace("functions", tools) }}
|
| 68 |
+
{{- '</tools>' ~ '\n\n' }}
|
| 69 |
+
{{- 'When making tool calls, use XML format to invoke tools and pass parameters:' ~ '\n' }}
|
| 70 |
+
{{- '\n' ~ toolcall_begin_token }}
|
| 71 |
+
<invoke name="tool-name-1">
|
| 72 |
+
<parameter name="param-key-1">param-value-1</parameter>
|
| 73 |
+
<parameter name="param-key-2">param-value-2</parameter>
|
| 74 |
+
...
|
| 75 |
+
</invoke>
|
| 76 |
+
{{- '\n' ~ toolcall_end_token }}
|
| 77 |
+
{%- endif -%}
|
| 78 |
+
{{- '[e~[\n' }}
|
| 79 |
+
|
| 80 |
+
{#- Render messages -#}
|
| 81 |
+
{%- set last_tool_call = namespace(name=none) -%}
|
| 82 |
+
{%- for message in conversation_messages -%}
|
| 83 |
+
{%- if message.role == 'assistant' -%}
|
| 84 |
+
{#- Only render reasoning_content if no user message follows -#}
|
| 85 |
+
{{- ']~b]ai' ~ '\n' }}
|
| 86 |
+
|
| 87 |
+
{%- set reasoning_content = '' %}
|
| 88 |
+
{%- set content = visible_text(message.content) %}
|
| 89 |
+
{%- if message.reasoning_content is string %}
|
| 90 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 91 |
+
{%- else %}
|
| 92 |
+
{%- if '</think>' in content %}
|
| 93 |
+
{%- set reasoning_content = content.split('</think>')[0].strip('\n').split('<think>')[-1].strip('\n') %}
|
| 94 |
+
{%- set content = content.split('</think>')[-1].strip('\n') %}
|
| 95 |
+
{%- endif %}
|
| 96 |
+
{%- endif %}
|
| 97 |
+
{%- if reasoning_content and loop.index0 > ns.last_user_index -%}
|
| 98 |
+
{{- '<think>' ~ '\n' ~ reasoning_content ~ '\n' ~ '</think>' ~ '\n\n' }}
|
| 99 |
+
{%- endif -%}
|
| 100 |
+
{%- if content -%}
|
| 101 |
+
{{- content }}
|
| 102 |
+
{%- endif -%}
|
| 103 |
+
{%- if message.tool_calls -%}
|
| 104 |
+
{{- '\n' ~ toolcall_begin_token ~ '\n' }}
|
| 105 |
+
|
| 106 |
+
{%- for tool_call in message.tool_calls -%}
|
| 107 |
+
{%- if tool_call.function %}
|
| 108 |
+
{%- set tool_call = tool_call.function %}
|
| 109 |
+
{%- endif %}
|
| 110 |
+
{{- '<invoke name="' + tool_call.name + '">' }}
|
| 111 |
+
{% set _args = tool_call.arguments %}
|
| 112 |
+
{%- for k, v in _args.items() %}
|
| 113 |
+
{{- '<parameter name="' + k + '">' }}
|
| 114 |
+
{{- v | tojson(ensure_ascii=False) if v is not string else v }}
|
| 115 |
+
{{- '</parameter>' }}
|
| 116 |
+
{% endfor %}
|
| 117 |
+
{{- '</invoke>' ~ '\n' }}
|
| 118 |
+
{%- endfor -%}
|
| 119 |
+
|
| 120 |
+
{{- toolcall_end_token}}
|
| 121 |
+
{%- set last_tool_call.name = message.tool_calls[-1].name -%}
|
| 122 |
+
{%- else -%}
|
| 123 |
+
{%- set last_tool_call.name = none -%}
|
| 124 |
+
{%- endif -%}
|
| 125 |
+
{{- '[e~[' ~ '\n' }}
|
| 126 |
+
|
| 127 |
+
{%- elif message.role == 'tool' -%}
|
| 128 |
+
{%- if last_tool_call.name is none -%}
|
| 129 |
+
{{- raise_exception("Message has tool role, but there was no previous assistant message with a tool call!") }}
|
| 130 |
+
{%- endif -%}
|
| 131 |
+
{%- if loop.first or (conversation_messages[loop.index0 - 1].role != 'tool') -%}
|
| 132 |
+
{{- ']~b]tool' }}
|
| 133 |
+
{%- endif -%}
|
| 134 |
+
{%- if message.content is string -%}
|
| 135 |
+
{{- '\n<response>' }}
|
| 136 |
+
{{- message.content }}
|
| 137 |
+
{{- '</response>' }}
|
| 138 |
+
{%- else -%}
|
| 139 |
+
{%- for tr in message.content -%}
|
| 140 |
+
{{- '\n<response>' }}
|
| 141 |
+
{{- tr.output if tr.output is defined else (tr.text if tr.type == 'text' and tr.text is defined else tr) }}
|
| 142 |
+
{{- '\n</response>' }}
|
| 143 |
+
{%- endfor -%}
|
| 144 |
+
{%- endif -%}
|
| 145 |
+
{%- if loop.last or (conversation_messages[loop.index0 + 1].role != 'tool') -%}
|
| 146 |
+
{{- '[e~[\n' -}}
|
| 147 |
+
{%- endif -%}
|
| 148 |
+
|
| 149 |
+
{%- elif message.role == 'user' -%}
|
| 150 |
+
{{- ']~b]user' ~ '\n' }}
|
| 151 |
+
{{- visible_text(message.content) }}
|
| 152 |
+
{{- '[e~[' ~ '\n' }}
|
| 153 |
+
{%- endif -%}
|
| 154 |
+
{%- endfor -%}
|
| 155 |
+
|
| 156 |
+
{#- Generation prompt -#}
|
| 157 |
+
{%- if add_generation_prompt -%}
|
| 158 |
+
{{- ']~b]ai' ~ '\n' ~ '<think>' ~ '\n' }}
|
| 159 |
+
{%- endif -%}
|
config.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:08f4c0913799dbe6ef8999dd694633c5b6a11b66a3714dc3aa9f8ae1a3d8f5eb
|
| 3 |
+
size 1832
|
configuration.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f888421726665e8a84b738eed42a64875aed79de8be7daade851ac8bf4c0cef9
|
| 3 |
+
size 73
|
docs/function_call_guide.md
ADDED
|
@@ -0,0 +1,482 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MiniMax-M2 Function Call Guide
|
| 2 |
+
|
| 3 |
+
## Introduction
|
| 4 |
+
|
| 5 |
+
The MiniMax-M2 model supports function calling capabilities, enabling the model to identify when external functions need to be called and output function call parameters in a structured format. This document provides detailed instructions on how to use the function calling features of MiniMax-M2.
|
| 6 |
+
|
| 7 |
+
## Basic Example
|
| 8 |
+
|
| 9 |
+
The following Python script implements a weather query function call example based on the OpenAI SDK:
|
| 10 |
+
|
| 11 |
+
```python
|
| 12 |
+
from openai import OpenAI
|
| 13 |
+
import json
|
| 14 |
+
|
| 15 |
+
client = OpenAI(base_url="http://localhost:8000/v1", api_key="dummy")
|
| 16 |
+
|
| 17 |
+
def get_weather(location: str, unit: str):
|
| 18 |
+
return f"Getting the weather for {location} in {unit}..."
|
| 19 |
+
|
| 20 |
+
tool_functions = {"get_weather": get_weather}
|
| 21 |
+
|
| 22 |
+
tools = [{
|
| 23 |
+
"type": "function",
|
| 24 |
+
"function": {
|
| 25 |
+
"name": "get_weather",
|
| 26 |
+
"description": "Get the current weather in a given location",
|
| 27 |
+
"parameters": {
|
| 28 |
+
"type": "object",
|
| 29 |
+
"properties": {
|
| 30 |
+
"location": {"type": "string", "description": "City and state, e.g., 'San Francisco, CA'"},
|
| 31 |
+
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
|
| 32 |
+
},
|
| 33 |
+
"required": ["location", "unit"]
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}]
|
| 37 |
+
|
| 38 |
+
response = client.chat.completions.create(
|
| 39 |
+
model=client.models.list().data[0].id,
|
| 40 |
+
messages=[{"role": "user", "content": "What's the weather like in San Francisco? use celsius."}],
|
| 41 |
+
tools=tools,
|
| 42 |
+
tool_choice="auto"
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
print(response)
|
| 46 |
+
|
| 47 |
+
tool_call = response.choices[0].message.tool_calls[0].function
|
| 48 |
+
print(f"Function called: {tool_call.name}")
|
| 49 |
+
print(f"Arguments: {tool_call.arguments}")
|
| 50 |
+
print(f"Result: {get_weather(**json.loads(tool_call.arguments))}")
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
**Output Example:**
|
| 54 |
+
```
|
| 55 |
+
Function called: get_weather
|
| 56 |
+
Arguments: {"location": "San Francisco, CA", "unit": "celsius"}
|
| 57 |
+
Result: Getting the weather for San Francisco, CA in celsius...
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## Manually Parsing Model Output
|
| 61 |
+
|
| 62 |
+
If you cannot use the built-in parser of inference engines that support MiniMax-M2, or need to use other inference frameworks (such as transformers, TGI, etc.), you can manually parse the model's raw output using the following method. This approach requires you to parse the XML tag format of the model output yourself.
|
| 63 |
+
|
| 64 |
+
### Example Using Transformers
|
| 65 |
+
|
| 66 |
+
Here is a complete example using the transformers library:
|
| 67 |
+
|
| 68 |
+
```python
|
| 69 |
+
from transformers import AutoTokenizer
|
| 70 |
+
|
| 71 |
+
def get_default_tools():
|
| 72 |
+
return [
|
| 73 |
+
{
|
| 74 |
+
"name": "get_current_weather",
|
| 75 |
+
"description": "Get the latest weather for a location",
|
| 76 |
+
"parameters": {
|
| 77 |
+
"type": "object",
|
| 78 |
+
"properties": {
|
| 79 |
+
"location": {
|
| 80 |
+
"type": "string",
|
| 81 |
+
"description": "A certain city, such as Beijing, Shanghai"
|
| 82 |
+
}
|
| 83 |
+
},
|
| 84 |
+
}
|
| 85 |
+
"required": ["location"],
|
| 86 |
+
"type": "object"
|
| 87 |
+
}
|
| 88 |
+
]
|
| 89 |
+
|
| 90 |
+
# Load model and tokenizer
|
| 91 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 92 |
+
prompt = "What's the weather like in Shanghai today?"
|
| 93 |
+
messages = [
|
| 94 |
+
{"role": "system", "content": "You are a helpful assistant."},
|
| 95 |
+
{"role": "user", "content": prompt},
|
| 96 |
+
]
|
| 97 |
+
|
| 98 |
+
# Enable function calling tools
|
| 99 |
+
tools = get_default_tools()
|
| 100 |
+
|
| 101 |
+
# Apply chat template and include tool definitions
|
| 102 |
+
text = tokenizer.apply_chat_template(
|
| 103 |
+
messages,
|
| 104 |
+
tokenize=False,
|
| 105 |
+
add_generation_prompt=True,
|
| 106 |
+
tools=tools
|
| 107 |
+
)
|
| 108 |
+
|
| 109 |
+
# Send request (using any inference service)
|
| 110 |
+
import requests
|
| 111 |
+
payload = {
|
| 112 |
+
"model": "MiniMaxAI/MiniMax-M2",
|
| 113 |
+
"prompt": text,
|
| 114 |
+
"max_tokens": 4096
|
| 115 |
+
}
|
| 116 |
+
response = requests.post(
|
| 117 |
+
"http://localhost:8000/v1/completions",
|
| 118 |
+
headers={"Content-Type": "application/json"},
|
| 119 |
+
json=payload,
|
| 120 |
+
stream=False,
|
| 121 |
+
)
|
| 122 |
+
|
| 123 |
+
# Model output needs manual parsing
|
| 124 |
+
raw_output = response.json()["choices"][0]["text"]
|
| 125 |
+
print("Raw output:", raw_output)
|
| 126 |
+
|
| 127 |
+
# Use the parsing function below to process the output
|
| 128 |
+
function_calls = parse_tool_calls(raw_output, tools)
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
## 🛠️ Function Call Definition
|
| 132 |
+
|
| 133 |
+
### Function Structure
|
| 134 |
+
|
| 135 |
+
Function calls need to define the `tools` field in the request body. Each function consists of the following parts:
|
| 136 |
+
|
| 137 |
+
```json
|
| 138 |
+
{
|
| 139 |
+
"tools": [
|
| 140 |
+
{
|
| 141 |
+
"name": "search_web",
|
| 142 |
+
"description": "Search function.",
|
| 143 |
+
"parameters": {
|
| 144 |
+
"properties": {
|
| 145 |
+
"query_list": {
|
| 146 |
+
"description": "Keywords for search, list should contain 1 element.",
|
| 147 |
+
"items": { "type": "string" },
|
| 148 |
+
"type": "array"
|
| 149 |
+
},
|
| 150 |
+
"query_tag": {
|
| 151 |
+
"description": "Category of query",
|
| 152 |
+
"items": { "type": "string" },
|
| 153 |
+
"type": "array"
|
| 154 |
+
}
|
| 155 |
+
},
|
| 156 |
+
"required": [ "query_list", "query_tag" ],
|
| 157 |
+
"type": "object"
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
]
|
| 161 |
+
}
|
| 162 |
+
```
|
| 163 |
+
|
| 164 |
+
**Field Descriptions:**
|
| 165 |
+
- `name`: Function name
|
| 166 |
+
- `description`: Function description
|
| 167 |
+
- `parameters`: Function parameter definition
|
| 168 |
+
- `properties`: Parameter property definition, where key is the parameter name and value contains detailed parameter description
|
| 169 |
+
- `required`: List of required parameters
|
| 170 |
+
- `type`: Parameter type (usually "object")
|
| 171 |
+
|
| 172 |
+
### Internal Processing Format
|
| 173 |
+
|
| 174 |
+
When processing within the MiniMax-M2 model, function definitions are converted to a special format and concatenated to the input text. Here is a complete example:
|
| 175 |
+
|
| 176 |
+
```
|
| 177 |
+
]~!b[]~b]system
|
| 178 |
+
You are a helpful assistant.
|
| 179 |
+
|
| 180 |
+
# Tools
|
| 181 |
+
You may call one or more tools to assist with the user query.
|
| 182 |
+
Here are the tools available in JSONSchema format:
|
| 183 |
+
|
| 184 |
+
<tools>
|
| 185 |
+
<tool>{"name": "search_web", "description": "Search function.", "parameters": {"type": "object", "properties": {"query_list": {"type": "array", "items": {"type": "string"}, "description": "Keywords for search, list should contain 1 element."}, "query_tag": {"type": "array", "items": {"type": "string"}, "description": "Category of query"}}, "required": ["query_list", "query_tag"]}}</tool>
|
| 186 |
+
</tools>
|
| 187 |
+
|
| 188 |
+
When making tool calls, use XML format to invoke tools and pass parameters:
|
| 189 |
+
|
| 190 |
+
<minimax:tool_call>
|
| 191 |
+
<invoke name="tool-name-1">
|
| 192 |
+
<parameter name="param-key-1">param-value-1</parameter>
|
| 193 |
+
<parameter name="param-key-2">param-value-2</parameter>
|
| 194 |
+
...
|
| 195 |
+
</invoke>
|
| 196 |
+
[e~[
|
| 197 |
+
]~b]user
|
| 198 |
+
When were the latest announcements from OpenAI and Gemini?[e~[
|
| 199 |
+
]~b]ai
|
| 200 |
+
<think>
|
| 201 |
+
```
|
| 202 |
+
|
| 203 |
+
**Format Description:**
|
| 204 |
+
|
| 205 |
+
- `]~!b[]~b]system`: System message start marker
|
| 206 |
+
- `[e~[`: Message end marker
|
| 207 |
+
- `]~b]user`: User message start marker
|
| 208 |
+
- `]~b]ai`: Assistant message start marker
|
| 209 |
+
- `]~b]tool`: Tool result message start marker
|
| 210 |
+
- `<tools>...</tools>`: Tool definition area, each tool is wrapped with `<tool>` tag, content is JSON Schema
|
| 211 |
+
- `<minimax:tool_call>...</minimax:tool_call>`: Tool call area
|
| 212 |
+
- `<think>`: Thinking process marker during generation (optional)
|
| 213 |
+
|
| 214 |
+
### Model Output Format
|
| 215 |
+
|
| 216 |
+
MiniMax-M2 uses structured XML tag format:
|
| 217 |
+
|
| 218 |
+
```xml
|
| 219 |
+
<minimax:tool_call>
|
| 220 |
+
<invoke name="search_web">
|
| 221 |
+
<parameter name="query_tag">["technology", "events"]</parameter>
|
| 222 |
+
<parameter name="query_list">["\"OpenAI\" \"latest\" \"release\""]</parameter>
|
| 223 |
+
</invoke>
|
| 224 |
+
<invoke name="search_web">
|
| 225 |
+
<parameter name="query_tag">["technology", "events"]</parameter>
|
| 226 |
+
<parameter name="query_list">["\"Gemini\" \"latest\" \"release\""]</parameter>
|
| 227 |
+
</invoke>
|
| 228 |
+
</minimax:tool_call>
|
| 229 |
+
```
|
| 230 |
+
|
| 231 |
+
Each function call uses the `<invoke name="function_name">` tag, and parameters use the `<parameter name="parameter_name">` tag wrapper.
|
| 232 |
+
|
| 233 |
+
## Manually Parsing Function Call Results
|
| 234 |
+
|
| 235 |
+
### Parsing Function Calls
|
| 236 |
+
|
| 237 |
+
MiniMax-M2 uses structured XML tags, which require a different parsing approach. The core function is as follows:
|
| 238 |
+
|
| 239 |
+
```python
|
| 240 |
+
import re
|
| 241 |
+
import json
|
| 242 |
+
from typing import Any, Optional, List, Dict
|
| 243 |
+
|
| 244 |
+
|
| 245 |
+
def extract_name(name_str: str) -> str:
|
| 246 |
+
"""Extract name from quoted string"""
|
| 247 |
+
name_str = name_str.strip()
|
| 248 |
+
if name_str.startswith('"') and name_str.endswith('"'):
|
| 249 |
+
return name_str[1:-1]
|
| 250 |
+
elif name_str.startswith("'") and name_str.endswith("'"):
|
| 251 |
+
return name_str[1:-1]
|
| 252 |
+
return name_str
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
def convert_param_value(value: str, param_type: str) -> Any:
|
| 256 |
+
"""Convert parameter value based on parameter type"""
|
| 257 |
+
if value.lower() == "null":
|
| 258 |
+
return None
|
| 259 |
+
|
| 260 |
+
param_type = param_type.lower()
|
| 261 |
+
|
| 262 |
+
if param_type in ["string", "str", "text"]:
|
| 263 |
+
return value
|
| 264 |
+
elif param_type in ["integer", "int"]:
|
| 265 |
+
try:
|
| 266 |
+
return int(value)
|
| 267 |
+
except (ValueError, TypeError):
|
| 268 |
+
return value
|
| 269 |
+
elif param_type in ["number", "float"]:
|
| 270 |
+
try:
|
| 271 |
+
val = float(value)
|
| 272 |
+
return val if val != int(val) else int(val)
|
| 273 |
+
except (ValueError, TypeError):
|
| 274 |
+
return value
|
| 275 |
+
elif param_type in ["boolean", "bool"]:
|
| 276 |
+
return value.lower() in ["true", "1"]
|
| 277 |
+
elif param_type in ["object", "array"]:
|
| 278 |
+
try:
|
| 279 |
+
return json.loads(value)
|
| 280 |
+
except json.JSONDecodeError:
|
| 281 |
+
return value
|
| 282 |
+
else:
|
| 283 |
+
# Try JSON parsing, return string if failed
|
| 284 |
+
try:
|
| 285 |
+
return json.loads(value)
|
| 286 |
+
except json.JSONDecodeError:
|
| 287 |
+
return value
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
def parse_tool_calls(model_output: str, tools: Optional[List[Dict]] = None) -> List[Dict]:
|
| 291 |
+
"""
|
| 292 |
+
Extract all tool calls from model output
|
| 293 |
+
|
| 294 |
+
Args:
|
| 295 |
+
model_output: Complete output text from the model
|
| 296 |
+
tools: Tool definition list for getting parameter type information, format can be:
|
| 297 |
+
- [{"name": "...", "parameters": {...}}]
|
| 298 |
+
- [{"type": "function", "function": {"name": "...", "parameters": {...}}}]
|
| 299 |
+
|
| 300 |
+
Returns:
|
| 301 |
+
Parsed tool call list, each element contains name and arguments fields
|
| 302 |
+
|
| 303 |
+
Example:
|
| 304 |
+
>>> tools = [{
|
| 305 |
+
... "name": "get_weather",
|
| 306 |
+
... "parameters": {
|
| 307 |
+
... "type": "object",
|
| 308 |
+
... "properties": {
|
| 309 |
+
... "location": {"type": "string"},
|
| 310 |
+
... "unit": {"type": "string"}
|
| 311 |
+
... }
|
| 312 |
+
... }
|
| 313 |
+
... }]
|
| 314 |
+
>>> output = '''<minimax:tool_call>
|
| 315 |
+
... <invoke name="get_weather">
|
| 316 |
+
... <parameter name="location">San Francisco</parameter>
|
| 317 |
+
... <parameter name="unit">celsius</parameter>
|
| 318 |
+
... </invoke>
|
| 319 |
+
... </minimax:tool_call>'''
|
| 320 |
+
>>> result = parse_tool_calls(output, tools)
|
| 321 |
+
>>> print(result)
|
| 322 |
+
[{'name': 'get_weather', 'arguments': {'location': 'San Francisco', 'unit': 'celsius'}}]
|
| 323 |
+
"""
|
| 324 |
+
# Quick check if tool call marker is present
|
| 325 |
+
if "<minimax:tool_call>" not in model_output:
|
| 326 |
+
return []
|
| 327 |
+
|
| 328 |
+
tool_calls = []
|
| 329 |
+
|
| 330 |
+
try:
|
| 331 |
+
# Match all <minimax:tool_call> blocks
|
| 332 |
+
tool_call_regex = re.compile(r"<minimax:tool_call>(.*?)</minimax:tool_call>", re.DOTALL)
|
| 333 |
+
invoke_regex = re.compile(r"<invoke name=(.*?)</invoke>", re.DOTALL)
|
| 334 |
+
parameter_regex = re.compile(r"<parameter name=(.*?)</parameter>", re.DOTALL)
|
| 335 |
+
|
| 336 |
+
# Iterate through all tool_call blocks
|
| 337 |
+
for tool_call_match in tool_call_regex.findall(model_output):
|
| 338 |
+
# Iterate through all invokes in this block
|
| 339 |
+
for invoke_match in invoke_regex.findall(tool_call_match):
|
| 340 |
+
# Extract function name
|
| 341 |
+
name_match = re.search(r'^([^>]+)', invoke_match)
|
| 342 |
+
if not name_match:
|
| 343 |
+
continue
|
| 344 |
+
|
| 345 |
+
function_name = extract_name(name_match.group(1))
|
| 346 |
+
|
| 347 |
+
# Get parameter configuration
|
| 348 |
+
param_config = {}
|
| 349 |
+
if tools:
|
| 350 |
+
for tool in tools:
|
| 351 |
+
tool_name = tool.get("name") or tool.get("function", {}).get("name")
|
| 352 |
+
if tool_name == function_name:
|
| 353 |
+
params = tool.get("parameters") or tool.get("function", {}).get("parameters")
|
| 354 |
+
if isinstance(params, dict) and "properties" in params:
|
| 355 |
+
param_config = params["properties"]
|
| 356 |
+
break
|
| 357 |
+
|
| 358 |
+
# Extract parameters
|
| 359 |
+
param_dict = {}
|
| 360 |
+
for match in parameter_regex.findall(invoke_match):
|
| 361 |
+
param_match = re.search(r'^([^>]+)>(.*)', match, re.DOTALL)
|
| 362 |
+
if param_match:
|
| 363 |
+
param_name = extract_name(param_match.group(1))
|
| 364 |
+
param_value = param_match.group(2).strip()
|
| 365 |
+
|
| 366 |
+
# Remove leading and trailing newlines
|
| 367 |
+
if param_value.startswith('\n'):
|
| 368 |
+
param_value = param_value[1:]
|
| 369 |
+
if param_value.endswith('\n'):
|
| 370 |
+
param_value = param_value[:-1]
|
| 371 |
+
|
| 372 |
+
# Get parameter type and convert
|
| 373 |
+
param_type = "string"
|
| 374 |
+
if param_name in param_config:
|
| 375 |
+
if isinstance(param_config[param_name], dict) and "type" in param_config[param_name]:
|
| 376 |
+
param_type = param_config[param_name]["type"]
|
| 377 |
+
|
| 378 |
+
param_dict[param_name] = convert_param_value(param_value, param_type)
|
| 379 |
+
|
| 380 |
+
tool_calls.append({
|
| 381 |
+
"name": function_name,
|
| 382 |
+
"arguments": param_dict
|
| 383 |
+
})
|
| 384 |
+
|
| 385 |
+
except Exception as e:
|
| 386 |
+
print(f"Failed to parse tool calls: {e}")
|
| 387 |
+
return []
|
| 388 |
+
|
| 389 |
+
return tool_calls
|
| 390 |
+
```
|
| 391 |
+
|
| 392 |
+
**Usage Example:**
|
| 393 |
+
|
| 394 |
+
```python
|
| 395 |
+
# Define tools
|
| 396 |
+
tools = [
|
| 397 |
+
{
|
| 398 |
+
"name": "get_weather",
|
| 399 |
+
"parameters": {
|
| 400 |
+
"type": "object",
|
| 401 |
+
"properties": {
|
| 402 |
+
"location": {"type": "string"},
|
| 403 |
+
"unit": {"type": "string"}
|
| 404 |
+
},
|
| 405 |
+
"required": ["location", "unit"]
|
| 406 |
+
}
|
| 407 |
+
}
|
| 408 |
+
]
|
| 409 |
+
|
| 410 |
+
# Model output
|
| 411 |
+
model_output = """Let me help you query the weather.
|
| 412 |
+
<minimax:tool_call>
|
| 413 |
+
<invoke name="get_weather">
|
| 414 |
+
<parameter name="location">San Francisco</parameter>
|
| 415 |
+
<parameter name="unit">celsius</parameter>
|
| 416 |
+
</invoke>
|
| 417 |
+
</minimax:tool_call>"""
|
| 418 |
+
|
| 419 |
+
# Parse tool calls
|
| 420 |
+
tool_calls = parse_tool_calls(model_output, tools)
|
| 421 |
+
|
| 422 |
+
# Output results
|
| 423 |
+
for call in tool_calls:
|
| 424 |
+
print(f"Function called: {call['name']}")
|
| 425 |
+
print(f"Arguments: {call['arguments']}")
|
| 426 |
+
# Output: Function called: get_weather
|
| 427 |
+
# Arguments: {'location': 'San Francisco', 'unit': 'celsius'}
|
| 428 |
+
```
|
| 429 |
+
|
| 430 |
+
### Executing Function Calls
|
| 431 |
+
|
| 432 |
+
After parsing is complete, you can execute the corresponding function and construct the return result:
|
| 433 |
+
|
| 434 |
+
```python
|
| 435 |
+
def execute_function_call(function_name: str, arguments: dict):
|
| 436 |
+
"""Execute function call and return result"""
|
| 437 |
+
if function_name == "get_weather":
|
| 438 |
+
location = arguments.get("location", "Unknown location")
|
| 439 |
+
unit = arguments.get("unit", "celsius")
|
| 440 |
+
# Build function execution result
|
| 441 |
+
return {
|
| 442 |
+
"role": "tool",
|
| 443 |
+
"content": [
|
| 444 |
+
{
|
| 445 |
+
"name": function_name,
|
| 446 |
+
"type": "text",
|
| 447 |
+
"text": json.dumps({
|
| 448 |
+
"location": location,
|
| 449 |
+
"temperature": "25",
|
| 450 |
+
"unit": unit,
|
| 451 |
+
"weather": "Sunny"
|
| 452 |
+
}, ensure_ascii=False)
|
| 453 |
+
}
|
| 454 |
+
]
|
| 455 |
+
}
|
| 456 |
+
elif function_name == "search_web":
|
| 457 |
+
query_list = arguments.get("query_list", [])
|
| 458 |
+
query_tag = arguments.get("query_tag", [])
|
| 459 |
+
# Simulate search results
|
| 460 |
+
return {
|
| 461 |
+
"role": "tool",
|
| 462 |
+
"content": [
|
| 463 |
+
{
|
| 464 |
+
"name": function_name,
|
| 465 |
+
"type": "text",
|
| 466 |
+
"text": f"Search keywords: {query_list}, Category: {query_tag}\nSearch results: Relevant information found"
|
| 467 |
+
}
|
| 468 |
+
]
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
return None
|
| 472 |
+
```
|
| 473 |
+
|
| 474 |
+
### Returning Function Execution Results to the Model
|
| 475 |
+
|
| 476 |
+
After successfully parsing function calls, you should add the function execution results to the conversation history so that the model can access and utilize this information in subsequent interactions. Refer to chat_template.jinja for concatenation format.
|
| 477 |
+
|
| 478 |
+
## References
|
| 479 |
+
|
| 480 |
+
- [MiniMax-M2 Model Repository](https://github.com/MiniMax-AI/MiniMax-M2)
|
| 481 |
+
- [vLLM Project Homepage](https://github.com/vllm-project/vllm)
|
| 482 |
+
- [OpenAI Python SDK](https://github.com/openai/openai-python)
|
docs/function_call_guide_cn.md
ADDED
|
@@ -0,0 +1,482 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MiniMax-M2 函数调用(Function Call)功能指南
|
| 2 |
+
|
| 3 |
+
## 简介
|
| 4 |
+
|
| 5 |
+
MiniMax-M2 模型支持函数调用功能,使模型能够识别何时需要调用外部函数,并以结构化格式输出函数调用参数。本文档详细介绍了如何使用 MiniMax-M2 的函数调用功能。
|
| 6 |
+
|
| 7 |
+
## 基础示例
|
| 8 |
+
|
| 9 |
+
以下 Python 脚本基于 OpenAI SDK 实现了一个天气查询函数的调用示例:
|
| 10 |
+
|
| 11 |
+
```python
|
| 12 |
+
from openai import OpenAI
|
| 13 |
+
import json
|
| 14 |
+
|
| 15 |
+
client = OpenAI(base_url="http://localhost:8000/v1", api_key="dummy")
|
| 16 |
+
|
| 17 |
+
def get_weather(location: str, unit: str):
|
| 18 |
+
return f"Getting the weather for {location} in {unit}..."
|
| 19 |
+
|
| 20 |
+
tool_functions = {"get_weather": get_weather}
|
| 21 |
+
|
| 22 |
+
tools = [{
|
| 23 |
+
"type": "function",
|
| 24 |
+
"function": {
|
| 25 |
+
"name": "get_weather",
|
| 26 |
+
"description": "Get the current weather in a given location",
|
| 27 |
+
"parameters": {
|
| 28 |
+
"type": "object",
|
| 29 |
+
"properties": {
|
| 30 |
+
"location": {"type": "string", "description": "City and state, e.g., 'San Francisco, CA'"},
|
| 31 |
+
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
|
| 32 |
+
},
|
| 33 |
+
"required": ["location", "unit"]
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
}]
|
| 37 |
+
|
| 38 |
+
response = client.chat.completions.create(
|
| 39 |
+
model=client.models.list().data[0].id,
|
| 40 |
+
messages=[{"role": "user", "content": "What's the weather like in San Francisco? use celsius."}],
|
| 41 |
+
tools=tools,
|
| 42 |
+
tool_choice="auto"
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
print(response)
|
| 46 |
+
|
| 47 |
+
tool_call = response.choices[0].message.tool_calls[0].function
|
| 48 |
+
print(f"Function called: {tool_call.name}")
|
| 49 |
+
print(f"Arguments: {tool_call.arguments}")
|
| 50 |
+
print(f"Result: {get_weather(**json.loads(tool_call.arguments))}")
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
**输出示例:**
|
| 54 |
+
```
|
| 55 |
+
Function called: get_weather
|
| 56 |
+
Arguments: {"location": "San Francisco, CA", "unit": "celsius"}
|
| 57 |
+
Result: Getting the weather for San Francisco, CA in celsius...
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## 手动解析模型输出
|
| 61 |
+
|
| 62 |
+
如果您无法使用已支持 MiniMax-M2 的推理引擎的内置解析器,或者需要使用其他推理框架(如 transformers、TGI 等),可以使用以下方法手动解析模型的原始输出。这种方法需要您自己解析模型输出的 XML 标签格式。
|
| 63 |
+
|
| 64 |
+
### 使用 Transformers 的示例
|
| 65 |
+
|
| 66 |
+
以下是使用 transformers 库的完整示例:
|
| 67 |
+
|
| 68 |
+
```python
|
| 69 |
+
from transformers import AutoTokenizer
|
| 70 |
+
|
| 71 |
+
def get_default_tools():
|
| 72 |
+
return [
|
| 73 |
+
{
|
| 74 |
+
"name": "get_current_weather",
|
| 75 |
+
"description": "Get the latest weather for a location",
|
| 76 |
+
"parameters": {
|
| 77 |
+
"type": "object",
|
| 78 |
+
"properties": {
|
| 79 |
+
"location": {
|
| 80 |
+
"type": "string",
|
| 81 |
+
"description": "A certain city, such as Beijing, Shanghai"
|
| 82 |
+
}
|
| 83 |
+
},
|
| 84 |
+
}
|
| 85 |
+
"required": ["location"],
|
| 86 |
+
"type": "object"
|
| 87 |
+
}
|
| 88 |
+
]
|
| 89 |
+
|
| 90 |
+
# 加载模型和分词器
|
| 91 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 92 |
+
prompt = "What's the weather like in Shanghai today?"
|
| 93 |
+
messages = [
|
| 94 |
+
{"role": "system", "content": "You are a helpful assistant."},
|
| 95 |
+
{"role": "user", "content": prompt},
|
| 96 |
+
]
|
| 97 |
+
|
| 98 |
+
# 启用函数调用工具
|
| 99 |
+
tools = get_default_tools()
|
| 100 |
+
|
| 101 |
+
# 应用聊天模板,并加入工具定义
|
| 102 |
+
text = tokenizer.apply_chat_template(
|
| 103 |
+
messages,
|
| 104 |
+
tokenize=False,
|
| 105 |
+
add_generation_prompt=True,
|
| 106 |
+
tools=tools
|
| 107 |
+
)
|
| 108 |
+
|
| 109 |
+
# 发送请求(这里使用任何推理服务)
|
| 110 |
+
import requests
|
| 111 |
+
payload = {
|
| 112 |
+
"model": "MiniMaxAI/MiniMax-M2",
|
| 113 |
+
"prompt": text,
|
| 114 |
+
"max_tokens": 4096
|
| 115 |
+
}
|
| 116 |
+
response = requests.post(
|
| 117 |
+
"http://localhost:8000/v1/completions",
|
| 118 |
+
headers={"Content-Type": "application/json"},
|
| 119 |
+
json=payload,
|
| 120 |
+
stream=False,
|
| 121 |
+
)
|
| 122 |
+
|
| 123 |
+
# 模型输出需要手动解析
|
| 124 |
+
raw_output = response.json()["choices"][0]["text"]
|
| 125 |
+
print("原始输出:", raw_output)
|
| 126 |
+
|
| 127 |
+
# 使用下面的解析函数处理输出
|
| 128 |
+
function_calls = parse_tool_calls(raw_output, tools)
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
## 🛠️ 函数调用的定义
|
| 132 |
+
|
| 133 |
+
### 函数结构体
|
| 134 |
+
|
| 135 |
+
函数调用需要在请求体中定义 `tools` 字段,每个函数由以下部分组成:
|
| 136 |
+
|
| 137 |
+
```json
|
| 138 |
+
{
|
| 139 |
+
"tools": [
|
| 140 |
+
{
|
| 141 |
+
"name": "search_web",
|
| 142 |
+
"description": "搜索函数。",
|
| 143 |
+
"parameters": {
|
| 144 |
+
"properties": {
|
| 145 |
+
"query_list": {
|
| 146 |
+
"description": "进行搜索的关键词,列表元素个数为1。",
|
| 147 |
+
"items": { "type": "string" },
|
| 148 |
+
"type": "array"
|
| 149 |
+
},
|
| 150 |
+
"query_tag": {
|
| 151 |
+
"description": "query的分类",
|
| 152 |
+
"items": { "type": "string" },
|
| 153 |
+
"type": "array"
|
| 154 |
+
}
|
| 155 |
+
},
|
| 156 |
+
"required": [ "query_list", "query_tag" ],
|
| 157 |
+
"type": "object"
|
| 158 |
+
}
|
| 159 |
+
}
|
| 160 |
+
]
|
| 161 |
+
}
|
| 162 |
+
```
|
| 163 |
+
|
| 164 |
+
**字段说明:**
|
| 165 |
+
- `name`: 函数名称
|
| 166 |
+
- `description`: 函数功能描述
|
| 167 |
+
- `parameters`: 函数参数定义
|
| 168 |
+
- `properties`: 参数属性定义,key 是参数名,value 包含参数的详细描述
|
| 169 |
+
- `required`: 必填参数列表
|
| 170 |
+
- `type`: 参数类型(通常为 "object")
|
| 171 |
+
|
| 172 |
+
### 模型内部处理格式
|
| 173 |
+
|
| 174 |
+
在 MiniMax-M2 模型内部处理���,函数定义会被转换为特殊格式并拼接到输入文本中。以下是一个完整的示例:
|
| 175 |
+
|
| 176 |
+
```
|
| 177 |
+
]~!b[]~b]system
|
| 178 |
+
You are a helpful assistant.
|
| 179 |
+
|
| 180 |
+
# Tools
|
| 181 |
+
You may call one or more tools to assist with the user query.
|
| 182 |
+
Here are the tools available in JSONSchema format:
|
| 183 |
+
|
| 184 |
+
<tools>
|
| 185 |
+
<tool>{"name": "search_web", "description": "搜索函数。", "parameters": {"type": "object", "properties": {"query_list": {"type": "array", "items": {"type": "string"}, "description": "进行搜索的关键词,列表元素个数为1。"}, "query_tag": {"type": "array", "items": {"type": "string"}, "description": "query的分类"}}, "required": ["query_list", "query_tag"]}}</tool>
|
| 186 |
+
</tools>
|
| 187 |
+
|
| 188 |
+
When making tool calls, use XML format to invoke tools and pass parameters:
|
| 189 |
+
|
| 190 |
+
<minimax:tool_call>
|
| 191 |
+
<invoke name="tool-name-1">
|
| 192 |
+
<parameter name="param-key-1">param-value-1</parameter>
|
| 193 |
+
<parameter name="param-key-2">param-value-2</parameter>
|
| 194 |
+
...
|
| 195 |
+
</invoke>
|
| 196 |
+
[e~[
|
| 197 |
+
]~b]user
|
| 198 |
+
OpenAI 和 Gemini 的最近一次发布会都是什么时候?[e~[
|
| 199 |
+
]~b]ai
|
| 200 |
+
<think>
|
| 201 |
+
```
|
| 202 |
+
|
| 203 |
+
**格式说明:**
|
| 204 |
+
|
| 205 |
+
- `]~!b[]~b]system`: System 消息开始标记
|
| 206 |
+
- `[e~[`: 消息结束标记
|
| 207 |
+
- `]~b]user`: User 消息开始标记
|
| 208 |
+
- `]~b]ai`: Assistant 消息开始标记
|
| 209 |
+
- `]~b]tool`: Tool 结果消息开始标记
|
| 210 |
+
- `<tools>...</tools>`: 工具定义区域,每个工具用 `<tool>` 标签包裹,内容为 JSON Schema
|
| 211 |
+
- `<minimax:tool_call>...</minimax:tool_call>`: 工具调用区域
|
| 212 |
+
- `<think>`: 生成时的思考过程标记(可选)
|
| 213 |
+
|
| 214 |
+
### 模型输出格式
|
| 215 |
+
|
| 216 |
+
MiniMax-M2使用结构化的 XML 标签格式:
|
| 217 |
+
|
| 218 |
+
```xml
|
| 219 |
+
<minimax:tool_call>
|
| 220 |
+
<invoke name="search_web">
|
| 221 |
+
<parameter name="query_tag">["technology", "events"]</parameter>
|
| 222 |
+
<parameter name="query_list">["\"OpenAI\" \"latest\" \"release\""]</parameter>
|
| 223 |
+
</invoke>
|
| 224 |
+
<invoke name="search_web">
|
| 225 |
+
<parameter name="query_tag">["technology", "events"]</parameter>
|
| 226 |
+
<parameter name="query_list">["\"Gemini\" \"latest\" \"release\""]</parameter>
|
| 227 |
+
</invoke>
|
| 228 |
+
</minimax:tool_call>
|
| 229 |
+
```
|
| 230 |
+
|
| 231 |
+
每个函数调用使用 `<invoke name="函数名">` 标签,参数使用 `<parameter name="参数名">` 标签包裹。
|
| 232 |
+
|
| 233 |
+
## 手动解析函数调用结果
|
| 234 |
+
|
| 235 |
+
### 解析函数调用
|
| 236 |
+
|
| 237 |
+
MiniMax-M2使用结构化的 XML 标签,需要不同的解析方式。核心函数如下:
|
| 238 |
+
|
| 239 |
+
```python
|
| 240 |
+
import re
|
| 241 |
+
import json
|
| 242 |
+
from typing import Any, Optional, List, Dict
|
| 243 |
+
|
| 244 |
+
|
| 245 |
+
def extract_name(name_str: str) -> str:
|
| 246 |
+
"""从引号包裹的字符串中提取名称"""
|
| 247 |
+
name_str = name_str.strip()
|
| 248 |
+
if name_str.startswith('"') and name_str.endswith('"'):
|
| 249 |
+
return name_str[1:-1]
|
| 250 |
+
elif name_str.startswith("'") and name_str.endswith("'"):
|
| 251 |
+
return name_str[1:-1]
|
| 252 |
+
return name_str
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
def convert_param_value(value: str, param_type: str) -> Any:
|
| 256 |
+
"""根据参数类型转换参数值"""
|
| 257 |
+
if value.lower() == "null":
|
| 258 |
+
return None
|
| 259 |
+
|
| 260 |
+
param_type = param_type.lower()
|
| 261 |
+
|
| 262 |
+
if param_type in ["string", "str", "text"]:
|
| 263 |
+
return value
|
| 264 |
+
elif param_type in ["integer", "int"]:
|
| 265 |
+
try:
|
| 266 |
+
return int(value)
|
| 267 |
+
except (ValueError, TypeError):
|
| 268 |
+
return value
|
| 269 |
+
elif param_type in ["number", "float"]:
|
| 270 |
+
try:
|
| 271 |
+
val = float(value)
|
| 272 |
+
return val if val != int(val) else int(val)
|
| 273 |
+
except (ValueError, TypeError):
|
| 274 |
+
return value
|
| 275 |
+
elif param_type in ["boolean", "bool"]:
|
| 276 |
+
return value.lower() in ["true", "1"]
|
| 277 |
+
elif param_type in ["object", "array"]:
|
| 278 |
+
try:
|
| 279 |
+
return json.loads(value)
|
| 280 |
+
except json.JSONDecodeError:
|
| 281 |
+
return value
|
| 282 |
+
else:
|
| 283 |
+
# 尝试 JSON 解析,失败则返回字符串
|
| 284 |
+
try:
|
| 285 |
+
return json.loads(value)
|
| 286 |
+
except json.JSONDecodeError:
|
| 287 |
+
return value
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
def parse_tool_calls(model_output: str, tools: Optional[List[Dict]] = None) -> List[Dict]:
|
| 291 |
+
"""
|
| 292 |
+
从模型输出中提取所有工具调用
|
| 293 |
+
|
| 294 |
+
Args:
|
| 295 |
+
model_output: 模型的完整输出文本
|
| 296 |
+
tools: 工具定义列表,用于获取参数类型信息,格式可以是:
|
| 297 |
+
- [{"name": "...", "parameters": {...}}]
|
| 298 |
+
- [{"type": "function", "function": {"name": "...", "parameters": {...}}}]
|
| 299 |
+
|
| 300 |
+
Returns:
|
| 301 |
+
解析后的工具调用列表,每个元素包含 name 和 arguments 字段
|
| 302 |
+
|
| 303 |
+
Example:
|
| 304 |
+
>>> tools = [{
|
| 305 |
+
... "name": "get_weather",
|
| 306 |
+
... "parameters": {
|
| 307 |
+
... "type": "object",
|
| 308 |
+
... "properties": {
|
| 309 |
+
... "location": {"type": "string"},
|
| 310 |
+
... "unit": {"type": "string"}
|
| 311 |
+
... }
|
| 312 |
+
... }
|
| 313 |
+
... }]
|
| 314 |
+
>>> output = '''<minimax:tool_call>
|
| 315 |
+
... <invoke name="get_weather">
|
| 316 |
+
... <parameter name="location">San Francisco</parameter>
|
| 317 |
+
... <parameter name="unit">celsius</parameter>
|
| 318 |
+
... </invoke>
|
| 319 |
+
... </minimax:tool_call>'''
|
| 320 |
+
>>> result = parse_tool_calls(output, tools)
|
| 321 |
+
>>> print(result)
|
| 322 |
+
[{'name': 'get_weather', 'arguments': {'location': 'San Francisco', 'unit': 'celsius'}}]
|
| 323 |
+
"""
|
| 324 |
+
# 快速检查是否包含工具调用标记
|
| 325 |
+
if "<minimax:tool_call>" not in model_output:
|
| 326 |
+
return []
|
| 327 |
+
|
| 328 |
+
tool_calls = []
|
| 329 |
+
|
| 330 |
+
try:
|
| 331 |
+
# 匹配所有 <minimax:tool_call> 块
|
| 332 |
+
tool_call_regex = re.compile(r"<minimax:tool_call>(.*?)</minimax:tool_call>", re.DOTALL)
|
| 333 |
+
invoke_regex = re.compile(r"<invoke name=(.*?)</invoke>", re.DOTALL)
|
| 334 |
+
parameter_regex = re.compile(r"<parameter name=(.*?)</parameter>", re.DOTALL)
|
| 335 |
+
|
| 336 |
+
# 遍历所有 tool_call 块
|
| 337 |
+
for tool_call_match in tool_call_regex.findall(model_output):
|
| 338 |
+
# 遍历该块中的所有 invoke
|
| 339 |
+
for invoke_match in invoke_regex.findall(tool_call_match):
|
| 340 |
+
# 提取函数名
|
| 341 |
+
name_match = re.search(r'^([^>]+)', invoke_match)
|
| 342 |
+
if not name_match:
|
| 343 |
+
continue
|
| 344 |
+
|
| 345 |
+
function_name = extract_name(name_match.group(1))
|
| 346 |
+
|
| 347 |
+
# 获取参数配置
|
| 348 |
+
param_config = {}
|
| 349 |
+
if tools:
|
| 350 |
+
for tool in tools:
|
| 351 |
+
tool_name = tool.get("name") or tool.get("function", {}).get("name")
|
| 352 |
+
if tool_name == function_name:
|
| 353 |
+
params = tool.get("parameters") or tool.get("function", {}).get("parameters")
|
| 354 |
+
if isinstance(params, dict) and "properties" in params:
|
| 355 |
+
param_config = params["properties"]
|
| 356 |
+
break
|
| 357 |
+
|
| 358 |
+
# 提取参数
|
| 359 |
+
param_dict = {}
|
| 360 |
+
for match in parameter_regex.findall(invoke_match):
|
| 361 |
+
param_match = re.search(r'^([^>]+)>(.*)', match, re.DOTALL)
|
| 362 |
+
if param_match:
|
| 363 |
+
param_name = extract_name(param_match.group(1))
|
| 364 |
+
param_value = param_match.group(2).strip()
|
| 365 |
+
|
| 366 |
+
# 去除首尾的换行符
|
| 367 |
+
if param_value.startswith('\n'):
|
| 368 |
+
param_value = param_value[1:]
|
| 369 |
+
if param_value.endswith('\n'):
|
| 370 |
+
param_value = param_value[:-1]
|
| 371 |
+
|
| 372 |
+
# 获取参数类型并转换
|
| 373 |
+
param_type = "string"
|
| 374 |
+
if param_name in param_config:
|
| 375 |
+
if isinstance(param_config[param_name], dict) and "type" in param_config[param_name]:
|
| 376 |
+
param_type = param_config[param_name]["type"]
|
| 377 |
+
|
| 378 |
+
param_dict[param_name] = convert_param_value(param_value, param_type)
|
| 379 |
+
|
| 380 |
+
tool_calls.append({
|
| 381 |
+
"name": function_name,
|
| 382 |
+
"arguments": param_dict
|
| 383 |
+
})
|
| 384 |
+
|
| 385 |
+
except Exception as e:
|
| 386 |
+
print(f"解析工具调用失败: {e}")
|
| 387 |
+
return []
|
| 388 |
+
|
| 389 |
+
return tool_calls
|
| 390 |
+
```
|
| 391 |
+
|
| 392 |
+
**使用示例:**
|
| 393 |
+
|
| 394 |
+
```python
|
| 395 |
+
# 定义工具
|
| 396 |
+
tools = [
|
| 397 |
+
{
|
| 398 |
+
"name": "get_weather",
|
| 399 |
+
"parameters": {
|
| 400 |
+
"type": "object",
|
| 401 |
+
"properties": {
|
| 402 |
+
"location": {"type": "string"},
|
| 403 |
+
"unit": {"type": "string"}
|
| 404 |
+
},
|
| 405 |
+
"required": ["location", "unit"]
|
| 406 |
+
}
|
| 407 |
+
}
|
| 408 |
+
]
|
| 409 |
+
|
| 410 |
+
# 模型输出
|
| 411 |
+
model_output = """我来帮你查询天气。
|
| 412 |
+
<minimax:tool_call>
|
| 413 |
+
<invoke name="get_weather">
|
| 414 |
+
<parameter name="location">San Francisco</parameter>
|
| 415 |
+
<parameter name="unit">celsius</parameter>
|
| 416 |
+
</invoke>
|
| 417 |
+
</minimax:tool_call>"""
|
| 418 |
+
|
| 419 |
+
# 解析工具调用
|
| 420 |
+
tool_calls = parse_tool_calls(model_output, tools)
|
| 421 |
+
|
| 422 |
+
# 输出结果
|
| 423 |
+
for call in tool_calls:
|
| 424 |
+
print(f"调用函数: {call['name']}")
|
| 425 |
+
print(f"参数: {call['arguments']}")
|
| 426 |
+
# 输出: 调用函数: get_weather
|
| 427 |
+
# 参数: {'location': 'San Francisco', 'unit': 'celsius'}
|
| 428 |
+
```
|
| 429 |
+
|
| 430 |
+
### 执行函数调用
|
| 431 |
+
|
| 432 |
+
解析完成后,您可以执行对应的函数并构建返回结果:
|
| 433 |
+
|
| 434 |
+
```python
|
| 435 |
+
def execute_function_call(function_name: str, arguments: dict):
|
| 436 |
+
"""执行函数调用并返回结果"""
|
| 437 |
+
if function_name == "get_weather":
|
| 438 |
+
location = arguments.get("location", "未知位置")
|
| 439 |
+
unit = arguments.get("unit", "celsius")
|
| 440 |
+
# 构建函数执行结果
|
| 441 |
+
return {
|
| 442 |
+
"role": "tool",
|
| 443 |
+
"content": [
|
| 444 |
+
{
|
| 445 |
+
"name": function_name,
|
| 446 |
+
"type": "text",
|
| 447 |
+
"text": json.dumps({
|
| 448 |
+
"location": location,
|
| 449 |
+
"temperature": "25",
|
| 450 |
+
"unit": unit,
|
| 451 |
+
"weather": "晴朗"
|
| 452 |
+
}, ensure_ascii=False)
|
| 453 |
+
}
|
| 454 |
+
]
|
| 455 |
+
}
|
| 456 |
+
elif function_name == "search_web":
|
| 457 |
+
query_list = arguments.get("query_list", [])
|
| 458 |
+
query_tag = arguments.get("query_tag", [])
|
| 459 |
+
# 模拟搜索结果
|
| 460 |
+
return {
|
| 461 |
+
"role": "tool",
|
| 462 |
+
"content": [
|
| 463 |
+
{
|
| 464 |
+
"name": function_name,
|
| 465 |
+
"type": "text",
|
| 466 |
+
"text": f"搜索关键词: {query_list}, 分类: {query_tag}\n搜索结果: 相关信息已找到"
|
| 467 |
+
}
|
| 468 |
+
]
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
return None
|
| 472 |
+
```
|
| 473 |
+
|
| 474 |
+
### 将函数执行结果返回给模型
|
| 475 |
+
|
| 476 |
+
成功解析函数调用后,您应将函数执行结果添加到对话历史中,以便模型在后续交互中能够访问和利用这些信息,拼接格式参考chat_template.jinja
|
| 477 |
+
|
| 478 |
+
## 参考资料
|
| 479 |
+
|
| 480 |
+
- [MiniMax-M2 模型仓库](https://github.com/MiniMax-AI/MiniMax-M2)
|
| 481 |
+
- [vLLM 项目主页](https://github.com/vllm-project/vllm)
|
| 482 |
+
- [OpenAI Python SDK](https://github.com/openai/openai-python)
|
docs/vllm_deploy_guide.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MiniMax M2 Model vLLM Deployment Guide
|
| 2 |
+
|
| 3 |
+
We recommend using [vLLM](https://docs.vllm.ai/en/stable/) to deploy the [MiniMax-M2](https://huggingface.co/MiniMaxAI/MiniMax-M2) model. vLLM is a high-performance inference engine with excellent serving throughput, efficient and intelligent memory management, powerful batch request processing capabilities, and deeply optimized underlying performance. We recommend reviewing vLLM's official documentation to check hardware compatibility before deployment.
|
| 4 |
+
|
| 5 |
+
## System Requirements
|
| 6 |
+
|
| 7 |
+
- OS: Linux
|
| 8 |
+
|
| 9 |
+
- Python: 3.9 - 3.12
|
| 10 |
+
|
| 11 |
+
- GPU:
|
| 12 |
+
|
| 13 |
+
- compute capability 7.0 or higher
|
| 14 |
+
|
| 15 |
+
- Memory requirements: 220 GB for weights, 60 GB per 1M context tokens
|
| 16 |
+
|
| 17 |
+
The following are recommended configurations; actual requirements should be adjusted based on your use case:
|
| 18 |
+
|
| 19 |
+
- 4x 96GB GPUs: Supports context input of up to 400K tokens.
|
| 20 |
+
|
| 21 |
+
- 8x 144GB GPUs: Supports context input of up to 3M tokens.
|
| 22 |
+
|
| 23 |
+
## Deployment with Python
|
| 24 |
+
|
| 25 |
+
It is recommended to use a virtual environment (such as venv, conda, or uv) to avoid dependency conflicts. We recommend installing vLLM in a fresh Python environment:
|
| 26 |
+
|
| 27 |
+
```bash
|
| 28 |
+
# Not yet released, please install nightly build
|
| 29 |
+
uv pip install -U vllm \
|
| 30 |
+
--torch-backend=auto \
|
| 31 |
+
--extra-index-url https://wheels.vllm.ai/nightly
|
| 32 |
+
# If released, install using uv
|
| 33 |
+
uv pip install "vllm" --torch-backend=auto
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
Run the following command to start the vLLM server. vLLM will automatically download and cache the MiniMax-M2 model from Hugging Face.
|
| 37 |
+
|
| 38 |
+
4-GPU deployment command:
|
| 39 |
+
|
| 40 |
+
```bash
|
| 41 |
+
SAFETENSORS_FAST_GPU=1 VLLM_USE_V1=0 vllm serve \
|
| 42 |
+
--model MiniMaxAI/MiniMax-M2 \
|
| 43 |
+
--trust-remote-code \
|
| 44 |
+
--enable-expert-parallel --tensor-parallel-size 4 \
|
| 45 |
+
--enable-auto-tool-choice --tool-call-parser minimax_m2 \
|
| 46 |
+
--reasoning-parser minimax_m2
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
## Testing Deployment
|
| 50 |
+
|
| 51 |
+
After startup, you can test the vLLM OpenAI-compatible API with the following command:
|
| 52 |
+
|
| 53 |
+
```bash
|
| 54 |
+
curl http://localhost:8000/v1/chat/completions \
|
| 55 |
+
-H "Content-Type: application/json" \
|
| 56 |
+
-d '{
|
| 57 |
+
"model": "MiniMaxAI/MiniMax-M2",
|
| 58 |
+
"messages": [
|
| 59 |
+
{"role": "system", "content": [{"type": "text", "text": "You are a helpful assistant."}]},
|
| 60 |
+
{"role": "user", "content": [{"type": "text", "text": "Who won the world series in 2020?"}]}
|
| 61 |
+
]
|
| 62 |
+
}'
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
## Common Issues
|
| 66 |
+
|
| 67 |
+
### Hugging Face Network Issues
|
| 68 |
+
|
| 69 |
+
If you encounter network issues, you can set up a proxy before pulling the model.
|
| 70 |
+
|
| 71 |
+
```bash
|
| 72 |
+
export HF_ENDPOINT=https://hf-mirror.com
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
### MiniMax-M2 model is not currently supported
|
| 76 |
+
|
| 77 |
+
This vLLM version is outdated. Please upgrade to the latest version.
|
| 78 |
+
|
| 79 |
+
## Getting Support
|
| 80 |
+
|
| 81 |
+
If you encounter any issues while deploying the MiniMax model:
|
| 82 |
+
|
| 83 |
+
- Contact our technical support team through official channels such as email at api@minimaxi.com
|
| 84 |
+
|
| 85 |
+
- Submit an issue on our [GitHub](https://github.com/MiniMax-AI) repository
|
| 86 |
+
|
| 87 |
+
We continuously optimize the deployment experience for our models. Feedback is welcome!
|
| 88 |
+
|
docs/vllm_deploy_guide_cn.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MiniMax M2 模型 vLLM 部署指南
|
| 2 |
+
|
| 3 |
+
我们推荐使用 [vLLM](https://docs.vllm.ai/en/stable/) 来部署 [MiniMax-M2](https://huggingface.co/MiniMaxAI/MiniMax-M2) 模型。vLLM 是一个高性能的推理引擎,其具有卓越的服务吞吐、高效智能的内存管理机制、强大的批量请求处理能力、深度优化的底层性能等特性。我们建议在部署之前查看 vLLM 的官方文档以检查硬件兼容性。
|
| 4 |
+
|
| 5 |
+
## 环境要求
|
| 6 |
+
|
| 7 |
+
- OS:Linux
|
| 8 |
+
|
| 9 |
+
- Python:3.9 - 3.12
|
| 10 |
+
|
| 11 |
+
- GPU:
|
| 12 |
+
|
| 13 |
+
- compute capability 7.0 or higher
|
| 14 |
+
|
| 15 |
+
- 显存需求:权重需要 220 GB,每 1M 上下文 token 需要 60 GB
|
| 16 |
+
|
| 17 |
+
以下为推荐配置,实际需求请根据业务场景调整:
|
| 18 |
+
|
| 19 |
+
- 96G x4 GPU:支持 40 万 token 的上下文输入。
|
| 20 |
+
|
| 21 |
+
- 144G x8 GPU:支持长达 300 万 token 的上下文输入。
|
| 22 |
+
|
| 23 |
+
## 使用 Python 部署
|
| 24 |
+
|
| 25 |
+
建议使用虚拟环境(如 venv、conda、uv)以避免依赖冲突。建议在全新的 Python 环境中安装 vLLM:
|
| 26 |
+
```bash
|
| 27 |
+
# 尚未 release,请安装 nightly 构建
|
| 28 |
+
uv pip install -U vllm \
|
| 29 |
+
--torch-backend=auto \
|
| 30 |
+
--extra-index-url https://wheels.vllm.ai/nightly
|
| 31 |
+
# 如果 release,使用 uv 安装
|
| 32 |
+
uv pip install "vllm" --torch-backend=auto
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
运行如下命令启动 vLLM 服务器,vLLM 会自动从 Huggingface 下载并缓存 MiniMax-M2 模型。
|
| 36 |
+
|
| 37 |
+
4 卡部署命令:
|
| 38 |
+
|
| 39 |
+
```bash
|
| 40 |
+
SAFETENSORS_FAST_GPU=1 VLLM_USE_V1=0 vllm serve \
|
| 41 |
+
--model MiniMaxAI/MiniMax-M2 \
|
| 42 |
+
--trust-remote-code \
|
| 43 |
+
--enable-expert-parallel --tensor-parallel-size 4 \
|
| 44 |
+
--enable-auto-tool-choice --tool-call-parser minimax_m2 \
|
| 45 |
+
--reasoning-parser minimax_m2
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
## 测试部署
|
| 49 |
+
|
| 50 |
+
启动后,可以通过如下命令测试 vLLM OpenAI 兼容接口:
|
| 51 |
+
|
| 52 |
+
```bash
|
| 53 |
+
curl http://localhost:8000/v1/chat/completions \
|
| 54 |
+
-H "Content-Type: application/json" \
|
| 55 |
+
-d '{
|
| 56 |
+
"model": "MiniMaxAI/MiniMax-M2",
|
| 57 |
+
"messages": [
|
| 58 |
+
{"role": "system", "content": [{"type": "text", "text": "You are a helpful assistant."}]},
|
| 59 |
+
{"role": "user", "content": [{"type": "text", "text": "Who won the world series in 2020?"}]}
|
| 60 |
+
]
|
| 61 |
+
}'
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
## 常见问题
|
| 65 |
+
|
| 66 |
+
### Huggingface 网络问题
|
| 67 |
+
|
| 68 |
+
如果遇到网络问题,可以设置代理后再进行拉取。
|
| 69 |
+
|
| 70 |
+
```bash
|
| 71 |
+
export HF_ENDPOINT=https://hf-mirror.com
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
### MiniMax-M2 model is not currently supported
|
| 75 |
+
|
| 76 |
+
该 vLLM 版本过旧,请升级到最新版本。
|
| 77 |
+
|
| 78 |
+
## 获取支持
|
| 79 |
+
|
| 80 |
+
如果在部署 MiniMax 模型过程中遇到任何问题:
|
| 81 |
+
|
| 82 |
+
- 通过邮箱 api@minimaxi.com 等官方渠道联系我们的技术支持团队
|
| 83 |
+
|
| 84 |
+
- 在我们的 [GitHub](https://github.com/MiniMax-AI) 仓库提交 Issue
|
| 85 |
+
我们会持续优化模型的部署体验,欢迎反馈!
|
figures/Bench.png
ADDED
|
Git LFS Details
|
generation_config.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9ac66c5295cc65e6b9ace00be407b7281c24533db9d96dcd098afa2af7361ee8
|
| 3 |
+
size 114
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model.safetensors.index.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9734599c8e3e00dbb5612bfe264edae70e2f994696b54ad57f70a1faf7beb251
|
| 3 |
+
size 14057058
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:757622126525aeeb131756849d93298070ff3f0319c455ec8c5bb0f6b1cebbe8
|
| 3 |
+
size 9730160
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:60e392fea8d47660584deb3c6a716aab7b9f11fed24bc494baf5eb7ba809e882
|
| 3 |
+
size 10893
|
vocab.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b44c066b5dc34c800c4e3ecbd85f3e95ce3bfdbf8a5fe30223e005175103578a
|
| 3 |
+
size 4705413
|