Prhub

#36342 docs(cookbook): use auto parser resolution for Granite 4.2

原始 PR 作者 JustinTong0323 合并时间 2026-08-26 01:38 文件变更 2 提交数 1 评论 1 代码增减 +16 / -16

执行摘要

Granite 4.2 cookbook 改用 auto 解析器标记

PR #36286 添加 Granite 4.2 cookbook 时使用了显式解析器标记,但 sglang 现在支持 auto 解析器自动检测(自 v0.5.12 起),低工作量切换规则自 v0.5.16 起可用。本 PR 旨在简化用户配置,让用户无需手动指定解析器类型,只要设置 auto 即可自动识别为 nemotron_3qwen3_coder。同时保留避免省略解析器标记导致解析禁用的提示。

值得关注的是其作为文档如何正确利用 auto 解析器功能。可作为后续其他模型 cookbook 更新的范例,建议整合到现有文档规范中。

讨论亮点

评论/审核中无实质性技术讨论。审阅者 zijiexia 直接批准(APPROVED)。

实现拆解

  1. 更新 playground 命令面板配置docs/src/snippets/configs/ibm-granite/granite-4.2.jsx):将 parsers.items 中的 flag 字段从 --reasoning-parser nemotron_3--tool-call-parser qwen3_coder 改为 --reasoning-parser auto--tool-call-parser auto,同时在所有 cellsflags 数组中同步修改,覆盖 h200/b200 硬件和 3b/8b/30b 模型变体。
  2. 更新 cookbook 文档docs/cookbook/autoregressive/IBM/Granite-4.2.mdx):修改“Reasoning parser”和“Tool-call parser”两节,将建议的命令从显式标记改为 auto,并说明自动解析为 nemotron_3/qwen3_coder
  3. 验证:在 d10a656ad8 提交上验证,将两个标记均设为 auto 时,3B/8B/30B 模型的所有协议探测均通过。运行 pre-commit、mint validatemint broken-links 以及命令面板和提示的浏览器检查。
文件 模块 状态 重要度
docs/src/snippets/configs/ibm-granite/granite-4.2.jsx 命令面板 modified 5.85
docs/cookbook/autoregressive/IBM/Granite-4.2.mdx 文档正文 modified 2.53

关键源码片段

docs/src/snippets/configs/ibm-granite/granite-4.2.jsx core-logic

命令面板配置,修改解析器标记为 auto,影响 playground 显示和复制命令。

// docs/src/snippets/configs/ibm-granite/granite-4.2.jsx
// 命令面板的解析器配置:使用 auto 让 chat-template 自动解析为相应解析器。
playgroundFeatures: {
  \/\/ ... 其他配置
  parsers: {
    items: [
      { id: "reasoning", label: "Reasoning Parser", flag: "--reasoning-parser auto" },
      { id: "toolCall", label: "Tool Call Parser", flag: "--tool-call-parser auto" },
    ],
  },
  \/\/ ... 其他配置
},\/\/  cell 的启动命令 flags 也统一改为 auto
cells: [
  {
    match: { hw: "h200", variant: "3b", quant: "bf16", strategy: "balanced", nodes: "single" },
    verified: true,
    flags: [
      "--model-path {{MODEL_NAME}}",
      "--tp 1",
      "--mem-fraction-static 0.8",
      "--reasoning-parser auto",
      "--tool-call-parser auto",
      "--host {{HOST_IP}}",
      "--port {{PORT}}",
    ],
  },
  \/\/ ... 其他 cell 相似修改
]

评论区精华

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

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

风险与影响

该变更为文档内容,不涉及运行时代码,风险极低。但需注意:auto 解析器依赖 chat-template 检测,若未来 Granite 4.2 的 checkpoint 变更导致检测失败,用户可能需要回退到显式标记。文档中保留的“省略解析器标记会禁用解析”的警告有助于用户理解。

该 PR 影响 Granite 4.2 cookbook 的用户,简化了配置步骤,用户无需手动指定解析器类型,降低配置出错概率。对系统运行无影响。对团队而言,这是文档维护性改进,与其他 cookbook 保持一致。

文档变更,风险低

关联 Issue

未识别关联 Issue

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

完整报告

参与讨论