Prhub

#28693 docs: add --trust-remote-code to Laguna-M.1 / XS.2 cookbook configs

原始 PR 作者 Jiminator 合并时间 2026-06-19 10:21 文件变更 4 提交数 1 评论 1 代码增减 +22 / -4

执行摘要

文档修复:补充 Laguna 模型远程代码信任参数

Poolside 团队的 Laguna-M.1 和 Laguna-XS.2 模型在 Hugging Face Hub 上使用了自定义的配置代码,SGLang 原生支持的 laguna 配置与其不兼容。PR body 指出 'without --trust-remote-code the SGLang server fails to load the model, so the copy-pasteable cookbook commands fail out of the box',因此需要在所有启动命令中加入该参数。

该 PR 为纯粹的文档修复,无需精读源码。值得注意的设计决策是:在 laguna-m1.jsx 中通过在每个 cell 的 flags 数组中加入参数,而非在全局配置中统一添加,保持了模块化但增加了维护成本。对于类似需要全局参数的场景,可考虑在 JSX 配置层抽象一个 'global flags' 机制来避免逐 cell 重复。

讨论亮点

无 Review 评论。仅有 CI 状态显示 PR Test (Extra) 失败,这可能是由于上游代码变动或测试环境问题,但 reviewer JustinTong0323 批准了合并,表明该测试失败与本次文档变更无关。

实现拆解

  1. 修改 JSX 配置枢纽文件:在 docs_new/src/snippets/configs/poolside/laguna-m1.jsx 中,将文件顶部的注释从 'Model is now natively supported → NO --trust-remote-code needed' 改为 '--trust-remote-code is required',并在所有 11 个 deployment cells 的 flags 数组中都添加了 --trust-remote-code 参数。
  2. 修改部署组件:在 docs_new/src/snippets/autoregressive/laguna-xs2-deployment.jsxgenerateCommand 函数中,在启动命令的初始数组里增加了 --trust-remote-code 参数,使其成为所有命令的固定部分。
  3. 更新 Cookbook 文档:分别修改 Laguna-M.1.mdxLaguna-XS.2.mdx 文档,移除原先 'no --trust-remote-code is needed' 的错误说明,并在 'Configuration Tips' 章节添加关于 'Trust remote code' 的配置提示。
  4. 统一注释信息:在所有相关的代码注释和文档文本中,统一声明 --trust-remote-code 是必需参数,确保用户不会遗漏。
文件 模块 状态 重要度
docs_new/src/snippets/configs/poolside/laguna-m1.jsx 文档配置 modified 5.38
docs_new/src/snippets/autoregressive/laguna-xs2-deployment.jsx 文档配置 modified 4.42
docs_new/cookbook/autoregressive/Poolside/Laguna-M.1.mdx cookbook 文档 modified 2.24
docs_new/cookbook/autoregressive/Poolside/Laguna-XS.2.mdx cookbook 文档 modified 2.0

关键源码片段

docs_new/src/snippets/configs/poolside/laguna-m1.jsx core-logic

核心变更文件,为 Laguna-M.1 的所有 11 个 deployment cells 添加了 `--trust-remote-code` 参数,并更新了相关注释,确保用户复制命令时不会遗漏。

// Laguna-M.1 (poolside) — config-driven cookbook page.
// ... (build requirements, hardware details omitted for brevity)
//
// --trust-remote-code is required: M.1 ships custom config code on the Hub (the transformers-native
// `laguna` config is incompatible). Carried on every cell.
//
// ...export const config = {
  // ...
  cells: [
    // Each cell now includes "--trust-remote-code" in its flags array
    {
      match: { hw: "h200", variant: "default", quant: "bf16", strategy: "balanced", nodes: "single" },
      verified: true,
      env: [],
      flags: [
        "--model-path {{MODEL_NAME}}",
        "--trust-remote-code", // ADDED: required for custom config on Hub
        "--reasoning-parser poolside_v1",
        "--tool-call-parser poolside_v1",
        "--tp 8",
        "--host {{HOST_IP}}",
        "--port {{PORT}}",
      ],
    },
    // ... (all other 10 cells follow the same pattern)
  ],
};
docs_new/src/snippets/autoregressive/laguna-xs2-deployment.jsx core-logic

为 Laguna-XS.2 的启动命令模板添加了 `--trust-remote-code` 参数,确保所有生成的命令都包含该参数。

// Inside the component
const generateCommand = () => {
  const { hardware, quantization, reasoning, toolcall, dpAttention } = values;
  // Error checks omitted...  const tp = 8;
  const lines = [
    'sglang serve \\',
    `  --model-path ${modelId} \\`,
    `  --tp ${tp} \\`,
    '  --trust-remote-code' // ADDED: required for custom config on Hub
  ];  if (dpAttention === 'enabled') {
    lines[lines.length - 1] += ' \\';
    lines.push(`  --dp ${tp} \\`);
    lines.push('  --enable-dp-attention');
  }
  // remaining flag additions...
  return lines.join('\n');
};

评论区精华

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

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

风险与影响

风险极低,因为本次变更仅涉及文档和启动命令配置,不涉及任何运行时代码逻辑。唯一潜在风险是文档中关于模型是否需要 --trust-remote-code 的声明必须准确——本次 PR 已经确认了该参数的必要性(模型自定义配置不兼容原生 config)。此外,由于 Laguna-M.1 的 JSX 配置文件中每个 cell 都添加了该参数,如果未来模型不再需要该参数,需要反向清理,但这是未来维护问题。

本次变更直接影响使用 cookbook 部署 Laguna-M.1 和 Laguna-XS.2 的用户:之前从 cookbook 直接复制命令会因缺少 --trust-remote-code 而失败,现在可以正常启动。影响范围限定在文档使用层面,对系统性能和稳定性无影响。团队内部无需额外操作,只需确认发布的 cookbook 页面更新后用户能正确使用。

仅文档变动

关联 Issue

未识别关联 Issue

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

完整报告

参与讨论