Prhub

#43956 [CI/Build] Enable Step3p7ForConditionalGeneration testing

原始 PR 作者 jeejeelee 合并时间 2026-05-31 13:16 文件变更 2 提交数 8 评论 5 代码增减 +9 / -1

执行摘要

启用 Step3p7ForConditionalGeneration 在线测试

模型 'Step-3.7-Flash' 已上传至 HuggingFace Hub,不再需要 is_available_online=False 跳过在线检查。PR 描述中明确指出 'The model is now on HF Hub so we can remove is_available_online=False'。

此 PR 代码量小,逻辑清晰,可直接合并。建议关注如果未来模型配置变更,需同步更新 hf_overrides

讨论亮点

审查者 AndreasKaratzas 指出 registry.py"stepfun-ai/Step-3.7-Flash",trust_remote_code=True 缺失空格,提交者 jeejeelee 已修复。此外,AndreasKaratzas 询问了 PR 背景,DarkLight1337 澄清模型已上 Hub 故移除 is_available_online=False

实现拆解

  1. 修改模型注册配置tests/models/registry.py):将 Step3p7ForConditionalGeneration_HfExamplesInfo 调用中移除 is_available_online=False,新增 use_original_num_layers=True,并添加嵌套的 hf_overrides 参数 {"text_config": {"num_hidden_layers": 4, "moe_num_experts": 8}}。原因是 MoE 配置位于嵌套的 text_config 中,需要 4 层以初始化至少一个 MoE 层,并缩小 moe_num_experts 以避免初始化时 OOM。
  2. 更新测试辅助函数tests/models/multimodal/processing/test_tensor_schema.py):在 test_model_tensor_schema 函数中,调用 dummy_hf_overrides 时增加 use_original_num_layers=getattr(model_info, "use_original_num_layers", False) 参数,确保模型配置正确传递。
  3. 格式修复:在第一次审查中修复了 registry.py 中逗号后的空格问题,满足 pre-commit 要求。
文件 模块 状态 重要度
tests/models/registry.py 模型注册 modified 4.85
tests/models/multimodal/processing/test_tensor_schema.py 测试框架 modified 3.49

关键源码片段

tests/models/registry.py test-coverage

核心变更文件:移除了 `is_available_online=False` 并添加 MoE 相关配置,使 Step3p7 模型可在线测试。

# tests/models/registry.py
# 变更前:标记为离线可用
"Step3p7ForConditionalGeneration": _HfExamplesInfo(
    "stepfun-ai/Step-3.7-Flash", is_available_online=False, trust_remote_code=True
),# 变更后:移除 is_available_online=False,添加 MoE 相关配置
"Step3p7ForConditionalGeneration": _HfExamplesInfo(
    "stepfun-ai/Step-3.7-Flash",
    trust_remote_code=True,
    use_original_num_layers=True,
    # MoE 配置位于嵌套的 text_config 中,覆盖需嵌套
    # 使用 4 层确保至少一个 MoE 层,缩小 moe_num_experts 避免 OOM
    hf_overrides={"text_config": {"num_hidden_layers": 4, "moe_num_experts": 8}},
),
tests/models/multimodal/processing/test_tensor_schema.py test-coverage

辅助变更:传递 `use_original_num_layers` 参数给 `dummy_hf_overrides`,使测试兼容新的模型配置。

# tests/models/multimodal/processing/test_tensor_schema.py
# 在 test_model_tensor_schema 函数中,构造 hf_overrides_fn 时增加参数
hf_overrides_fn = partial(
    dummy_hf_overrides,
    model_arch=model_arch,
    exist_overrides=model_info.hf_overrides,
    use_original_num_layers=getattr(model_info, "use_original_num_layers", False), # 新增
)

评论区精华

缺少空格格式问题 style

AndreasKaratzas 指出 `registry.py` 中逗号后缺少空格,可能导致 pre-commit 失败。

结论:提交者 jeejeelee 已修复,添加了空格。 · 已解决

风险与影响

风险极低。变更仅涉及测试配置文件,不修改任何核心逻辑。主要风险在于:如果 Step-3.7-Flash 模型在 HF Hub 上的配置与预期不符,可能导致在线测试失败,但测试本身具有 check_available_online(on_fail="skip") 保护,失败时自动跳过。

直接影响:Step3p7ForConditionalGeneration 模型现在会在 CI 中参与在线检查和多模态 tensor schema 测试,提升测试覆盖。间接影响:use_original_num_layers 参数在 dummy_hf_overrides 中通用化,未来其他模型也可使用此机制。对用户无影响,仅为内部测试改进。

无核心逻辑变更 添加了嵌套配置可能影响其他模型

关联 Issue

未识别关联 Issue

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

完整报告

参与讨论