Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions fastdeploy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,9 @@ def override_name_from_config(self):
# Because the ERNIE 4.5 config.json contains two sets of keys, adaptation is required.
self.moe_num_shared_experts = self.n_shared_experts

if hasattr(self, "num_experts_per_tok") and not hasattr(self, "moe_k"):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 建议 映射逻辑本身正确,但目前有多个下游文件仍直接使用 fd_config.model_config.num_experts_per_tok 而非统一后的 moe_k

  • fastdeploy/model_executor/models/deepseek_v3.py:173
  • fastdeploy/model_executor/models/qwen3moe.py:68
  • fastdeploy/model_executor/models/gpt_oss.py:119
  • fastdeploy/model_executor/models/glm4_moe.py:178
  • fastdeploy/model_executor/layers/moe/routing_indices_cache.py:170(对 Glm4Moe 的特殊分支)

由于映射代码只赋值 self.moe_k = self.num_experts_per_tok 而未删除原属性,这些引用不会报错,不阻塞合入。但建议在后续 PR 中将上述引用统一迁移为 moe_k,与 ernie4_5_moe.py 等已使用 moe_k 的模型保持一致,减少维护歧义。

self.moe_k = self.num_experts_per_tok

def read_from_env(self):
"""
Read configuration information from environment variables and update the object's attributes.
Expand Down
Loading