Add pydocstyle to the ruff rules (#52136)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Signed-off-by: Harry Mellor <hej.mellor@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
804e5377aa
commit
8c1557a79c
@@ -88,9 +88,14 @@ def build_cost_tables_from_curves(
|
||||
"""Build cost tables: graph-padded below the capture limit, smooth above.
|
||||
|
||||
Args:
|
||||
draft_curve: (size, cost) samples for the draft model.
|
||||
verify_curve: (size, cost) samples for the verify model.
|
||||
max_num_reqs: Largest request count to build a table for.
|
||||
max_batch_tokens: Largest token count to build a table for.
|
||||
cudagraph_limit: Largest cudagraph-captured size. At or below it,
|
||||
execution pads up to the next captured size, so cost is a step
|
||||
function. Above it there is no padding, so cost is continuous.
|
||||
|
||||
"""
|
||||
|
||||
def build_table(limit: int, curve: list[tuple[int, float]]) -> np.ndarray:
|
||||
@@ -185,7 +190,8 @@ class AdaptiveVerificationManager:
|
||||
"""Dummy-run kwargs whose step timings seed the cost tables.
|
||||
|
||||
Run these inside StepTimingCollector.collect(), then hand the block's
|
||||
timings to set_initial_cost_curves."""
|
||||
timings to set_initial_cost_curves.
|
||||
"""
|
||||
max_num_tokens = self.req_states.max_num_batched_tokens
|
||||
size = self._cudagraph_limit = capture_sizes[-1] if capture_sizes else 0
|
||||
# Also profile beyond the capture limit: real steps run there
|
||||
@@ -255,7 +261,8 @@ class AdaptiveVerificationManager:
|
||||
input_batch: "InputBatch",
|
||||
) -> None:
|
||||
"""Publish this step's raw confidences for the ranking kernel and start
|
||||
copying them to the CPU, where a later step's budget reads them."""
|
||||
copying them to the CPU, where a later step's budget reads them.
|
||||
"""
|
||||
num_reqs = input_batch.num_reqs
|
||||
ready_idx = self._stale_idx ^ 1
|
||||
with gpu_sync_allowed():
|
||||
|
||||
@@ -73,8 +73,7 @@ class AutoRegressiveSpeculator(DraftModelSpeculator):
|
||||
|
||||
@property
|
||||
def advance_draft_positions(self) -> bool:
|
||||
"""
|
||||
Whether to increment positions and seq_lens between draft steps.
|
||||
"""Whether to increment positions and seq_lens between draft steps.
|
||||
|
||||
True for Eagle/standard MTP (each step produces new KV).
|
||||
False for Gemma4 MTP (Q-only, shares target KV, constant positions).
|
||||
|
||||
@@ -72,7 +72,8 @@ def _prepare_dflash_inputs_to_capture(
|
||||
|
||||
class DFlashCudaGraphManager(CudaGraphManager):
|
||||
"""DFlash CudaGraphManager for the parallel-drafting query forward,
|
||||
building its own attention metadata from scratch."""
|
||||
building its own attention metadata from scratch.
|
||||
"""
|
||||
|
||||
def capture(
|
||||
self,
|
||||
|
||||
@@ -13,7 +13,6 @@ from vllm.v1.worker.gpu.spec_decode.utils import get_pp_safe_draft_load_config
|
||||
|
||||
def _should_share(eagle: nn.Module, flag: str, draft, target) -> bool:
|
||||
"""Share when the draft has no own copy, or its copy matches the target."""
|
||||
|
||||
if not getattr(eagle, flag, False) or draft is None:
|
||||
return True
|
||||
if target is None:
|
||||
@@ -29,7 +28,8 @@ def _should_share(eagle: nn.Module, flag: str, draft, target) -> bool:
|
||||
|
||||
def get_target_lm_head(target_model: nn.Module, target_language_model: nn.Module):
|
||||
"""The target's lm_head — from get_language_model() for
|
||||
*ForConditionalGeneration targets, else the top-level module."""
|
||||
*ForConditionalGeneration targets, else the top-level module.
|
||||
"""
|
||||
return getattr(target_language_model, "lm_head", None) or getattr(
|
||||
target_model, "lm_head", None
|
||||
)
|
||||
|
||||
@@ -268,7 +268,8 @@ class DraftModelSpeculator(BaseSpeculator):
|
||||
@property
|
||||
def attn_vllm_config(self) -> VllmConfig:
|
||||
"""Config for the draft's attention metadata builders. Overridden by
|
||||
speculators whose attention mode differs from the target's."""
|
||||
speculators whose attention mode differs from the target's.
|
||||
"""
|
||||
return self.vllm_config
|
||||
|
||||
def set_attn(
|
||||
|
||||
Reference in New Issue
Block a user