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
+6 -4
View File
@@ -45,6 +45,7 @@ def set_weight_attrs(
Args:
weight: The weight tensor.
weight_attrs: A dictionary of attributes to set on the weight tensor.
"""
if weight_attrs is None:
return
@@ -73,9 +74,8 @@ def replace_parameter(
new_tensor: torch.Tensor | None,
prefer_copy: bool = False,
):
"""
Replace a parameter of a layer while maintaining the ability to reload the weight.
Called within implementations of the `process_weights_after_loading` method.
"""Replace a parameter of a layer while maintaining the ability to reload the
weight. Called within implementations of the `process_weights_after_loading` method.
Custom attributes set on ``new_tensor`` (e.g. kernel dispatch flags such as
``is_shuffled``) are carried over to the replacement parameter, except
@@ -97,6 +97,7 @@ def replace_parameter(
a new parameter. This preserves the parameter's storage address
(``data_ptr``), which is required for captured CUDA graphs to
remain valid across weight updates (e.g. in RL training loops).
"""
# should not be used on a tied/shared param
@@ -173,7 +174,8 @@ def get_moe_expert_mapping(
It will be retrieved from the first module that has a `get_expert_mapping` method.
If the model manually implements `get_expert_mapping`, it will be used.
Otherwise, it will use the first RoutedExperts layer."""
Otherwise, it will use the first RoutedExperts layer.
"""
for _, module in model.named_modules():
get_mapping = getattr(module, "get_expert_mapping", None)
if get_mapping is not None: