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
@@ -139,7 +139,8 @@ def _find_matching_targets(
class OnlineQuantizationConfig(QuantizationConfig):
"""Model-level config for online quantization (quantize fp16/bf16 weights
during model loading, without requiring a pre-quantized checkpoint)."""
during model loading, without requiring a pre-quantized checkpoint).
"""
def __init__(
self,
@@ -227,6 +228,7 @@ class OnlineQuantizationConfig(QuantizationConfig):
Returns:
The matching method class, or None when ``spec`` has no weight
quantization.
"""
if spec is None or spec.weight is None:
return None
@@ -260,6 +262,7 @@ class OnlineQuantizationConfig(QuantizationConfig):
A tuple of source, quantization key string, target pattern, spec,
and method class. Returns None when online quantization does not
apply to the layer.
"""
quant_spec: QuantSpec | None
if self.args.targets is not None:
@@ -313,6 +316,7 @@ class OnlineQuantizationConfig(QuantizationConfig):
A tuple of source, quantization key string, target pattern, spec,
and dispatch table. Returns None when no pattern applies or the
layer is ignored.
"""
assert self.args.targets is not None
ignored = should_ignore_layer(
@@ -114,7 +114,8 @@ def _is_tp_sharded(layer: Module, *, reduces_output_dim: bool = True) -> bool:
class OnlineLinearBase(LinearMethodBase):
"""Shared base for online FP8 linear methods. Loads fp16/bf16 checkpoint
weights onto meta device and materializes them just-in-time."""
weights onto meta device and materializes them just-in-time.
"""
uses_meta_device: bool = True
@@ -158,7 +159,8 @@ class OnlineLinearBase(LinearMethodBase):
class Fp8PerTensorOnlineLinearMethod(OnlineLinearBase):
"""Online tensorwise FP8 linear quantization.
Loads fp16/bf16 weights and quantizes them per-tensor during loading."""
Loads fp16/bf16 weights and quantizes them per-tensor during loading.
"""
def __init__(self):
super().__init__()
@@ -259,7 +261,8 @@ class Fp8PerTensorOnlineLinearMethod(OnlineLinearBase):
class Fp8PerBlockOnlineLinearMethod(OnlineLinearBase):
"""Online blockwise FP8 linear quantization.
Loads fp16/bf16 weights and quantizes them per-block during loading."""
Loads fp16/bf16 weights and quantizes them per-block during loading.
"""
def __init__(self):
super().__init__()
@@ -430,7 +433,8 @@ class Fp8PtpcOnlineLinearMethod(OnlineLinearBase):
class _Fp8OnlineMoEBase(OnlineMoEMethodBase):
"""Shared base for online FP8 MoE methods. Loads fp16/bf16 checkpoint
weights onto meta device and materializes them just-in-time."""
weights onto meta device and materializes them just-in-time.
"""
# Declared here for mypy; actual values are set in __init__.
fp8_backend: "Fp8MoeBackend"
@@ -551,7 +555,8 @@ class _Fp8OnlineMoEBase(OnlineMoEMethodBase):
class Fp8PerTensorOnlineMoEMethod(_Fp8OnlineMoEBase):
"""Online tensorwise FP8 MoE quantization.
Loads fp16/bf16 weights and quantizes them per-tensor during loading."""
Loads fp16/bf16 weights and quantizes them per-tensor during loading.
"""
def __init__(
self,
@@ -608,7 +613,8 @@ class Fp8PerTensorOnlineMoEMethod(_Fp8OnlineMoEBase):
class Fp8PerBlockOnlineMoEMethod(_Fp8OnlineMoEBase):
"""Online blockwise FP8 MoE quantization.
Loads fp16/bf16 weights and quantizes them per-block during loading."""
Loads fp16/bf16 weights and quantizes them per-block during loading.
"""
def __init__(
self,