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
@@ -398,7 +398,8 @@ class FlashInferBackend(AttentionBackend):
|
||||
@classmethod
|
||||
def customize_spec(cls, spec: "AttentionSpec") -> "AttentionSpec":
|
||||
"""NVFP4 stores K and V as separate per-head slots of packed fp4 data
|
||||
plus fp8 block scales."""
|
||||
plus fp8 block scales.
|
||||
"""
|
||||
if spec.state_content_bytes is not None or not spec.kv_quant_mode.is_nvfp4:
|
||||
return spec
|
||||
hs_k = nvfp4_kv_cache_full_dim(spec.head_size)
|
||||
@@ -1253,9 +1254,7 @@ class FlashInferMetadataBuilder(AttentionMetadataBuilder[FlashInferMetadata]):
|
||||
num_reqs: int,
|
||||
page_size: int,
|
||||
) -> torch.Tensor:
|
||||
"""
|
||||
Compute paged_kv_indptr, paged_kv_indices, paged_kv_last_page_len for FlashInfer
|
||||
attention.
|
||||
"""Compute paged_kv_indptr, paged_kv_indices and paged_kv_last_page_len.
|
||||
|
||||
Results are stored in self.paged_kv_indptr,
|
||||
self.paged_kv_indices, self.paged_kv_last_page_len buffers.
|
||||
@@ -1964,6 +1963,7 @@ class FlashInferImpl(AttentionImpl):
|
||||
"""Forward pass with FlashInfer.
|
||||
|
||||
Args:
|
||||
layer: The attention layer, providing the q/k/v quantization scales.
|
||||
query: shape = [num_tokens, num_heads, head_size]
|
||||
key: shape = [num_tokens, num_kv_heads, head_size], or None for a
|
||||
KV-sharing decoder layer.
|
||||
@@ -1971,8 +1971,15 @@ class FlashInferImpl(AttentionImpl):
|
||||
KV-sharing decoder layer.
|
||||
kv_cache: [num_blocks, num_kv_heads, block_size, 2*head_size]
|
||||
attn_metadata: Metadata for attention.
|
||||
output: Tensor that the attention result is written into.
|
||||
output_scale: Scale for fused output quantization. Enables the
|
||||
attention+quantization fusion path when provided.
|
||||
output_block_scale: Block scale for fused output quantization,
|
||||
required for nvfp4 output and rejected for fp8 output.
|
||||
|
||||
Returns:
|
||||
shape = [num_tokens, num_heads * head_size]
|
||||
|
||||
"""
|
||||
if attn_metadata is None:
|
||||
# Profiling run.
|
||||
@@ -2638,8 +2645,7 @@ def fast_plan_decode(
|
||||
fixed_split_size: int = -1,
|
||||
disable_split_kv: bool = False,
|
||||
) -> None:
|
||||
"""
|
||||
A faster version of BatchDecodeWithPagedKVCacheWrapper::plan used for
|
||||
"""A faster version of BatchDecodeWithPagedKVCacheWrapper::plan used for
|
||||
cudagraph capture/replay, while the no cudagraph version turns back
|
||||
to the original plan.
|
||||
using original plan after passing host-side buffers:
|
||||
|
||||
Reference in New Issue
Block a user