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
@@ -106,6 +106,7 @@ class ExtractHiddenStatesProposer:
|
||||
The main purpose is to cache hidden states, not to speculate.
|
||||
|
||||
Args:
|
||||
num_speculative_tokens: Number of draft tokens to return per request
|
||||
sampled_token_ids: Sampled token IDs from the target model
|
||||
target_hidden_states: List of hidden state tensors from target model
|
||||
(one per aux hidden state layer)
|
||||
@@ -117,6 +118,7 @@ class ExtractHiddenStatesProposer:
|
||||
Tuple of:
|
||||
- Draft tokens matching sampled tokens, shape [batch_size, 1]
|
||||
- KV connector output (if KV transfer is active), else None
|
||||
|
||||
"""
|
||||
assert num_speculative_tokens == self.num_speculative_tokens
|
||||
assert self.model is not None and isinstance(target_hidden_states, list)
|
||||
@@ -318,14 +320,12 @@ class ExtractHiddenStatesProposer:
|
||||
gpu_input_batch: InputBatch,
|
||||
discard_request_mask: torch.Tensor,
|
||||
) -> tuple[torch.Tensor, torch.Tensor]:
|
||||
"""
|
||||
Prepare next token IDs for speculative decoding.
|
||||
"""Prepare next token IDs for speculative decoding.
|
||||
|
||||
Since num_speculative_tokens == 1, sampled_token_ids has shape
|
||||
(batch_size, 1). For each request we either use the sampled token
|
||||
(if valid and not discarded) or a backup token from the request state.
|
||||
"""
|
||||
|
||||
# Precompute backup token IDs for discarded requests.
|
||||
num_reqs = gpu_input_batch.num_reqs
|
||||
for i in range(num_reqs):
|
||||
@@ -359,6 +359,7 @@ class ExtractHiddenStatesProposer:
|
||||
Args:
|
||||
target_model: The target model (passed for compatibility with
|
||||
EagleProposer interface, but not used here)
|
||||
|
||||
"""
|
||||
# Get the target model's attention layers before loading draft model
|
||||
target_attn_layer_names = set(
|
||||
@@ -395,7 +396,8 @@ class ExtractHiddenStatesProposer:
|
||||
|
||||
def validate_same_kv_cache_group(self, kv_cache_config: KVCacheConfig) -> None:
|
||||
"""Validate all drafting layers belong to the same KV cache group
|
||||
and record the group index for common_attn_metadata selection."""
|
||||
and record the group index for common_attn_metadata selection.
|
||||
"""
|
||||
assert len(self.attn_layer_names) == 1
|
||||
layer = self.attn_layer_names[0]
|
||||
for gid, group in enumerate(kv_cache_config.kv_cache_groups):
|
||||
|
||||
Reference in New Issue
Block a user