Prhub

#28629 [Bugfix] Fix Intern-S1 FP8 expert count lookup

原始 PR 作者 BBuf 合并时间 2026-06-18 17:50 文件变更 1 提交数 1 评论 0 代码增减 +1 / -1

执行摘要

修复 Intern-S1 FP8 专家数属性路径

Intern-S1-FP8 模型在启动时触发 AttributeError: 'InternS1Config' object has no attribute 'num_experts',导致服务无法启动。根因是 InternS1Config 结构将 MoE 参数嵌套在 text_config 中,而 load_weights 直接使用了 self.config.num_experts

建议合入。该修复简洁且必要,已在 B300 上验证通过。

讨论亮点

无重大讨论。review 仅来自 gemini-code-assist[bot] 和 ispobock(批准),无争议。

实现拆解

python/sglang/srt/models/interns1.pyload_weights 方法中,将 FusedMoE.make_expert_params_mapping 调用的参数 num_expertsself.config.num_experts 改为 self.config.text_config.num_experts。仅一行变更,但属于数据契约调整,确保 FP8 MoE 权重反量化路径能正确获取专家数。

文件 模块 状态 重要度
python/sglang/srt/models/interns1.py 模型加载 modified 5.1

关键符号

load_weights

关键源码片段

python/sglang/srt/models/interns1.py data-contract

修改了 FP8 MoE 权重加载时获取专家数量的属性路径,从 `self.config.num_experts` 改为 `self.config.text_config.num_experts`。

def load_weights(self, weights: Iterable[Tuple[str, torch.Tensor]]):
    # ... 其他代码 ...
    expert_params_mapping = []
    if "Qwen3MoeForCausalLM" in self.config.text_config.architectures:
        expert_params_mapping = FusedMoE.make_expert_params_mapping(
            ckpt_gate_proj_name="gate_proj",
            ckpt_down_proj_name="down_proj",
            ckpt_up_proj_name="up_proj",
            # 修复:InternS1Config 的 num_experts 位于 text_config 内
            num_experts=self.config.text_config.num_experts,
        )
    # ... 其余权重加载逻辑 ...

注意:仅第 214 行从 self.config.num_experts 改为 self.config.text_config.num_experts

评论区精华

没有提炼出高价值讨论线程

当前评论区没有形成足够清晰的争议点或结论,后续有更多讨论时会体现在这里。

风险与影响

低风险。变更只影响 Intern-S1 模型加载路径,且已验证正确。对其他模型无影响。

直接影响 Intern-S1-FP8 模型的使用者,使其能正常启动服务。对系统其他部分无副作用。

关联 Issue

未识别关联 Issue

当前没有检测到明确关联的 Issue 链接,后续同步到相关引用后会出现在这里。

完整报告

参与讨论