[CI] Ignore ruff D209, rejoin the docstrings it split, and silence incompatible-rule warnings (#57212)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
1085b64425
commit
651a88c09a
@@ -72,8 +72,7 @@ def _sconv_add_norm(
|
||||
|
||||
ROCm uses the portable collective path. The Lamport P2P implementation in
|
||||
the NVIDIA model relies on CUDA GDC and CUDA-specific symmetric-memory
|
||||
publication semantics which cannot be linked into a gfx950 HSACO.
|
||||
"""
|
||||
publication semantics which cannot be linked into a gfx950 HSACO."""
|
||||
norm_w = norm.weight if norm is not None else None
|
||||
eps = norm.variance_epsilon if norm is not None else 0.0
|
||||
|
||||
|
||||
@@ -192,8 +192,7 @@ def inkling_gate_select(
|
||||
|
||||
class InklingGate(nn.Module):
|
||||
"""Sigmoid gate with selection bias, log-sigmoid renorm after top-k, and
|
||||
global scale (the served checkpoint's only configuration).
|
||||
"""
|
||||
global scale (the served checkpoint's only configuration)."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -247,8 +246,7 @@ class InklingGate(nn.Module):
|
||||
self, gating_output: torch.Tensor
|
||||
) -> tuple[torch.Tensor, torch.Tensor]:
|
||||
"""Full selection: (weights, ids) of [T, K + S]. The first K entries
|
||||
are the routed top-k; the S trailing entries are the sink gammas.
|
||||
"""
|
||||
are the routed top-k; the S trailing entries are the sink gammas."""
|
||||
return inkling_gate_select(
|
||||
gating_output,
|
||||
self.n_total_experts,
|
||||
@@ -269,8 +267,7 @@ class InklingGate(nn.Module):
|
||||
def _inkling_moe_ep_size() -> int:
|
||||
"""EP size the MoERunner layer will run with (mirrors
|
||||
FusedMoEParallelConfig.make: experts shard over tp * dp * pcp when
|
||||
expert parallelism is enabled).
|
||||
"""
|
||||
expert parallelism is enabled)."""
|
||||
parallel_config = get_current_vllm_config().parallel_config
|
||||
if not parallel_config.enable_expert_parallel:
|
||||
return 1
|
||||
|
||||
@@ -166,8 +166,7 @@ class InklingMultiTokenPredictor(nn.Module):
|
||||
) -> torch.Tensor:
|
||||
"""Draft-prefill embedding: fused gather + backbone embed_norm, then
|
||||
the target's tower embeddings scattered in unnormed (the backbone
|
||||
convention — MM embeds are merged after embed_norm).
|
||||
"""
|
||||
convention — MM embeds are merged after embed_norm)."""
|
||||
norm = self.backbone_embed_norm
|
||||
embeds = embed_rmsnorm(
|
||||
input_ids,
|
||||
@@ -196,8 +195,7 @@ class InklingMultiTokenPredictor(nn.Module):
|
||||
"""The depth layer's [rmsnorm(hidden) | embed_norm(embed)] input in one
|
||||
launch: embedding row gather + the backbone embed_norm + the depth
|
||||
embed_norm chain on one side, hidden_norm on the other, written
|
||||
straight into the cat buffer.
|
||||
"""
|
||||
straight into the cat buffer."""
|
||||
hidden_w = layer.hidden_norm.weight
|
||||
embed_w = layer.embed_norm.weight
|
||||
eps = layer.hidden_norm.variance_epsilon
|
||||
@@ -329,8 +327,7 @@ class InklingMTP(nn.Module, SupportsMultiModalEmbeddings):
|
||||
"""Greedy draft tokens via rank-local argmax + tiny (value, index)
|
||||
reduction — no full-vocab logits all-gather. The muP divisor is a
|
||||
positive scalar, so the argmax is invariant and the scaling is
|
||||
skipped entirely.
|
||||
"""
|
||||
skipped entirely."""
|
||||
return self.logits_processor.get_top_tokens(self.lm_head, hidden_states)
|
||||
|
||||
def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]) -> set[str]:
|
||||
|
||||
@@ -238,8 +238,7 @@ def embed_rmsnorm(
|
||||
embedding-table gather.
|
||||
``chain_weight`` additionally emits ``rmsnorm(out, chain_weight)`` (the
|
||||
first decoder layer's pre-attention norm) as a second output, still one
|
||||
launch. Bit-exact vs the unfused module sequence.
|
||||
"""
|
||||
launch. Bit-exact vs the unfused module sequence."""
|
||||
ids = input_ids.view(-1)
|
||||
(T,) = ids.shape
|
||||
n = embed_table.shape[1]
|
||||
@@ -333,8 +332,7 @@ def embed_dual_rmsnorm_cat(
|
||||
(draft decode steps) or precomputed ``embeds`` ([T, N], the target-merged
|
||||
multimodal embeddings at draft prefill); ``pre_norm_weight`` chains the
|
||||
backbone embed_norm in front of the depth embed_norm (bit-exact vs the
|
||||
unfused sequence). The concat copies collapse into direct writes.
|
||||
"""
|
||||
unfused sequence). The concat copies collapse into direct writes."""
|
||||
T, n = hidden.shape
|
||||
if embeds is not None:
|
||||
assert embeds.shape == hidden.shape
|
||||
|
||||
@@ -75,8 +75,7 @@ def _sconv_add_norm(
|
||||
"""``h = hidden + sconv(TP-sum(delta)); y = rmsnorm(h)``.
|
||||
|
||||
The Lamport path performs reduce-scatter + shard sconv + all-gather +
|
||||
residual add + norm. The NCCL path handles unsupported configurations.
|
||||
"""
|
||||
residual add + norm. The NCCL path handles unsupported configurations."""
|
||||
attn_metadata = get_forward_context().attn_metadata
|
||||
m = (
|
||||
attn_metadata.get(sconv.owner.prefix)
|
||||
|
||||
@@ -191,8 +191,7 @@ def inkling_gate_select(
|
||||
|
||||
class InklingGate(nn.Module):
|
||||
"""Sigmoid gate with selection bias, log-sigmoid renorm after top-k, and
|
||||
global scale (the served checkpoint's only configuration).
|
||||
"""
|
||||
global scale (the served checkpoint's only configuration)."""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -244,8 +243,7 @@ class InklingGate(nn.Module):
|
||||
self, gating_output: torch.Tensor
|
||||
) -> tuple[torch.Tensor, torch.Tensor]:
|
||||
"""Full selection: (weights, ids) of [T, K + S]. The first K entries
|
||||
are the routed top-k; the S trailing entries are the sink gammas.
|
||||
"""
|
||||
are the routed top-k; the S trailing entries are the sink gammas."""
|
||||
return inkling_gate_select(
|
||||
gating_output,
|
||||
self.n_total_experts,
|
||||
@@ -266,8 +264,7 @@ class InklingGate(nn.Module):
|
||||
def _inkling_moe_ep_size() -> int:
|
||||
"""EP size the FusedMoE layer will run with (mirrors
|
||||
FusedMoEParallelConfig.make: experts shard over tp * dp * pcp when
|
||||
expert parallelism is enabled).
|
||||
"""
|
||||
expert parallelism is enabled)."""
|
||||
parallel_config = get_current_vllm_config().parallel_config
|
||||
if not parallel_config.enable_expert_parallel:
|
||||
return 1
|
||||
|
||||
@@ -166,8 +166,7 @@ class InklingMultiTokenPredictor(nn.Module):
|
||||
) -> torch.Tensor:
|
||||
"""Draft-prefill embedding: fused gather + backbone embed_norm, then
|
||||
the target's tower embeddings scattered in unnormed (the backbone
|
||||
convention — MM embeds are merged after embed_norm).
|
||||
"""
|
||||
convention — MM embeds are merged after embed_norm)."""
|
||||
norm = self.backbone_embed_norm
|
||||
embeds = embed_rmsnorm(
|
||||
input_ids,
|
||||
@@ -196,8 +195,7 @@ class InklingMultiTokenPredictor(nn.Module):
|
||||
"""The depth layer's [rmsnorm(hidden) | embed_norm(embed)] input in one
|
||||
launch: embedding row gather + the backbone embed_norm + the depth
|
||||
embed_norm chain on one side, hidden_norm on the other, written
|
||||
straight into the cat buffer.
|
||||
"""
|
||||
straight into the cat buffer."""
|
||||
hidden_w = layer.hidden_norm.weight
|
||||
embed_w = layer.embed_norm.weight
|
||||
eps = layer.hidden_norm.variance_epsilon
|
||||
@@ -329,8 +327,7 @@ class InklingMTP(nn.Module, SupportsMultiModalEmbeddings):
|
||||
"""Greedy draft tokens via rank-local argmax + tiny (value, index)
|
||||
reduction — no full-vocab logits all-gather. The muP divisor is a
|
||||
positive scalar, so the argmax is invariant and the scaling is
|
||||
skipped entirely.
|
||||
"""
|
||||
skipped entirely."""
|
||||
return self.logits_processor.get_top_tokens(self.lm_head, hidden_states)
|
||||
|
||||
def load_weights(self, weights: Iterable[tuple[str, torch.Tensor]]) -> set[str]:
|
||||
|
||||
@@ -60,8 +60,7 @@ def dmel_embed_sum_norm(
|
||||
eps: float,
|
||||
) -> torch.Tensor:
|
||||
"""``rmsnorm(sum_b weight[b * VOCAB + idx[:, b]])`` in one launch (no
|
||||
[T, NB, D] intermediate).
|
||||
"""
|
||||
[T, NB, D] intermediate)."""
|
||||
T, nb = dmel_idx.shape
|
||||
D = weight.shape[1]
|
||||
assert weight.shape[0] % nb == 0
|
||||
@@ -152,8 +151,7 @@ def rmsnorm_gelu(
|
||||
) -> torch.Tensor:
|
||||
"""Fused ``gelu(rmsnorm(x))`` (or plain rmsnorm); multiple rows per block
|
||||
when D is small. With ``fold``, x must be [N, T, H, W, D] and the output
|
||||
comes back as ``fold_timespace_to_depth(result, *fold)``.
|
||||
"""
|
||||
comes back as ``fold_timespace_to_depth(result, *fold)``."""
|
||||
D = x.shape[-1]
|
||||
flat = x.reshape(-1, D)
|
||||
assert flat.stride(1) == 1 and flat.stride(0) == D
|
||||
|
||||
@@ -238,8 +238,7 @@ def embed_rmsnorm(
|
||||
embedding-table gather.
|
||||
``chain_weight`` additionally emits ``rmsnorm(out, chain_weight)`` (the
|
||||
first decoder layer's pre-attention norm) as a second output, still one
|
||||
launch. Bit-exact vs the unfused module sequence.
|
||||
"""
|
||||
launch. Bit-exact vs the unfused module sequence."""
|
||||
ids = input_ids.view(-1)
|
||||
(T,) = ids.shape
|
||||
n = embed_table.shape[1]
|
||||
@@ -333,8 +332,7 @@ def embed_dual_rmsnorm_cat(
|
||||
(draft decode steps) or precomputed ``embeds`` ([T, N], the target-merged
|
||||
multimodal embeddings at draft prefill); ``pre_norm_weight`` chains the
|
||||
backbone embed_norm in front of the depth embed_norm (bit-exact vs the
|
||||
unfused sequence). The concat copies collapse into direct writes.
|
||||
"""
|
||||
unfused sequence). The concat copies collapse into direct writes."""
|
||||
T, n = hidden.shape
|
||||
if embeds is not None:
|
||||
assert embeds.shape == hidden.shape
|
||||
|
||||
Reference in New Issue
Block a user