Qubitium commited on
Commit
f1b3fcf
·
verified ·
1 Parent(s): f01b831

Add files using upload-large-folder tool

Browse files
Files changed (47) hide show
  1. docs/sglang_deploy_guide.md +118 -0
  2. docs/sglang_deploy_guide_cn.md +115 -0
  3. docs/tool_calling_guide.md +485 -0
  4. docs/tool_calling_guide_cn.md +485 -0
  5. docs/vllm_deploy_guide.md +116 -0
  6. docs/vllm_deploy_guide_cn.md +113 -0
  7. figures/Bench.png +3 -0
  8. merges.txt +0 -0
  9. model-00001-of-00130.safetensors +3 -0
  10. model-00007-of-00130.safetensors +3 -0
  11. model-00010-of-00130.safetensors +3 -0
  12. model-00016-of-00130.safetensors +3 -0
  13. model-00023-of-00130.safetensors +3 -0
  14. model-00025-of-00130.safetensors +3 -0
  15. model-00028-of-00130.safetensors +3 -0
  16. model-00032-of-00130.safetensors +3 -0
  17. model-00034-of-00130.safetensors +3 -0
  18. model-00035-of-00130.safetensors +3 -0
  19. model-00039-of-00130.safetensors +3 -0
  20. model-00043-of-00130.safetensors +3 -0
  21. model-00045-of-00130.safetensors +3 -0
  22. model-00048-of-00130.safetensors +3 -0
  23. model-00052-of-00130.safetensors +3 -0
  24. model-00054-of-00130.safetensors +3 -0
  25. model-00059-of-00130.safetensors +3 -0
  26. model-00061-of-00130.safetensors +3 -0
  27. model-00067-of-00130.safetensors +3 -0
  28. model-00070-of-00130.safetensors +3 -0
  29. model-00076-of-00130.safetensors +3 -0
  30. model-00083-of-00130.safetensors +3 -0
  31. model-00084-of-00130.safetensors +3 -0
  32. model-00085-of-00130.safetensors +3 -0
  33. model-00088-of-00130.safetensors +3 -0
  34. model-00092-of-00130.safetensors +3 -0
  35. model-00094-of-00130.safetensors +3 -0
  36. model-00099-of-00130.safetensors +3 -0
  37. model-00100-of-00130.safetensors +3 -0
  38. model-00101-of-00130.safetensors +3 -0
  39. model-00107-of-00130.safetensors +3 -0
  40. model-00110-of-00130.safetensors +3 -0
  41. model-00116-of-00130.safetensors +3 -0
  42. model-00123-of-00130.safetensors +3 -0
  43. model-00125-of-00130.safetensors +3 -0
  44. model-00128-of-00130.safetensors +3 -0
  45. model.safetensors.index.json +0 -0
  46. tokenizer.json +0 -0
  47. vocab.json +0 -0
