Prhub

#51773 Fix docs on `main`

原始 PR 作者 hmellor 合并时间 2026-08-11 14:52 文件变更 1 提交数 1 评论 0 代码增减 +2 / -8

执行摘要

修复 base.py 中过时的 docstring 声明

PR body 中直接给出了构建时的 griffe 警告:WARNING - griffe: vllm/model_executor/models/transformers/base.py:286: No type or annotation for parameter 'kwargs'Parameter 'kwargs' does not appear in the function signature,并指出 The docstring was not updated with the spec of the method.。目的是让文档与实际方法签名保持一致,消除构建警告。

不值得精读。这是一个简单的文档一致性修复,可作为维护 docstring 与签名同步的小案例。关注点在于它避免了文档构建工具对错误参数声明的警告。

讨论亮点

该 PR 无实质性 review 讨论。claude[bot] 评论提示因来自 fork 自动 review 被禁用;维护者 DarkLight1337 直接批准(APPROVED),未留下技术意见。

实现拆解

  1. 定位问题:在 vllm/model_executor/models/transformers/base.py_decorate_for_torch_compile 方法中,docstring 包含 Args: kwargs 说明,但方法实际没有 kwargs 形参,触发 griffe 文档检查警告。
  2. 修正 docstring:移除多余的 Args 段落,将多行说明压缩为一句话,保持语义(说明方法用于在 can_enable_torch_compile 为真时装饰解码器类以支持 torch compile)。
  3. 无其他改动:仅修改文档字符串,未涉及任何代码逻辑、配置或测试变更,运行时行为完全不变。
文件 模块 状态 重要度
vllm/model_executor/models/transformers/base.py 模型适配 modified 4.74

关键符号

_decorate_for_torch_compile

关键源码片段

vllm/model_executor/models/transformers/base.py documentation

这是唯一改动文件,修复了 `_decorate_for_torch_compile` 方法的 docstring,移除不存在的 `kwargs` 参数说明,消除 griffe 文档警告。

# 修复前 docstring 错误地列出了不存在的 `kwargs` 参数(见 `griffe` 警告),
# 修复后改为简洁描述,消除文档构建警告;本方法不改动任何运行时逻辑。
def _decorate_for_torch_compile(self):
    """Decorate the model's decoder class to indicate to vLLM that it
    supports torch compile if `can_enable_torch_compile` is True."""
    self._decorate_cls_for_torch_compile(
        cls=self._pre_trained_model_classes.decoder,
        # Applied to a PreTrainedModel so the batch dimension will exist
        dynamic_arg_dims=dict[str, int](
            input_ids=1, # shape: [1, seq_len]
            inputs_embeds=1, # shape: [1, seq_len, hidden_size]
            position_ids=-1, # shape: [1, seq_len] or [3, 1, seq_len] for mrope
        ),
        enable_if=can_enable_torch_compile,
        is_encoder=False,
    )

评论区精华

fork 自动 review 禁用与直接批准 documentation

`claude[bot]` 评论此 PR 来自 fork,自动 review 被禁用;维护者 `DarkLight1337` 未留言直接批准。

结论:没有技术讨论,docstring 修复被认可。 · approved

风险与影响

这是纯 docstring 修改,风险极低。唯一影响是 API 文档中该方法说明的呈现方式,消除了构建时的 griffe 警告;不影响任何运行时功能、导入路径或者下游调用。无需担心回归。

影响范围极小:仅影响 vllm.model_executor.models.transformers 模块的自动生成文档显示,让文档与真实签名一致。对用户、系统性能、部署流程均无影响。

关联 Issue

未识别关联 Issue

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

完整报告

参与讨论