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:
Harry Mellor
2026-09-16 16:44:29 +00:00
committed by GitHub
co-authored by Claude Opus 5
parent 804e5377aa
commit 8c1557a79c
2002 changed files with 15024 additions and 14269 deletions
+3
View File
@@ -67,6 +67,7 @@ def compute_skip_topk_layers(config: PretrainedConfig) -> set[int]:
Raises:
ValueError: If ``indexer_types`` has the wrong length or an unknown
entry, or if ``index_topk_freq`` is not a positive integer.
"""
if not hasattr(config, "index_topk"):
return set()
@@ -115,6 +116,7 @@ def is_skip_topk_indexer_weight(weight_name: str, skip_topk_layers: set[int]) ->
Returns:
True when the weight is an indexer weight of a layer that has no
indexer module and therefore must be dropped.
"""
if ".indexer." not in weight_name or not skip_topk_layers:
return False
@@ -557,6 +559,7 @@ class HYV4MLAAttention(nn.Module):
The backend class to bind, or None when no sink-capable backend is
available; the caller then loads the sink weight but disables the
bias.
"""
head_size = self.kv_lora_rank + self.qk_rope_head_dim
dtype = torch.get_default_dtype()
@@ -99,6 +99,7 @@ class HYV4FlashMLASparseImpl(FlashMLASparseImpl):
Raises:
ValueError: If the dtype is not float32 or the shape is not
``(num_heads,)``.
"""
if sinks is None:
return
@@ -134,6 +135,7 @@ class HYV4FlashMLASparseImpl(FlashMLASparseImpl):
Raises:
ValueError: If the sink and query head layouts disagree, or if they
live on different devices.
"""
sinks = self.sinks
if sinks is None:
+4
View File
@@ -107,6 +107,7 @@ class HYV4HCPreLayer(nn.Module):
Returns:
A tuple of the pre-gated reduction ``[num_tokens, d]`` and the post
gates ``[num_tokens, hc]`` consumed by `HYV4HCPostLayer`.
"""
if self.hpc_op is not None:
return self.hpc_op(x)
@@ -186,6 +187,7 @@ class HYV4HCPostLayer(nn.Module):
Returns:
The updated residual channels ``[num_tokens, hc, d]``.
"""
if self.hpc_op is not None:
return self.hpc_op(x, residual, post)
@@ -272,6 +274,7 @@ class HYV4HCHeadLayer(nn.Module):
Returns:
The merged hidden state ``[num_tokens, d]``.
"""
if self.hpc_op is not None:
return self.hpc_op(x)
@@ -367,6 +370,7 @@ class HYV4HCLayer(nn.Module):
A tuple of the reduced hidden states ``[num_tokens, d]``, the post
gates ``[num_tokens, hc]`` (``None`` when iHC is disabled) and the
residual (the untouched input).
"""
if not self.enable_ihc:
return hidden_states, None, hidden_states
+1 -1
View File
@@ -189,7 +189,7 @@ class HYV4DecoderLayer(nn.Module):
positions: torch.Tensor,
hidden_states: torch.Tensor,
) -> tuple[torch.Tensor, None]:
"""iHC forward: each sub-block reduces and re-scatters the channels."""
"""IHC forward: each sub-block reduces and re-scatters the channels."""
hidden_states = self.hc_attn_layer.prepare_input(hidden_states)
hidden_states, post_gates, residual = self.hc_attn_layer.pre(hidden_states)
hidden_states = self.input_layernorm(hidden_states)
+4
View File
@@ -106,6 +106,7 @@ def _resolve_fused_expert_param(
Returns:
The matching draft parameter name, or None when there is none.
"""
if not ckpt_suffix:
return param_base if param_base in params_dict else None
@@ -164,6 +165,7 @@ def _create_mtp_quant_config(
Returns:
The quantization config to use for the MTP layers, or None when the MTP
layers are unquantized.
"""
mtp_quant_algo = getattr(hf_config, "mtp_quant_algo", None)
@@ -241,6 +243,7 @@ def _remap_mtp_quant_exclusions(
Returns:
A shallow copy with the translated exclusions, or the input unchanged.
"""
if quant_config is None:
return None
@@ -671,6 +674,7 @@ class HYV4MTP(nn.Module):
Returns:
True when the weight was consumed (even if this rank holds none of
the addressed experts).
"""
base = name.split(".experts.")[0]
for ckpt_proj, tag in (