-
Notifications
You must be signed in to change notification settings - Fork 285
support Deepseek3.2 #1103
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
base: main
Are you sure you want to change the base?
support Deepseek3.2 #1103
Conversation
Summary of ChangesHello @sufubao, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request integrates the Deepseek3.2 model into the system, extending the existing Deepseek2 framework. The changes involve significant architectural additions to support Deepseek3.2's distinct attention mechanism and FP8 quantization, ensuring efficient inference. This includes new data structures for managing attention states, specialized memory allocation, and highly optimized Triton kernels for core computational tasks. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces support for the Deepseek3.2 model. The changes are extensive, including new model classes, layer inference logic, weight structures, memory managers, and several custom Triton kernels to handle the model's specific architecture, such as the NSA indexer. The review identified a few issues: a critical import error that would cause a runtime failure, an incorrect model registration that would prevent the new model from being used, a commented-out autotune call that could affect performance, and some non-English comments that impact code maintainability. Overall, the changes are substantial and add significant new functionality.
lightllm/models/deepseek2/model.py
Outdated
|
|
||
|
|
||
| @ModelRegistry(["deepseek_v2", "deepseek_v3"]) | ||
| @ModelRegistry(["deepseek_v2", "deepseek_v3", "deepseek_v32"]) |
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.
The model name "deepseek_v32" is being registered to the Deepseek2TpPartModel class. This seems incorrect as it's for the new Deepseek3.2 model. The new Deepseek3_2TpPartModel class in lightllm/models/deepseek3_2/model.py should be registered for this model name instead. Please revert this change.
| @ModelRegistry(["deepseek_v2", "deepseek_v3", "deepseek_v32"]) | |
| @ModelRegistry(["deepseek_v2", "deepseek_v3"]) |
lightllm/models/deepseek3_2/model.py
Outdated
| from lightllm.utils.envs_utils import get_env_start_args | ||
| from lightllm.models.deepseek3_2.infer_struct import Deepseek3_2FlashAttentionStateInfo | ||
| from lightllm.models.deepseek3_2.mem_manager import Deepseek3_2MemoryManager, Deepseek3_2FP8KVMemoryManager | ||
| # @ModelRegistry(["deepseek_v32"]) |
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.
The @ModelRegistry decorator is commented out. To correctly register the Deepseek3_2TpPartModel for the "deepseek_v32" model, this line should be uncommented. This is related to the incorrect registration in lightllm/models/deepseek2/model.py.
| # @ModelRegistry(["deepseek_v32"]) | |
| @ModelRegistry(["deepseek_v32"]) |
| self._init_custom() | ||
| self._init_inferstate_cls() | ||
| self._autotune_warmup() | ||
| # self._autotune_warmup() |
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.
The call to _autotune_warmup() has been commented out. If this was for debugging, it should be removed. If autotuning is intentionally disabled for this model, it would be better to control this with a configuration flag for clarity and to avoid accidental performance degradation.
| # self._autotune_warmup() | |
| self._autotune_warmup() |
|
|
||
| logits = deep_gemm.fp8_mqa_logits(q_fp8, (k_fp8_, k_scale_), weights.squeeze(-1), ks, ke) | ||
|
|
||
| # 返回 : [seq_q_len, topk] 无效的位置使用-1填充 |
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.
No description provided.