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
+9 -14
View File
@@ -45,7 +45,8 @@ def _bgmv_shrink(
inputs, lora_weight, output, seq_len_tensor, lora_indices, scaling=1.0
):
"""Memory-efficient shrink reference: per-LoRA matmul loop.
output[mask] = scaling * inputs[mask] @ weight.T"""
output[mask] = scaling * inputs[mask] @ weight.T
"""
exploded = torch.repeat_interleave(lora_indices, seq_len_tensor)
for lid in exploded.unique():
if lid < 0:
@@ -66,7 +67,8 @@ def _bgmv_expand(
add_inputs=False,
):
"""Memory-efficient expand reference: per-LoRA matmul loop.
output[mask, offset:offset+n] (+)= inputs[mask] @ weight.T"""
output[mask, offset:offset+n] (+)= inputs[mask] @ weight.T
"""
exploded = torch.repeat_interleave(lora_indices, seq_len_tensor)
for lid in exploded.unique():
if lid < 0:
@@ -160,8 +162,7 @@ def check_lora_shrink_kernel(
seq_length: int,
scaling: float,
):
"""
Compare outputs of torch_ops.sgmv_shrink and triton_ops.lora_shrink
"""Compare outputs of torch_ops.sgmv_shrink and triton_ops.lora_shrink
kernels.
"""
data: PunicaTensors = generate_data_for_nslices(
@@ -234,8 +235,7 @@ def check_lora_expand_kernel(
seq_length: int,
add_inputs: bool,
):
"""
Compare outputs of torch_ops.sgmv_expand and triton_ops.lora_expand
"""Compare outputs of torch_ops.sgmv_expand and triton_ops.lora_expand
kernels.
"""
data: PunicaTensors = generate_data_for_nslices(
@@ -438,9 +438,7 @@ def test_kernels(
seed: int,
op_type: str,
):
"""
Tests LoRA kernels.
"""
"""Tests LoRA kernels."""
torch.set_default_device(device)
torch.accelerator.set_device_index(device)
set_random_seed(seed)
@@ -491,9 +489,7 @@ def test_kernels_hidden_size(
seed: int,
op_type: str,
):
"""
Tests SGMV and LoRA kernels.
"""
"""Tests SGMV and LoRA kernels."""
torch.set_default_device(device)
torch.accelerator.set_device_index(device)
set_random_seed(seed)
@@ -526,8 +522,7 @@ def test_kernels_hidden_size(
@pytest.mark.parametrize("device", DEVICES)
def test_add_lora_fused_moe_early_exit(device):
"""
Ensures add_lora_fused_moe does not invoke the LoRA kernel or
"""Ensures add_lora_fused_moe does not invoke the LoRA kernel or
modify the output tensor when no_lora_flag_cpu is True
"""
from types import SimpleNamespace