-
Notifications
You must be signed in to change notification settings - Fork 740
[Feature]【Hackathon 10th Spring No.47】Add MiniMax-M1 model for FastDeploy #7510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bobby-cloudforge
wants to merge
2
commits into
PaddlePaddle:develop
Choose a base branch
from
CloudForge-Solutions:task/h10-047-minimax-m1-model1
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| [简体中文](../zh/best_practices/MiniMax-M1.md) | ||
|
|
||
| # MiniMax-M1 Model | ||
|
|
||
| ## I. Environment Preparation | ||
|
|
||
| ### 1.1 Support Requirements | ||
|
|
||
| MiniMax-M1 support in FastDeploy uses a hybrid decoder stack. Details: | ||
|
|
||
| - Standard full-attention layers run through the existing FastDeploy attention backend. | ||
| - Linear-attention layers use the Lightning Attention Triton kernels in `fastdeploy/model_executor/ops/triton_ops/lightning_attn.py`. | ||
| - Current first-pass support targets BF16 inference. | ||
|
|
||
| ### 1.2 Installing FastDeploy | ||
|
|
||
| Installation process reference document [FastDeploy GPU Installation](../get_started/installation/nvidia_gpu.md) | ||
|
|
||
| ## II. How to Use | ||
|
|
||
| ### 2.1 Basics: Starting the Service | ||
|
|
||
| ```shell | ||
| MODEL_PATH=/models/MiniMax-Text-01 | ||
|
|
||
| python -m fastdeploy.entrypoints.openai.api_server \ | ||
| --model "$MODEL_PATH" \ | ||
| --port 8180 \ | ||
| --metrics-port 8181 \ | ||
| --engine-worker-queue-port 8182 \ | ||
| --max-model-len 32768 \ | ||
| --max-num-seqs 32 | ||
| ``` | ||
|
|
||
| ### 2.2 Model Notes | ||
|
|
||
| - HuggingFace architecture: `MiniMaxText01ForCausalLM` | ||
| - Hybrid layer layout: 70 linear-attention layers and 10 full-attention layers | ||
| - MoE routing: 32 experts, top-2 experts per token | ||
|
|
||
| ## III. Known Limitations | ||
|
|
||
| - This initial integration is focused on model structure and backend wiring. | ||
| - Linear attention KV history uses instance variables, which needs migration to slot-based cache for proper multi-request isolation (TODO already noted in code). | ||
| - Low-bit quantization support still requires follow-up validation against MiniMax-M1 weights. | ||
| - Production validation should include GPU runtime checks for Lightning Attention decode/prefill paths. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| [English](../../best_practices/MiniMax-M1.md) | ||
|
|
||
| # MiniMax-M1 模型 | ||
|
|
||
| ## 一、环境准备 | ||
|
|
||
| ### 1.1 支持说明 | ||
|
|
||
| FastDeploy 中的 MiniMax-M1 模型采用混合解码器结构: | ||
|
|
||
| - 全注意力层复用 FastDeploy 现有 Attention 后端。 | ||
| - 线性注意力层使用 `fastdeploy/model_executor/ops/triton_ops/lightning_attn.py` 中的 Lightning Attention Triton kernel。 | ||
| - 当前首版支持以 BF16 推理为主。 | ||
|
|
||
| ### 1.2 安装 FastDeploy | ||
|
|
||
| 安装流程可参考 [FastDeploy GPU 安装文档](../get_started/installation/nvidia_gpu.md) | ||
|
|
||
| ## 二、使用方式 | ||
|
|
||
| ### 2.1 基础启动命令 | ||
|
|
||
| ```shell | ||
| MODEL_PATH=/models/MiniMax-Text-01 | ||
|
|
||
| python -m fastdeploy.entrypoints.openai.api_server \ | ||
| --model "$MODEL_PATH" \ | ||
| --port 8180 \ | ||
| --metrics-port 8181 \ | ||
| --engine-worker-queue-port 8182 \ | ||
| --max-model-len 32768 \ | ||
| --max-num-seqs 32 | ||
| ``` | ||
|
|
||
| ### 2.2 模型特性 | ||
|
|
||
| - HuggingFace 架构名:`MiniMaxText01ForCausalLM` | ||
| - 层类型分布:70 层线性注意力 + 10 层全注意力 | ||
| - MoE 路由:32 个专家,每个 token 选择 top-2 专家 | ||
|
|
||
| ## 三、当前限制 | ||
|
|
||
| - 当前版本优先完成模型组网与后端接线。 | ||
| - 线性注意力的 KV history 当前使用实例变量存储,多请求并发场景下需迁移至 slot-based cache(已有 TODO 标注)。 | ||
| - 各类低比特量化推理能力还需要结合真实权重进一步验证。 | ||
| - Lightning Attention 的 prefill/decode 路径仍需在 GPU 环境完成端到端验证。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ 疑问 MiniMax-M1 的全注意力层复用了
QwenRotaryEmbedding,请确认 MiniMax-M1 的 RoPE 实现与 Qwen 系列完全兼容(包括rope_theta、rope_scaling等参数处理方式)。另外,
architecture.startswith("MiniMax")匹配范围较广,未来若有其他 MiniMax 架构使用不同 RoPE 实现,建议使用更精确的匹配(如architecture in ("MiniMaxM1ForCausalLM", "MiniMaxText01ForCausalLM"))。