[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
@@ -69,8 +69,7 @@ def input_to_float8(
|
||||
x: torch.Tensor, dtype: torch.dtype | None = None
|
||||
) -> tuple[torch.Tensor, torch.Tensor]:
|
||||
"""This function quantizes input values to float8 values "
|
||||
"with tensor-wise quantization.
|
||||
"""
|
||||
"with tensor-wise quantization."""
|
||||
dtype = current_platform.fp8_dtype() if dtype is None else dtype
|
||||
finfo = torch.finfo(dtype)
|
||||
min_val, max_val = x.aminmax()
|
||||
@@ -1195,8 +1194,7 @@ def prepare_fp8_moe_layer_for_deepgemm(
|
||||
|
||||
def _maybe_pad_fp8_weight(weight: torch.Tensor) -> torch.Tensor:
|
||||
"""Pad the weight tensor. This is an optimization on ROCm platform, which
|
||||
can benefit from tensors located far enough from one another in memory
|
||||
"""
|
||||
can benefit from tensors located far enough from one another in memory"""
|
||||
if (
|
||||
envs.VLLM_ROCM_FP8_PADDING
|
||||
and current_platform.is_rocm()
|
||||
|
||||
@@ -297,8 +297,7 @@ def _humming_input_schema_to_quant_key(
|
||||
schema: "HummingInputSchema",
|
||||
) -> QuantKey | None:
|
||||
"""Convert a HummingInputSchema to a QuantKey. Returns None if
|
||||
the schema represents unquantized (bf16/fp16) inputs.
|
||||
"""
|
||||
the schema represents unquantized (bf16/fp16) inputs."""
|
||||
if schema.a_dtype is None or schema.a_dtype.num_bits >= 16:
|
||||
return None
|
||||
|
||||
@@ -427,8 +426,7 @@ def convert_linear_layer_to_humming_standard(
|
||||
):
|
||||
"""Rename/reshape a linear layer's quantized params (the canonical MPLinear
|
||||
layout: ``weight_packed`` int32 + ``weight_scale``) into the parameter names
|
||||
and layout humming's weight schema expects (``weight`` / ``weight_scale``).
|
||||
"""
|
||||
and layout humming's weight schema expects (``weight`` / ``weight_scale``)."""
|
||||
for name, checkpoint_name in name_map.items():
|
||||
tensor = getattr(layer, checkpoint_name)
|
||||
delattr(layer, checkpoint_name)
|
||||
|
||||
@@ -245,8 +245,7 @@ def marlin_padded_nk(size_n: int, size_k: int, group_size: int = -1) -> tuple[in
|
||||
|
||||
def marlin_repacked_nk(qweight: torch.Tensor, num_bits: int) -> tuple[int, int]:
|
||||
"""Recover the (size_n, size_k) a Marlin weight was repacked with
|
||||
(including any tile padding) from its packed shape.
|
||||
"""
|
||||
(including any tile padding) from its packed shape."""
|
||||
pack_factor = 32 // num_bits
|
||||
size_k = qweight.size(0) * GPTQ_MARLIN_TILE
|
||||
size_n = qweight.size(1) * pack_factor // GPTQ_MARLIN_TILE
|
||||
@@ -257,8 +256,7 @@ def marlin_pad_qweight(
|
||||
qweight: torch.Tensor, size_n: int, size_k: int, padded_n: int, padded_k: int
|
||||
) -> torch.Tensor:
|
||||
"""Zero-pad a GPTQ-layout packed weight (size_k / pack, size_n) for
|
||||
gptq_marlin_repack.
|
||||
"""
|
||||
gptq_marlin_repack."""
|
||||
if (padded_n, padded_k) == (size_n, size_k):
|
||||
return qweight
|
||||
pack_factor = size_k // qweight.size(0)
|
||||
@@ -276,8 +274,7 @@ def marlin_pad_scales(
|
||||
group_size: int,
|
||||
) -> torch.Tensor:
|
||||
"""Zero-pad weight scales (num_groups, size_n); call before
|
||||
marlin_permute_scales and pass the padded extents to it.
|
||||
"""
|
||||
marlin_permute_scales and pass the padded extents to it."""
|
||||
if (padded_n, padded_k) == (size_n, size_k):
|
||||
return scales
|
||||
pad_rows = padded_k // group_size - scales.size(0) if group_size > 0 else 0
|
||||
|
||||
@@ -41,8 +41,7 @@ def _nvfp4_compute_scale_factor(
|
||||
) -> float:
|
||||
"""Compute the power-of-2 scale_factor needed so that all non-zero
|
||||
values in marlin_scales * 2^7 are >= 2 after rescaling.
|
||||
Returns a Python float (power of 2, >= 1.0).
|
||||
"""
|
||||
Returns a Python float (power of 2, >= 1.0)."""
|
||||
# Since half has a smaller dynamic range compared to bfloat16,
|
||||
# no rescaling is applied here if active dtype is half.
|
||||
if a_dtype is not None and a_dtype == torch.half:
|
||||
@@ -376,8 +375,7 @@ def prepare_nvfp4_moe_layer_for_marlin(
|
||||
|
||||
def pad_w13(x: torch.Tensor) -> torch.Tensor:
|
||||
"""Zero-pad each gate/up shard of a (E, num_shards * N, cols)
|
||||
tensor to padded_N rows.
|
||||
"""
|
||||
tensor to padded_N rows."""
|
||||
if padded_N == N:
|
||||
return x
|
||||
x = x.view(E, num_shards, N, x.size(-1))
|
||||
@@ -386,8 +384,7 @@ def prepare_nvfp4_moe_layer_for_marlin(
|
||||
|
||||
def pad_w2(x: torch.Tensor, packing: int) -> torch.Tensor:
|
||||
"""Zero-pad the packed N (last) dim of a (E, K, N / packing)
|
||||
tensor.
|
||||
"""
|
||||
tensor."""
|
||||
if padded_N == N:
|
||||
return x
|
||||
return torch.nn.functional.pad(x, (0, (padded_N - N) // packing))
|
||||
|
||||
@@ -217,8 +217,7 @@ def prepare_fp8_layer_for_marlin(
|
||||
|
||||
def _moe_pad_shard_rows(x: torch.Tensor, n: int, padded_n: int) -> torch.Tensor:
|
||||
"""Zero-pad each gate/up shard of a ``(E, 2 * n, ...)`` tensor to padded_n
|
||||
rows. FP8 zero decodes to 0.0, so the padded rows contribute nothing.
|
||||
"""
|
||||
rows. FP8 zero decodes to 0.0, so the padded rows contribute nothing."""
|
||||
if padded_n == n:
|
||||
return x
|
||||
e = x.size(0)
|
||||
|
||||
Reference in New Issue
Block a user