docs/sglang_deploy_guide.md ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MiniMax M2 Model SGLang Deployment Guide
2
+
3
+ [English Version](./sglang_deploy_guide.md) | [Chinese Version](./sglang_deploy_guide_cn.md)
4
+
5
+ We recommend using [SGLang](https://github.com/sgl-project/sglang) to deploy the [MiniMax-M2](https://huggingface.co/MiniMaxAI/MiniMax-M2) model. SGLang 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 SGLang's official documentation to check hardware compatibility before deployment.
6
+
7
+ ## Applicable Models
8
+
9
+ This document applies to the following models. You only need to change the model name during deployment.
10
+
11
+ - [MiniMaxAI/MiniMax-M2](https://huggingface.co/MiniMaxAI/MiniMax-M2)
12
+
13
+ The deployment process is illustrated below using MiniMax-M2 as an example.
14
+
15
+ ## System Requirements
16
+
17
+ - OS: Linux
18
+
19
+ - Python: 3.9 - 3.12
20
+
21
+ - GPU:
22
+
23
+ - compute capability 7.0 or higher
24
+
25
+ - Memory requirements: 220 GB for weights, 240 GB per 1M context tokens
26
+
27
+ The following are recommended configurations; actual requirements should be adjusted based on your use case:
28
+
29
+ - 4x 96GB GPUs: Supported context length of up to 400K tokens.
30
+
31
+ - 8x 144GB GPUs: Supported context length of up to 3M tokens.
32
+
33
+ ## Deployment with Python
34
+
35
+ It is recommended to use a virtual environment (such as **venv**, **conda**, or **uv**) to avoid dependency conflicts.
36
+
37
+ We recommend installing SGLang in a fresh Python environment:
38
+
39
+ ```bash
40
+ git clone -b v0.5.4.post1 https://github.com/sgl-project/sglang.git
41
+ cd sglang
42
+
43
+ # Install the python packages
44
+ pip install --upgrade pip
45
+ pip install -e "python"
46
+ ```
47
+
48
+ Run the following command to start the SGLang server. SGLang will automatically download and cache the MiniMax-M2 model from Hugging Face.
49
+
50
+ 4-GPU deployment command:
51
+
52
+ ```bash
53
+ python -m sglang.launch_server \
54
+ --model-path MiniMaxAI/MiniMax-M2 \
55
+ --tp-size 4 \
56
+ --tool-call-parser minimax-m2 \
57
+ --reasoning-parser minimax-append-think \
58
+ --host 0.0.0.0 \
59
+ --trust-remote-code \
60
+ --port 8000 \
61
+ --mem-fraction-static 0.85
62
+ ```
63
+
64
+ 8-GPU deployment command:
65
+
66
+ ```bash
67
+ python -m sglang.launch_server \
68
+ --model-path MiniMaxAI/MiniMax-M2 \
69
+ --tp-size 8 \
70
+ --ep-size 8 \
71
+ --tool-call-parser minimax-m2 \
72
+ --trust-remote-code \
73
+ --host 0.0.0.0 \
74
+ --reasoning-parser minimax-append-think \
75
+ --port 8000 \
76
+ --mem-fraction-static 0.85
77
+ ```
78
+
79
+ ## Testing Deployment
80
+
81
+ After startup, you can test the SGLang OpenAI-compatible API with the following command:
82
+
83
+ ```bash
84
+ curl http://localhost:8000/v1/chat/completions \
85
+ -H "Content-Type: application/json" \
86
+ -d '{
87
+ "model": "MiniMaxAI/MiniMax-M2",
88
+ "messages": [
89
+ {"role": "system", "content": [{"type": "text", "text": "You are a helpful assistant."}]},
90
+ {"role": "user", "content": [{"type": "text", "text": "Who won the world series in 2020?"}]}
91
+ ]
92
+ }'
93
+ ```
94
+
95
+ ## Common Issues
96
+
97
+ ### Hugging Face Network Issues
98
+
99
+ If you encounter network issues, you can set up a proxy before pulling the model.
100
+
101
+ ```bash
102
+ export HF_ENDPOINT=https://hf-mirror.com
103
+ ```
104
+
105
+ ### MiniMax-M2 model is not currently supported
106
+
107
+ Please upgrade to the latest stable version, >= v0.5.4.post3.
108
+
109
+ ## Getting Support
110
+
111
+ If you encounter any issues while deploying the MiniMax model:
112
+
113
+ - Contact our technical support team through official channels such as email at [model@minimax.io](mailto:model@minimax.io)
114
+
115
+ - Submit an issue on our [GitHub](https://github.com/MiniMax-AI) repository
116
+
117
+ We continuously optimize the deployment experience for our models. Feedback is welcome!
118
+
docs/sglang_deploy_guide_cn.md ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MiniMax M2 模型 SGLang 部署指南
2
+
3
+ [英文版](./sglang_deploy_guide.md) | [中文版](./sglang_deploy_guide_cn.md)
4
+
5
+ 我们推荐使用 [SGLang](https://github.com/sgl-project/sglang) 来部署 [MiniMax-M2](https://huggingface.co/MiniMaxAI/MiniMax-M2) 模型。SGLang 是一个高性能的推理引擎,其具有卓越的服务吞吐、高效智能的内存管理机制、强大的批量请求处理能力、深度优化的底层性能等特性。我们建议在部署之前查看 SGLang 的官方文档以检查硬件兼容性。
6
+
7
+ ## 本文档适用模型
8
+
9
+ 本文档适用以下模型,只需在部署时修改模型名称即可。
10
+
11
+ - [MiniMaxAI/MiniMax-M2](https://huggingface.co/MiniMaxAI/MiniMax-M2)
12
+
13
+ 以下以 MiniMax-M2 为例说明部署流程。
14
+
15
+ ## 环境要求
16
+
17
+ - OS:Linux
18
+
19
+ - Python:3.9 - 3.12
20
+
21
+ - GPU:
22
+
23
+ - compute capability 7.0 or higher
24
+
25
+ - 显存需求:权重需要 220 GB,每 1M 上下文 token 需要 240 GB
26
+
27
+ 以下为推荐配置,实际需求请根据业务场景调整:
28
+
29
+ - 96G x4 GPU:支持 40 万 token 的总上下文。
30
+
31
+ - 144G x8 GPU:支持长达 300 万 token 的总上下文。
32
+
33
+ ## 使用 Python 部署
34
+
35
+ 建议使用虚拟环境(如 **venv**、**conda**、**uv**)以避免依赖冲突。
36
+
37
+ 建议在全新的 Python 环境中安装 SGLang:
38
+ ```bash
39
+ git clone -b v0.5.4.post1 https://github.com/sgl-project/sglang.git
40
+ cd sglang
41
+
42
+ # Install the python packages
43
+ pip install --upgrade pip
44
+ pip install -e "python"
45
+ ```
46
+
47
+ 运行如下命令启动 SGLang 服务器,SGLang 会自动从 Huggingface 下载并缓存 MiniMax-M2 模型。
48
+
49
+ 4 卡部署命令:
50
+
51
+ ```bash
52
+ python -m sglang.launch_server \
53
+ --model-path MiniMaxAI/MiniMax-M2 \
54
+ --tp-size 4 \
55
+ --tool-call-parser minimax-m2 \
56
+ --reasoning-parser minimax-append-think \
57
+ --host 0.0.0.0 \
58
+ --trust-remote-code \
59
+ --port 8000 \
60
+ --mem-fraction-static 0.85
61
+ ```
62
+
63
+ 8 卡部署命令:
64
+
65
+ ```bash
66
+ python -m sglang.launch_server \
67
+ --model-path MiniMaxAI/MiniMax-M2 \
68
+ --tp-size 8 \
69
+ --ep-size 8 \
70
+ --tool-call-parser minimax-m2 \
71
+ --trust-remote-code \
72
+ --host 0.0.0.0 \
73
+ --reasoning-parser minimax-append-think \
74
+ --port 8000 \
75
+ --mem-fraction-static 0.85
76
+ ```
77
+
78
+ ## 测试部署
79
+
80
+ 启动后,可以通过如下命令测试 SGLang OpenAI 兼容接口:
81
+
82
+ ```bash
83
+ curl http://localhost:8000/v1/chat/completions \
84
+ -H "Content-Type: application/json" \
85
+ -d '{
86
+ "model": "MiniMaxAI/MiniMax-M2",
87
+ "messages": [
88
+ {"role": "system", "content": [{"type": "text", "text": "You are a helpful assistant."}]},
89
+ {"role": "user", "content": [{"type": "text", "text": "Who won the world series in 2020?"}]}
90
+ ]
91
+ }'
92
+ ```
93
+
94
+ ## 常见问题
95
+
96
+ ### Huggingface 网络问题
97
+
98
+ 如果遇到网络问题,可以设置代理后再进行拉取。
99
+
100
+ ```bash
101
+ export HF_ENDPOINT=https://hf-mirror.com
102
+ ```
103
+
104
+ ### MiniMax-M2 model is not currently supported
105
+
106
+ 请升级到最新的稳定版本, >= v0.5.4.post1.
107
+
108
+ ## 获取支持
109
+
110
+ 如果在部署 MiniMax 模型过程中遇到任何问题:
111
+
112
+ - 通过邮箱 [model@minimax.io](mailto:model@minimax.io) 等官方渠道联系我们的技术支持团队
113
+
114
+ - 在我们的 [GitHub](https://github.com/MiniMax-AI) 仓库提交 Issue
115
+ 我们会持续优化模型的部署体验,欢迎反馈!
docs/tool_calling_guide.md ADDED
@@ -0,0 +1,485 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MiniMax-M2 Tool Calling Guide
2
+
3
+ [English Version](./tool_calling_guide.md) | [Chinese Version](./tool_calling_guide_cn.md)
4
+
5
+ ## Introduction
6
+
7
+ The MiniMax-M2 model supports tool calling capabilities, enabling the model to identify when external tools need to be called and output tool call parameters in a structured format. This document provides detailed instructions on how to use the tool calling features of MiniMax-M2.
8
+
9
+ ## Basic Example
10
+
11
+ The following Python script implements a weather query tool call example based on the OpenAI SDK:
12
+
13
+ ```python
14
+ from openai import OpenAI
15
+ import json
16
+
17
+ client = OpenAI(base_url="http://localhost:8000/v1", api_key="dummy")
18
+
19
+ def get_weather(location: str, unit: str):
20
+ return f"Getting the weather for {location} in {unit}..."
21
+
22
+ tool_functions = {"get_weather": get_weather}
23
+
24
+ tools = [{
25
+ "type": "function",
26
+ "function": {
27
+ "name": "get_weather",
28
+ "description": "Get the current weather in a given location",
29
+ "parameters": {
30
+ "type": "object",
31
+ "properties": {
32
+ "location": {"type": "string", "description": "City and state, e.g., 'San Francisco, CA'"},
33
+ "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
34
+ },
35
+ "required": ["location", "unit"]
36
+ }
37
+ }
38
+ }]
39
+
40
+ response = client.chat.completions.create(
41
+ model=client.models.list().data[0].id,
42
+ messages=[{"role": "user", "content": "What's the weather like in San Francisco? use celsius."}],
43
+ tools=tools,
44
+ tool_choice="auto"
45
+ )
46
+
47
+ print(response)
48
+
49
+ tool_call = response.choices[0].message.tool_calls[0].function
50
+ print(f"Function called: {tool_call.name}")
51
+ print(f"Arguments: {tool_call.arguments}")
52
+ print(f"Result: {get_weather(**json.loads(tool_call.arguments))}")
53
+ ```
54
+
55
+ **Output Example:**
56
+ ```
57
+ Function called: get_weather
58
+ Arguments: {"location": "San Francisco, CA", "unit": "celsius"}
59
+ Result: Getting the weather for San Francisco, CA in celsius...
60
+ ```
61
+
62
+ ## Manually Parsing Model Output
63
+
64
+ **We strongly recommend using vLLM or SGLang for parsing tool calls.** If you cannot use the built-in parser of inference engines (e.g., vLLM and SGLang) 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.
65
+
66
+ ### Example Using Transformers
67
+
68
+ Here is a complete example using the transformers library:
69
+
70
+ ```python
71
+ from transformers import AutoTokenizer
72
+
73
+ def get_default_tools():
74
+ return [
75
+ {
76
+ "name": "get_current_weather",
77
+ "description": "Get the latest weather for a location",
78
+ "parameters": {
79
+ "type": "object",
80
+ "properties": {
81
+ "location": {
82
+ "type": "string",
83
+ "description": "A certain city, such as Beijing, Shanghai"
84
+ }
85
+ },
86
+ }
87
+ "required": ["location"],
88
+ "type": "object"
89
+ }
90
+ ]
91
+
92
+ # Load model and tokenizer
93
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
94
+ prompt = "What's the weather like in Shanghai today?"
95
+ messages = [
96
+ {"role": "system", "content": "You are a helpful assistant."},
97
+ {"role": "user", "content": prompt},
98
+ ]
99
+
100
+ # Enable function calling tools
101
+ tools = get_default_tools()
102
+
103
+ # Apply chat template and include tool definitions
104
+ text = tokenizer.apply_chat_template(
105
+ messages,
106
+ tokenize=False,
107
+ add_generation_prompt=True,
108
+ tools=tools
109
+ )
110
+
111
+ # Send request (using any inference service)
112
+ import requests
113
+ payload = {
114
+ "model": "MiniMaxAI/MiniMax-M2",
115
+ "prompt": text,
116
+ "max_tokens": 4096
117
+ }
118
+ response = requests.post(
119
+ "http://localhost:8000/v1/completions",
120
+ headers={"Content-Type": "application/json"},
121
+ json=payload,
122
+ stream=False,
123
+ )
124
+
125
+ # Model output needs manual parsing
126
+ raw_output = response.json()["choices"][0]["text"]
127
+ print("Raw output:", raw_output)
128
+
129
+ # Use the parsing function below to process the output
130
+ tool_calls = parse_tool_calls(raw_output, tools)
131
+ ```
132
+
133
+ ## 🛠️ Tool Call Definition
134
+
135
+ ### Tool Structure
136
+
137
+ Tool calls need to define the `tools` field in the request body. Each tool consists of the following parts:
138
+
139
+ ```json
140
+ {
141
+ "tools": [
142
+ {
143
+ "name": "search_web",
144
+ "description": "Search function.",
145
+ "parameters": {
146
+ "properties": {
147
+ "query_list": {
148
+ "description": "Keywords for search, list should contain 1 element.",
149
+ "items": { "type": "string" },
150
+ "type": "array"
151
+ },
152
+ "query_tag": {
153
+ "description": "Category of query",
154
+ "items": { "type": "string" },
155
+ "type": "array"
156
+ }
157
+ },
158
+ "required": [ "query_list", "query_tag" ],
159
+ "type": "object"
160
+ }
161
+ }
162
+ ]
163
+ }
164
+ ```
165
+
166
+ **Field Descriptions:**
167
+ - `name`: Function name
168
+ - `description`: Function description
169
+ - `parameters`: Function parameter definition
170
+ - `properties`: Parameter property definition, where key is the parameter name and value contains detailed parameter description
171
+ - `required`: List of required parameters
172
+ - `type`: Parameter type (usually "object")
173
+
174
+ ### Internal Processing Format
175
+
176
+ When processing within the MiniMax-M2 model, tool definitions are converted to a special format and concatenated to the input text. Here is a complete example:
177
+
178
+ ```
179
+ ]~!b[]~b]system
180
+ You are a helpful assistant.
181
+
182
+ # Tools
183
+ You may call one or more tools to assist with the user query.
184
+ Here are the tools available in JSONSchema format:
185
+
186
+ <tools>
187
+ <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>
188
+ </tools>
189
+
190
+ When making tool calls, use XML format to invoke tools and pass parameters:
191
+
192
+ <minimax:tool_call>
193
+ <invoke name="tool-name-1">
194
+ <parameter name="param-key-1">param-value-1</parameter>
195
+ <parameter name="param-key-2">param-value-2</parameter>
196
+ ...
197
+ </invoke>
198
+ [e~[
199
+ ]~b]user
200
+ When were the latest announcements from OpenAI and Gemini?[e~[
201
+ ]~b]ai
202
+ <think>
203
+ ```
204
+
205
+ **Format Description:**
206
+
207
+ - `]~!b[]~b]system`: System message start marker
208
+ - `[e~[`: Message end marker
209
+ - `]~b]user`: User message start marker
210
+ - `]~b]ai`: Assistant message start marker
211
+ - `]~b]tool`: Tool result message start marker
212
+ - `<tools>...</tools>`: Tool definition area, each tool is wrapped with `<tool>` tag, content is JSON Schema
213
+ - `<minimax:tool_call>...</minimax:tool_call>`: Tool call area
214
+ - `<think>...</think>`: Thinking process marker during generation
215
+
216
+ ### Model Output Format
217
+
218
+ MiniMax-M2 uses structured XML tag format:
219
+
220
+ ```xml
221
+ <minimax:tool_call>
222
+ <invoke name="search_web">
223
+ <parameter name="query_tag">["technology", "events"]</parameter>
224
+ <parameter name="query_list">["\"OpenAI\" \"latest\" \"release\""]</parameter>
225
+ </invoke>
226
+ <invoke name="search_web">
227
+ <parameter name="query_tag">["technology", "events"]</parameter>
228
+ <parameter name="query_list">["\"Gemini\" \"latest\" \"release\""]</parameter>
229
+ </invoke>
230
+ </minimax:tool_call>
231
+ ```
232
+
233
+ Each tool call uses the `<invoke name="function_name">` tag, and parameters use the `<parameter name="parameter_name">` tag wrapper.
234
+
235
+ ## Manually Parsing Tool Call Results
236
+
237
+ ### Parsing Tool Calls
238
+
239
+ MiniMax-M2 uses structured XML tags, which require a different parsing approach. The core function is as follows:
240
+
241
+ ```python
242
+ import re
243
+ import json
244
+ from typing import Any, Optional, List, Dict
245
+
246
+
247
+ def extract_name(name_str: str) -> str:
248
+ """Extract name from quoted string"""
249
+ name_str = name_str.strip()
250
+ if name_str.startswith('"') and name_str.endswith('"'):
251
+ return name_str[1:-1]
252
+ elif name_str.startswith("'") and name_str.endswith("'"):
253
+ return name_str[1:-1]
254
+ return name_str
255
+
256
+
257
+ def convert_param_value(value: str, param_type: str) -> Any:
258
+ """Convert parameter value based on parameter type"""
259
+ if value.lower() == "null":
260
+ return None
261
+
262
+ param_type = param_type.lower()
263
+
264
+ if param_type in ["string", "str", "text"]:
265
+ return value
266
+ elif param_type in ["integer", "int"]:
267
+ try:
268
+ return int(value)
269
+ except (ValueError, TypeError):
270
+ return value
271
+ elif param_type in ["number", "float"]:
272
+ try:
273
+ val = float(value)
274
+ return val if val != int(val) else int(val)
275
+ except (ValueError, TypeError):
276
+ return value
277
+ elif param_type in ["boolean", "bool"]:
278
+ return value.lower() in ["true", "1"]
279
+ elif param_type in ["object", "array"]:
280
+ try:
281
+ return json.loads(value)
282
+ except json.JSONDecodeError:
283
+ return value
284
+ else:
285
+ # Try JSON parsing, return string if failed
286
+ try:
287
+ return json.loads(value)
288
+ except json.JSONDecodeError:
289
+ return value
290
+
291
+
292
+ def parse_tool_calls(model_output: str, tools: Optional[List[Dict]] = None) -> List[Dict]:
293
+ """
294
+ Extract all tool calls from model output
295
+
296
+ Args:
297
+ model_output: Complete output text from the model
298
+ tools: Tool definition list for getting parameter type information, format can be:
299
+ - [{"name": "...", "parameters": {...}}]
300
+ - [{"type": "function", "function": {"name": "...", "parameters": {...}}}]
301
+
302
+ Returns:
303
+ Parsed tool call list, each element contains name and arguments fields
304
+
305
+ Example:
306
+ >>> tools = [{
307
+ ... "name": "get_weather",
308
+ ... "parameters": {
309
+ ... "type": "object",
310
+ ... "properties": {
311
+ ... "location": {"type": "string"},
312
+ ... "unit": {"type": "string"}
313
+ ... }
314
+ ... }
315
+ ... }]
316
+ >>> output = '''<minimax:tool_call>
317
+ ... <invoke name="get_weather">
318
+ ... <parameter name="location">San Francisco</parameter>
319
+ ... <parameter name="unit">celsius</parameter>
320
+ ... </invoke>
321
+ ... </minimax:tool_call>'''
322
+ >>> result = parse_tool_calls(output, tools)
323
+ >>> print(result)
324
+ [{'name': 'get_weather', 'arguments': {'location': 'San Francisco', 'unit': 'celsius'}}]
325
+ """
326
+ # Quick check if tool call marker is present
327
+ if "<minimax:tool_call>" not in model_output:
328
+ return []
329
+
330
+ tool_calls = []
331
+
332
+ try:
333
+ # Match all <minimax:tool_call> blocks
334
+ tool_call_regex = re.compile(r"<minimax:tool_call>(.*?)</minimax:tool_call>", re.DOTALL)
335
+ invoke_regex = re.compile(r"<invoke name=(.*?)</invoke>", re.DOTALL)
336
+ parameter_regex = re.compile(r"<parameter name=(.*?)</parameter>", re.DOTALL)
337
+
338
+ # Iterate through all tool_call blocks
339
+ for tool_call_match in tool_call_regex.findall(model_output):
340
+ # Iterate through all invokes in this block
341
+ for invoke_match in invoke_regex.findall(tool_call_match):
342
+ # Extract function name
343
+ name_match = re.search(r'^([^>]+)', invoke_match)
344
+ if not name_match:
345
+ continue
346
+
347
+ function_name = extract_name(name_match.group(1))
348
+
349
+ # Get parameter configuration
350
+ param_config = {}
351
+ if tools:
352
+ for tool in tools:
353
+ tool_name = tool.get("name") or tool.get("function", {}).get("name")
354
+ if tool_name == function_name:
355
+ params = tool.get("parameters") or tool.get("function", {}).get("parameters")
356
+ if isinstance(params, dict) and "properties" in params:
357
+ param_config = params["properties"]
358
+ break
359
+
360
+ # Extract parameters
361
+ param_dict = {}
362
+ for match in parameter_regex.findall(invoke_match):
363
+ param_match = re.search(r'^([^>]+)>(.*)', match, re.DOTALL)
364
+ if param_match:
365
+ param_name = extract_name(param_match.group(1))
366
+ param_value = param_match.group(2).strip()
367
+
368
+ # Remove leading and trailing newlines
369
+ if param_value.startswith('\n'):
370
+ param_value = param_value[1:]
371
+ if param_value.endswith('\n'):
372
+ param_value = param_value[:-1]
373
+
374
+ # Get parameter type and convert
375
+ param_type = "string"
376
+ if param_name in param_config:
377
+ if isinstance(param_config[param_name], dict) and "type" in param_config[param_name]:
378
+ param_type = param_config[param_name]["type"]
379
+
380
+ param_dict[param_name] = convert_param_value(param_value, param_type)
381
+
382
+ tool_calls.append({
383
+ "name": function_name,
384
+ "arguments": param_dict
385
+ })
386
+
387
+ except Exception as e:
388
+ print(f"Failed to parse tool calls: {e}")
389
+ return []
390
+
391
+ return tool_calls
392
+ ```
393
+
394
+ **Usage Example:**
395
+
396
+ ```python
397
+ # Define tools
398
+ tools = [
399
+ {
400
+ "name": "get_weather",
401
+ "parameters": {
402
+ "type": "object",
403
+ "properties": {
404
+ "location": {"type": "string"},
405
+ "unit": {"type": "string"}
406
+ },
407
+ "required": ["location", "unit"]
408
+ }
409
+ }
410
+ ]
411
+
412
+ # Model output
413
+ model_output = """Let me help you query the weather.
414
+ <minimax:tool_call>
415
+ <invoke name="get_weather">
416
+ <parameter name="location">San Francisco</parameter>
417
+ <parameter name="unit">celsius</parameter>
418
+ </invoke>
419
+ </minimax:tool_call>"""
420
+
421
+ # Parse tool calls
422
+ tool_calls = parse_tool_calls(model_output, tools)
423
+
424
+ # Output results
425
+ for call in tool_calls:
426
+ print(f"Function called: {call['name']}")
427
+ print(f"Arguments: {call['arguments']}")
428
+ # Output: Function called: get_weather
429
+ # Arguments: {'location': 'San Francisco', 'unit': 'celsius'}
430
+ ```
431
+
432
+ ### Executing Tool Calls
433
+
434
+ After parsing is complete, you can execute the corresponding tool and construct the return result:
435
+
436
+ ```python
437
+ def execute_function_call(function_name: str, arguments: dict):
438
+ """Execute function call and return result"""
439
+ if function_name == "get_weather":
440
+ location = arguments.get("location", "Unknown location")
441
+ unit = arguments.get("unit", "celsius")
442
+ # Build function execution result
443
+ return {
444
+ "role": "tool",
445
+ "content": [
446
+ {
447
+ "name": function_name,
448
+ "type": "text",
449
+ "text": json.dumps({
450
+ "location": location,
451
+ "temperature": "25",
452
+ "unit": unit,
453
+ "weather": "Sunny"
454
+ }, ensure_ascii=False)
455
+ }
456
+ ]
457
+ }
458
+ elif function_name == "search_web":
459
+ query_list = arguments.get("query_list", [])
460
+ query_tag = arguments.get("query_tag", [])
461
+ # Simulate search results
462
+ return {
463
+ "role": "tool",
464
+ "content": [
465
+ {
466
+ "name": function_name,
467
+ "type": "text",
468
+ "text": f"Search keywords: {query_list}, Category: {query_tag}\nSearch results: Relevant information found"
469
+ }
470
+ ]
471
+ }
472
+
473
+ return None
474
+ ```
475
+
476
+ ### Returning Tool Execution Results to the Model
477
+
478
+ After successfully parsing tool calls, you should add the tool execution results to the conversation history so that the model can access and utilize this information in subsequent interactions. Refer to [chat_template.jinja](https://huggingface.co/MiniMaxAI/MiniMax-M2/blob/main/chat_template.jinja) for concatenation format.
479
+
480
+ ## References
481
+
482
+ - [MiniMax-M2 Model Repository](https://github.com/MiniMax-AI/MiniMax-M2)
483
+ - [vLLM Project Homepage](https://github.com/vllm-project/vllm)
484
+ - [SGLang Project Homepage](https://github.com/sgl-project/sglang)
485
+ - [OpenAI Python SDK](https://github.com/openai/openai-python)
docs/tool_calling_guide_cn.md ADDED
@@ -0,0 +1,485 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MiniMax-M2 工具调用指南
2
+
3
+ [英文版](./tool_calling_guide.md) | [中文版](./tool_calling_guide_cn.md)
4
+
5
+ ## 简介
6
+
7
+ MiniMax-M2 模型支持工具调用功能,使模型能够识别何时需要调用外部工具,并以结构化格式输出工具调用参数。本文档提供了有关如何使用 MiniMax-M2 工具调用功能的详细说明。
8
+
9
+ ## 基础示例
10
+
11
+ 以下 Python 脚本基于 OpenAI SDK 实现了一个天气查询工具调用示例:
12
+
13
+ ```python
14
+ from openai import OpenAI
15
+ import json
16
+
17
+ client = OpenAI(base_url="http://localhost:8000/v1", api_key="dummy")
18
+
19
+ def get_weather(location: str, unit: str):
20
+ return f"Getting the weather for {location} in {unit}..."
21
+
22
+ tool_functions = {"get_weather": get_weather}
23
+
24
+ tools = [{
25
+ "type": "function",
26
+ "function": {
27
+ "name": "get_weather",
28
+ "description": "Get the current weather in a given location",
29
+ "parameters": {
30
+ "type": "object",
31
+ "properties": {
32
+ "location": {"type": "string", "description": "City and state, e.g., 'San Francisco, CA'"},
33
+ "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
34
+ },
35
+ "required": ["location", "unit"]
36
+ }
37
+ }
38
+ }]
39
+
40
+ response = client.chat.completions.create(
41
+ model=client.models.list().data[0].id,
42
+ messages=[{"role": "user", "content": "What's the weather like in San Francisco? use celsius."}],
43
+ tools=tools,
44
+ tool_choice="auto"
45
+ )
46
+
47
+ print(response)
48
+
49
+ tool_call = response.choices[0].message.tool_calls[0].function
50
+ print(f"Function called: {tool_call.name}")
51
+ print(f"Arguments: {tool_call.arguments}")
52
+ print(f"Result: {get_weather(**json.loads(tool_call.arguments))}")
53
+ ```
54
+
55
+ **输出示例:**
56
+ ```
57
+ Function called: get_weather
58
+ Arguments: {"location": "San Francisco, CA", "unit": "celsius"}
59
+ Result: Getting the weather for San Francisco, CA in celsius...
60
+ ```
61
+
62
+ ## 手动解析模型输出
63
+
64
+ **我们强烈建议使用 vLLM 或 SGLnag 来解析工具调用。** 如果您无法使用支持 MiniMax-M2 的推理引擎(如 vLLM 和 SGLang)的内置解析器,或需要使用其他推理框架(如 transformers、TGI 等),您可以使用以下方法手动解析模型的原始输出。这种方法需要您自己解析模型输出的 XML 标签格式。
65
+
66
+ ### 使用 Transformers 的示例
67
+
68
+ 这是一个使用 transformers 库的完整示例:
69
+
70
+ ```python
71
+ from transformers import AutoTokenizer
72
+
73
+ def get_default_tools():
74
+ return [
75
+ {
76
+ "name": "get_current_weather",
77
+ "description": "Get the latest weather for a location",
78
+ "parameters": {
79
+ "type": "object",
80
+ "properties": {
81
+ "location": {
82
+ "type": "string",
83
+ "description": "A certain city, such as Beijing, Shanghai"
84
+ }
85
+ },
86
+ }
87
+ "required": ["location"],
88
+ "type": "object"
89
+ }
90
+ ]
91
+
92
+ # Load model and tokenizer
93
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
94
+ prompt = "What's the weather like in Shanghai today?"
95
+ messages = [
96
+ {"role": "system", "content": "You are a helpful assistant."},
97
+ {"role": "user", "content": prompt},
98
+ ]
99
+
100
+ # Enable function calling tools
101
+ tools = get_default_tools()
102
+
103
+ # Apply chat template and include tool definitions
104
+ text = tokenizer.apply_chat_template(
105
+ messages,
106
+ tokenize=False,
107
+ add_generation_prompt=True,
108
+ tools=tools
109
+ )
110
+
111
+ # Send request (using any inference service)
112
+ import requests
113
+ payload = {
114
+ "model": "MiniMaxAI/MiniMax-M2",
115
+ "prompt": text,
116
+ "max_tokens": 4096
117
+ }
118
+ response = requests.post(
119
+ "http://localhost:8000/v1/completions",
120
+ headers={"Content-Type": "application/json"},
121
+ json=payload,
122
+ stream=False,
123
+ )
124
+
125
+ # Model output needs manual parsing
126
+ raw_output = response.json()["choices"][0]["text"]
127
+ print("Raw output:", raw_output)
128
+
129
+ # Use the parsing function below to process the output
130
+ tool_calls = parse_tool_calls(raw_output, tools)
131
+ ```
132
+
133
+ ## 🛠️ 工具调用定义
134
+
135
+ ### 工具结构
136
+
137
+ 工具调用需要在请求体中定义 `tools` 字段。每个工具由以下部分组成:
138
+
139
+ ```json
140
+ {
141
+ "tools": [
142
+ {
143
+ "name": "search_web",
144
+ "description": "Search function.",
145
+ "parameters": {
146
+ "properties": {
147
+ "query_list": {
148
+ "description": "Keywords for search, list should contain 1 element.",
149
+ "items": { "type": "string" },
150
+ "type": "array"
151
+ },
152
+ "query_tag": {
153
+ "description": "Category of query",
154
+ "items": { "type": "string" },
155
+ "type": "array"
156
+ }
157
+ },
158
+ "required": [ "query_list", "query_tag" ],
159
+ "type": "object"
160
+ }
161
+ }
162
+ ]
163
+ }
164
+ ```
165
+
166
+ **字段说明:**
167
+ - `name`:函数名称
168
+ - `description`:函数描述
169
+ - `parameters`:函数参数定义
170
+ - `properties`:参数属性定义,其中键是参数名称,值包含���细的参数描述
171
+ - `required`:必需参数列表
172
+ - `type`:参数类型(通常为 "object")
173
+
174
+ ### 内部处理格式
175
+
176
+ 在 MiniMax-M2 模型内部处理时,工具定义会被转换为特殊格式并连接到输入文本中。以下是一个完整示例:
177
+
178
+ ```
179
+ ]~!b[]~b]system
180
+ You are a helpful assistant.
181
+
182
+ # Tools
183
+ You may call one or more tools to assist with the user query.
184
+ Here are the tools available in JSONSchema format:
185
+
186
+ <tools>
187
+ <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>
188
+ </tools>
189
+
190
+ When making tool calls, use XML format to invoke tools and pass parameters:
191
+
192
+ <minimax:tool_call>
193
+ <invoke name="tool-name-1">
194
+ <parameter name="param-key-1">param-value-1</parameter>
195
+ <parameter name="param-key-2">param-value-2</parameter>
196
+ ...
197
+ </invoke>
198
+ [e~[
199
+ ]~b]user
200
+ When were the latest announcements from OpenAI and Gemini?[e~[
201
+ ]~b]ai
202
+ <think>
203
+ ```
204
+
205
+ **格式说明:**
206
+
207
+ - `]~!b[]~b]system`:系统消息开始标记
208
+ - `[e~[`:消息结束标记
209
+ - `]~b]user`:用户消息开始标记
210
+ - `]~b]ai`:助手消息开始标记
211
+ - `]~b]tool`:工具结果消息开始标记
212
+ - `<tools>...</tools>`:工具定义区域,每个工具都用 `<tool>` 标签包装,内容为 JSON Schema
213
+ - `<minimax:tool_call>...</minimax:tool_call>`:工具调用区域
214
+ - `<think>...</think>`:生成过程中的思考过程标记
215
+
216
+ ### 模型输出格式
217
+
218
+ MiniMax-M2 使用结构化的 XML 标签格式:
219
+
220
+ ```xml
221
+ <minimax:tool_call>
222
+ <invoke name="search_web">
223
+ <parameter name="query_tag">["technology", "events"]</parameter>
224
+ <parameter name="query_list">["\"OpenAI\" \"latest\" \"release\""]</parameter>
225
+ </invoke>
226
+ <invoke name="search_web">
227
+ <parameter name="query_tag">["technology", "events"]</parameter>
228
+ <parameter name="query_list">["\"Gemini\" \"latest\" \"release\""]</parameter>
229
+ </invoke>
230
+ </minimax:tool_call>
231
+ ```
232
+
233
+ 每个工具调用使用 `<invoke name="function_name">` 标签,参数使用 `<parameter name="parameter_name">` 标签包装。
234
+
235
+ ## 手动解析工具调用结果
236
+
237
+ ### 解析工具调用
238
+
239
+ MiniMax-M2 使用结构化的 XML 标签,这需要一种不同的解析方法。核心函数如下:
240
+
241
+ ```python
242
+ import re
243
+ import json
244
+ from typing import Any, Optional, List, Dict
245
+
246
+
247
+ def extract_name(name_str: str) -> str:
248
+ """Extract name from quoted string"""
249
+ name_str = name_str.strip()
250
+ if name_str.startswith('"') and name_str.endswith('"'):
251
+ return name_str[1:-1]
252
+ elif name_str.startswith("'") and name_str.endswith("'"):
253
+ return name_str[1:-1]
254
+ return name_str
255
+
256
+
257
+ def convert_param_value(value: str, param_type: str) -> Any:
258
+ """Convert parameter value based on parameter type"""
259
+ if value.lower() == "null":
260
+ return None
261
+
262
+ param_type = param_type.lower()
263
+
264
+ if param_type in ["string", "str", "text"]:
265
+ return value
266
+ elif param_type in ["integer", "int"]:
267
+ try:
268
+ return int(value)
269
+ except (ValueError, TypeError):
270
+ return value
271
+ elif param_type in ["number", "float"]:
272
+ try:
273
+ val = float(value)
274
+ return val if val != int(val) else int(val)
275
+ except (ValueError, TypeError):
276
+ return value
277
+ elif param_type in ["boolean", "bool"]:
278
+ return value.lower() in ["true", "1"]
279
+ elif param_type in ["object", "array"]:
280
+ try:
281
+ return json.loads(value)
282
+ except json.JSONDecodeError:
283
+ return value
284
+ else:
285
+ # Try JSON parsing, return string if failed
286
+ try:
287
+ return json.loads(value)
288
+ except json.JSONDecodeError:
289
+ return value
290
+
291
+
292
+ def parse_tool_calls(model_output: str, tools: Optional[List[Dict]] = None) -> List[Dict]:
293
+ """
294
+ Extract all tool calls from model output
295
+
296
+ Args:
297
+ model_output: Complete output text from the model
298
+ tools: Tool definition list for getting parameter type information, format can be:
299
+ - [{"name": "...", "parameters": {...}}]
300
+ - [{"type": "function", "function": {"name": "...", "parameters": {...}}}]
301
+
302
+ Returns:
303
+ Parsed tool call list, each element contains name and arguments fields
304
+
305
+ Example:
306
+ >>> tools = [{
307
+ ... "name": "get_weather",
308
+ ... "parameters": {
309
+ ... "type": "object",
310
+ ... "properties": {
311
+ ... "location": {"type": "string"},
312
+ ... "unit": {"type": "string"}
313
+ ... }
314
+ ... }
315
+ ... }]
316
+ >>> output = '''<minimax:tool_call>
317
+ ... <invoke name="get_weather">
318
+ ... <parameter name="location">San Francisco</parameter>
319
+ ... <parameter name="unit">celsius</parameter>
320
+ ... </invoke>
321
+ ... </minimax:tool_call>'''
322
+ >>> result = parse_tool_calls(output, tools)
323
+ >>> print(result)
324
+ [{'name': 'get_weather', 'arguments': {'location': 'San Francisco', 'unit': 'celsius'}}]
325
+ """
326
+ # Quick check if tool call marker is present
327
+ if "<minimax:tool_call>" not in model_output:
328
+ return []
329
+
330
+ tool_calls = []
331
+
332
+ try:
333
+ # Match all <minimax:tool_call> blocks
334
+ tool_call_regex = re.compile(r"<minimax:tool_call>(.*?)</minimax:tool_call>", re.DOTALL)
335
+ invoke_regex = re.compile(r"<invoke name=(.*?)</invoke>", re.DOTALL)
336
+ parameter_regex = re.compile(r"<parameter name=(.*?)</parameter>", re.DOTALL)
337
+
338
+ # Iterate through all tool_call blocks
339
+ for tool_call_match in tool_call_regex.findall(model_output):
340
+ # Iterate through all invokes in this block
341
+ for invoke_match in invoke_regex.findall(tool_call_match):
342
+ # Extract function name
343
+ name_match = re.search(r'^([^>]+)', invoke_match)
344
+ if not name_match:
345
+ continue
346
+
347
+ function_name = extract_name(name_match.group(1))
348
+
349
+ # Get parameter configuration
350
+ param_config = {}
351
+ if tools:
352
+ for tool in tools:
353
+ tool_name = tool.get("name") or tool.get("function", {}).get("name")
354
+ if tool_name == function_name:
355
+ params = tool.get("parameters") or tool.get("function", {}).get("parameters")
356
+ if isinstance(params, dict) and "properties" in params:
357
+ param_config = params["properties"]
358
+ break
359
+
360
+ # Extract parameters
361
+ param_dict = {}
362
+ for match in parameter_regex.findall(invoke_match):
363
+ param_match = re.search(r'^([^>]+)>(.*)', match, re.DOTALL)
364
+ if param_match:
365
+ param_name = extract_name(param_match.group(1))
366
+ param_value = param_match.group(2).strip()
367
+
368
+ # Remove leading and trailing newlines
369
+ if param_value.startswith('\n'):
370
+ param_value = param_value[1:]
371
+ if param_value.endswith('\n'):
372
+ param_value = param_value[:-1]
373
+
374
+ # Get parameter type and convert
375
+ param_type = "string"
376
+ if param_name in param_config:
377
+ if isinstance(param_config[param_name], dict) and "type" in param_config[param_name]:
378
+ param_type = param_config[param_name]["type"]
379
+
380
+ param_dict[param_name] = convert_param_value(param_value, param_type)
381
+
382
+ tool_calls.append({
383
+ "name": function_name,
384
+ "arguments": param_dict
385
+ })
386
+
387
+ except Exception as e:
388
+ print(f"Failed to parse tool calls: {e}")
389
+ return []
390
+
391
+ return tool_calls
392
+ ```
393
+
394
+ **使用示例:**
395
+
396
+ ```python
397
+ # Define tools
398
+ tools = [
399
+ {
400
+ "name": "get_weather",
401
+ "parameters": {
402
+ "type": "object",
403
+ "properties": {
404
+ "location": {"type": "string"},
405
+ "unit": {"type": "string"}
406
+ },
407
+ "required": ["location", "unit"]
408
+ }
409
+ }
410
+ ]
411
+
412
+ # Model output
413
+ model_output = """Let me help you query the weather.
414
+ <minimax:tool_call>
415
+ <invoke name="get_weather">
416
+ <parameter name="location">San Francisco</parameter>
417
+ <parameter name="unit">celsius</parameter>
418
+ </invoke>
419
+ </minimax:tool_call>"""
420
+
421
+ # Parse tool calls
422
+ tool_calls = parse_tool_calls(model_output, tools)
423
+
424
+ # Output results
425
+ for call in tool_calls:
426
+ print(f"Function called: {call['name']}")
427
+ print(f"Arguments: {call['arguments']}")
428
+ # Output: Function called: get_weather
429
+ # Arguments: {'location': 'San Francisco', 'unit': 'celsius'}
430
+ ```
431
+
432
+ ### 执行工具调用
433
+
434
+ 完成解析后,您可以执行相应的工具并构造返回结果:
435
+
436
+ ```python
437
+ def execute_function_call(function_name: str, arguments: dict):
438
+ """Execute function call and return result"""
439
+ if function_name == "get_weather":
440
+ location = arguments.get("location", "Unknown location")
441
+ unit = arguments.get("unit", "celsius")
442
+ # Build function execution result
443
+ return {
444
+ "role": "tool",
445
+ "content": [
446
+ {
447
+ "name": function_name,
448
+ "type": "text",
449
+ "text": json.dumps({
450
+ "location": location,
451
+ "temperature": "25",
452
+ "unit": unit,
453
+ "weather": "Sunny"
454
+ }, ensure_ascii=False)
455
+ }
456
+ ]
457
+ }
458
+ elif function_name == "search_web":
459
+ query_list = arguments.get("query_list", [])
460
+ query_tag = arguments.get("query_tag", [])
461
+ # Simulate search results
462
+ return {
463
+ "role": "tool",
464
+ "content": [
465
+ {
466
+ "name": function_name,
467
+ "type": "text",
468
+ "text": f"Search keywords: {query_list}, Category: {query_tag}\nSearch results: Relevant information found"
469
+ }
470
+ ]
471
+ }
472
+
473
+ return None
474
+ ```
475
+
476
+ ### 将工具执行结果返回给模型
477
+
478
+ 在成功解析工具调用后,您应该将工具执行结果添加到对话历史中,以便模型在后续交互中可以访问和利用这些信息。请参考 [chat_template.jinja](https://huggingface.co/MiniMaxAI/MiniMax-M2/blob/main/chat_template.jinja) 了解连接格式。
479
+
480
+ ## 参考文献
481
+
482
+ - [MiniMax-M2 模型仓库](https://github.com/MiniMax-AI/MiniMax-M2)
483
+ - [vLLM 项目主页](https://github.com/vllm-project/vllm)
484
+ - [SGLang 项目主页](https://github.com/sgl-project/sglang)
485
+ - [OpenAI Python SDK](https://github.com/openai/openai-python)
docs/vllm_deploy_guide.md ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MiniMax M2 Model vLLM Deployment Guide
2
+
3
+ [English Version](./vllm_deploy_guide.md) | [Chinese Version](./vllm_deploy_guide_cn.md)
4
+
5
+ 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.
6
+
7
+ ## Applicable Models
8
+
9
+ This document applies to the following models. You only need to change the model name during deployment.
10
+
11
+ - [MiniMaxAI/MiniMax-M2](https://huggingface.co/MiniMaxAI/MiniMax-M2)
12
+
13
+ The deployment process is illustrated below using MiniMax-M2 as an example.
14
+
15
+ ## System Requirements
16
+
17
+ - OS: Linux
18
+
19
+ - Python: 3.9 - 3.12
20
+
21
+ - GPU:
22
+
23
+ - compute capability 7.0 or higher
24
+
25
+ - Memory requirements: 220 GB for weights, 240 GB per 1M context tokens
26
+
27
+ The following are recommended configurations; actual requirements should be adjusted based on your use case:
28
+
29
+ - 4x 96GB GPUs: Supported context length of up to 400K tokens.
30
+
31
+ - 8x 144GB GPUs: Supported context length of up to 3M tokens.
32
+
33
+ ## Deployment with Python
34
+
35
+ It is recommended to use a virtual environment (such as **venv**, **conda**, or **uv**) to avoid dependency conflicts.
36
+
37
+ We recommend installing vLLM in a fresh Python environment:
38
+
39
+ ```bash
40
+ uv pip install 'triton-kernels @ git+https://github.com/triton-lang/triton.git@v3.5.0#subdirectory=python/triton_kernels' vllm --extra-index-url https://wheels.vllm.ai/nightly --prerelease=allow
41
+ ```
42
+
43
+ Run the following command to start the vLLM server. vLLM will automatically download and cache the MiniMax-M2 model from Hugging Face.
44
+
45
+ 4-GPU deployment command:
46
+
47
+ ```bash
48
+ SAFETENSORS_FAST_GPU=1 vllm serve \
49
+ MiniMaxAI/MiniMax-M2 --trust-remote-code \
50
+ --tensor-parallel-size 4 \
51
+ --enable-auto-tool-choice --tool-call-parser minimax_m2 \
52
+ --reasoning-parser minimax_m2_append_think
53
+ ```
54
+
55
+ 8-GPU deployment command:
56
+
57
+ ```bash
58
+ SAFETENSORS_FAST_GPU=1 vllm serve \
59
+ MiniMaxAI/MiniMax-M2 --trust-remote-code \
60
+ --enable_expert_parallel --tensor-parallel-size 8 \
61
+ --enable-auto-tool-choice --tool-call-parser minimax_m2 \
62
+ --reasoning-parser minimax_m2_append_think
63
+ ```
64
+
65
+ ## Testing Deployment
66
+
67
+ After startup, you can test the vLLM OpenAI-compatible API with the following command:
68
+
69
+ ```bash
70
+ curl http://localhost:8000/v1/chat/completions \
71
+ -H "Content-Type: application/json" \
72
+ -d '{
73
+ "model": "MiniMaxAI/MiniMax-M2",
74
+ "messages": [
75
+ {"role": "system", "content": [{"type": "text", "text": "You are a helpful assistant."}]},
76
+ {"role": "user", "content": [{"type": "text", "text": "Who won the world series in 2020?"}]}
77
+ ]
78
+ }'
79
+ ```
80
+
81
+ ## Common Issues
82
+
83
+ ### Hugging Face Network Issues
84
+
85
+ If you encounter network issues, you can set up a proxy before pulling the model.
86
+
87
+ ```bash
88
+ export HF_ENDPOINT=https://hf-mirror.com
89
+ ```
90
+
91
+ ### MiniMax-M2 model is not currently supported
92
+
93
+ This vLLM version is outdated. Please upgrade to the latest version.
94
+
95
+ ### torch.AcceleratorError: CUDA error: an illegal memory access was encountered
96
+ Add `--compilation-config "{\"cudagraph_mode\": \"PIECEWISE\"}"` to the startup parameters to resolve this issue. For example:
97
+
98
+ ```bash
99
+ SAFETENSORS_FAST_GPU=1 vllm serve \
100
+ MiniMaxAI/MiniMax-M2 --trust-remote-code \
101
+ --enable_expert_parallel --tensor-parallel-size 8 \
102
+ --enable-auto-tool-choice --tool-call-parser minimax_m2 \
103
+ --reasoning-parser minimax_m2_append_think \
104
+ --compilation-config "{\"cudagraph_mode\": \"PIECEWISE\"}"
105
+ ```
106
+
107
+ ## Getting Support
108
+
109
+ If you encounter any issues while deploying the MiniMax model:
110
+
111
+ - Contact our technical support team through official channels such as email at [model@minimax.io](mailto:model@minimax.io)
112
+
113
+ - Submit an issue on our [GitHub](https://github.com/MiniMax-AI) repository
114
+
115
+ We continuously optimize the deployment experience for our models. Feedback is welcome!
116
+
docs/vllm_deploy_guide_cn.md ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MiniMax M2 模型 vLLM 部署指南
2
+
3
+ [英文版](./vllm_deploy_guide.md) | [中文版](./vllm_deploy_guide_cn.md)
4
+
5
+ 我们推荐使用 [vLLM](https://docs.vllm.ai/en/stable/) 来部署 [MiniMax-M2](https://huggingface.co/MiniMaxAI/MiniMax-M2) 模型。vLLM 是一个高性能的推理引擎,其具有卓越的服务吞吐、高效智能的内存管理机制、强大的批量请求处理能力、深度优化的底层性能等特性。我们建议在部署之前查看 vLLM 的官方文档以检查硬件兼容性。
6
+
7
+ ## 本文档适用模型
8
+
9
+ 本文档适用以下模型,只需在部署时修改模型名称即可。
10
+
11
+ - [MiniMaxAI/MiniMax-M2](https://huggingface.co/MiniMaxAI/MiniMax-M2)
12
+
13
+ 以下以 MiniMax-M2 为例说明部署流程。
14
+
15
+ ## 环境要求
16
+
17
+ - OS:Linux
18
+
19
+ - Python:3.9 - 3.12
20
+
21
+ - GPU:
22
+
23
+ - compute capability 7.0 or higher
24
+
25
+ - 显存需求:权重需要 220 GB,每 1M 上下文 token 需要 240 GB
26
+
27
+ 以下为推荐配置,实际需求请根据业务场景调整:
28
+
29
+ - 96G x4 GPU:支持 40 万 token 的总上下文。
30
+
31
+ - 144G x8 GPU:支持长达 300 万 token 的总上下文。
32
+
33
+ ## 使用 Python 部署
34
+
35
+ 建议使用虚拟环境(如 **venv**、**conda**、**uv**)以避免依赖冲突。
36
+
37
+ 建议在全新的 Python 环境中安装 vLLM:
38
+ ```bash
39
+ uv pip install 'triton-kernels @ git+https://github.com/triton-lang/triton.git@v3.5.0#subdirectory=python/triton_kernels' vllm --extra-index-url https://wheels.vllm.ai/nightly --prerelease=allow
40
+ ```
41
+
42
+ 运行如下命令启动 vLLM 服务器,vLLM 会自动从 Huggingface 下载并缓存 MiniMax-M2 模型。
43
+
44
+ 4 卡部署命令:
45
+
46
+ ```bash
47
+ SAFETENSORS_FAST_GPU=1 vllm serve \
48
+ MiniMaxAI/MiniMax-M2 --trust-remote-code \
49
+ --tensor-parallel-size 4 \
50
+ --enable-auto-tool-choice --tool-call-parser minimax_m2 \
51
+ --reasoning-parser minimax_m2_append_think
52
+ ```
53
+
54
+ 8 卡部署命令:
55
+
56
+ ```bash
57
+ SAFETENSORS_FAST_GPU=1 vllm serve \
58
+ MiniMaxAI/MiniMax-M2 --trust-remote-code \
59
+ --enable_expert_parallel --tensor-parallel-size 8 \
60
+ --enable-auto-tool-choice --tool-call-parser minimax_m2 \
61
+ --reasoning-parser minimax_m2_append_think
62
+ ```
63
+
64
+ ## 测试部署
65
+
66
+ 启动后,可以通过如下命令测试 vLLM OpenAI 兼容接口:
67
+
68
+ ```bash
69
+ curl http://localhost:8000/v1/chat/completions \
70
+ -H "Content-Type: application/json" \
71
+ -d '{
72
+ "model": "MiniMaxAI/MiniMax-M2",
73
+ "messages": [
74
+ {"role": "system", "content": [{"type": "text", "text": "You are a helpful assistant."}]},
75
+ {"role": "user", "content": [{"type": "text", "text": "Who won the world series in 2020?"}]}
76
+ ]
77
+ }'
78
+ ```
79
+
80
+ ## 常见问题
81
+
82
+ ### Huggingface 网络问题
83
+
84
+ 如果遇到网络问题,可以设置代理后再进行拉取。
85
+
86
+ ```bash
87
+ export HF_ENDPOINT=https://hf-mirror.com
88
+ ```
89
+
90
+ ### MiniMax-M2 model is not currently supported
91
+
92
+ 该 vLLM 版本过旧,请升级到最新版本。
93
+
94
+ ### torch.AcceleratorError: CUDA error: an illegal memory access was encountered
95
+ 在启动参数添加 `--compilation-config "{\"cudagraph_mode\": \"PIECEWISE\"}"` 可以解决。例如:
96
+
97
+ ```bash
98
+ SAFETENSORS_FAST_GPU=1 vllm serve \
99
+ MiniMaxAI/MiniMax-M2 --trust-remote-code \
100
+ --enable_expert_parallel --tensor-parallel-size 8 \
101
+ --enable-auto-tool-choice --tool-call-parser minimax_m2 \
102
+ --reasoning-parser minimax_m2_append_think \
103
+ --compilation-config "{\"cudagraph_mode\": \"PIECEWISE\"}"
104
+ ```
105
+
106
+ ## 获取支持
107
+
108
+ 如果在部署 MiniMax 模型过程中遇到任何问题:
109
+
110
+ - 通过邮箱 [model@minimax.io](mailto:model@minimax.io) 等官方渠道联系我们的技术支持团队
111
+
112
+ - 在我们的 [GitHub](https://github.com/MiniMax-AI) 仓库提交 Issue
113
+ 我们会持续优化模型的部署体验,欢迎反馈!
figures/Bench.png ADDED

Git LFS Details

  • SHA256: e39fcd28e1096c62fad03588c9191d8ef6cc4889bbe1c867fb705cc2030d738b
  • Pointer size: 132 Bytes
  • Size of remote file: 1.05 MB
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model-00001-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:78cb871980746e67097f87e6db7815fd235524ec5da2870566ac5ea47647d408
3
+ size 2416280192
model-00007-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6f93a642deacc28ec1e00634dad58c0b2387bf183c0a68a42a41e63be7be683f
3
+ size 2416280192
model-00010-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:36175074394babb1dd8e279773acc497d16ee31e7f8c53290563be0fbfcbf83d
3
+ size 4923826936
model-00016-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:45efd9fd7b4afa28a1b3ab2427872847d94fbaf37b5e94affb10fe0dbcd5d91a
3
+ size 4923826936
model-00023-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9e581a6fde407121c3de96c5b03d1eec15b25e72726415b3b325152f67158eed
3
+ size 2416280704
model-00025-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:10ff835e9f8fd1c7fe60cbab437b44eff305f056712d6f6b09417d65caf7c00f
3
+ size 2416280704
model-00028-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0b93cf594432b261aa3a289116a693f31b0c235bf97d6f6a8892ec86cd5018a5
3
+ size 4923827976
model-00032-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a361d1a36f576df52051680650a7f0508b5abaa5a254200f90bcdb370d459eb
3
+ size 4923827976
model-00034-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5074eaf188bb7cbe574fa4aec108a63efd93c24d27e156b1516faf2d7dcc6a9e
3
+ size 4923827976
model-00035-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c20b0ad83c7441747a3e26d35e93c21903d271b6ac6414db80ebd40acaadd0d2
3
+ size 2416280704
model-00039-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e82fa4c7f0e8358278f7c29c63b12ea1a6ea22cbacf129b67d95fede7c6cc3b6
3
+ size 2416280704
model-00043-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5bf7c9c0a75f41833a2dcd8fea36a5be4b853a165278d5a0f4c70a69ac408f7a
3
+ size 2416280704
model-00045-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a3f0055ac5f8935b28d263ba4f02588bf82f3d9d60a5a907635243eb6fee2182
3
+ size 2416280704
model-00048-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5012d2b83f19ddcc2b926d3f09fdd52c87595bc73fd3fa7f87f07388b49e2712
3
+ size 4923827976
model-00052-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3d2e75080d79e467692d3fe79bbda2a80707ce07d03329bb8febb62ed3d80fbd
3
+ size 4923827976
model-00054-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6f5638b1d75a7c1d9c2c65ff4e4c6c020e2849d2c5c3853ad8d2dbb1c0744a4d
3
+ size 4923827976
model-00059-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:950fe4fea42aefe84d67a1ba9a0519f3e9c9456dc35c0a894c959e993144a590
3
+ size 2416280704
model-00061-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:00109c7103e60e9ceda59ccd72d330d5b382f1dd9071623c2e6254e953706ced
3
+ size 2416280704
model-00067-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:66ff0676d8de91b00712172367b2675f1ff24e392b43951fab99bcf293613d45
3
+ size 2416280704
model-00070-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4bf7f63f8b037fad90ae6065ce41a81de09b7514faee3bdaaad1d2d07b444ea7
3
+ size 4923827976
model-00076-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6b46107fd62f7184377e25c107c25f68b572aa5d2475cb5ecc079f8fc2ef26b4
3
+ size 4923827976
model-00083-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:273f4935c5f1f3c7ede4e2ceaf1ee3ed8e45eadaabd95e44fb045c7a1a197eeb
3
+ size 2416280704
model-00084-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:09c2223c4b8b51352e5bc77d38329e6adbab747a550740955cf502d9a9dde428
3
+ size 4923827976
model-00085-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e787df2c557f295e966deec3efb3697bd305a24edf6031cec970c286361bcb22
3
+ size 2416280704
model-00088-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:09311b7686c99721745132e929d5031ba571e2388f81b97adf6a44b761d92ac1
3
+ size 4923827976
model-00092-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac8de5b391b68bbc76c310ca189d58a4747ae7808cc7f417fbe2d5e5f3b46a78
3
+ size 4923827976
model-00094-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6d42394f9c3d70eb4085b652a921e095240837eb6c872e106fb78f102abfda49
3
+ size 4923827976
model-00099-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2a9ce359ecf891ca74f995fc833b5da953ecad9d800bdbf60a563219ec4ec11b
3
+ size 2416280704
model-00100-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:657f2d72b39bf2e65102a1369ef820adedee74d261a493078c11e454a66a8e2e
3
+ size 4923827976
model-00101-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:235584dfd811daf8ae1de292fbb7ba7b7b9e0b438755b5f956f569cb4a7dfb5e
3
+ size 2416280704
model-00107-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e70443fc3950f9eef373f2e3e6c40ac54c12401e6374ea5130dcc979a4841214
3
+ size 2416280704
model-00110-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a83c696a929a7f987ae74bdded5411c41aee71465a5fe09e1856acc3b64f577f
3
+ size 4923827976
model-00116-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f3c98bf8a16a5832bb451c35fcf1778652b114e6e5e814a67c8e979c7b8f6e83
3
+ size 4923827976
model-00123-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b54f802cfe151c83fcf972c97bddd8cd3d9327cbde6a26758664478b2299aedf
3
+ size 2416280704
model-00125-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:60d95b10b6e140a9626a7058d5038528f2ff80148dc4569b881db56052046509
3
+ size 40
model-00128-of-00130.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:60d95b10b6e140a9626a7058d5038528f2ff80148dc4569b881db56052046509
3
+ size 40
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
vocab.json ADDED
The diff for this file is too large to render. See raw diff