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
+20 -15
View File
@@ -39,9 +39,7 @@ _EXPERTS_SEPARATOR = ".experts."
def _is_remote_expert_key(raw_name: str, spec: "MoEEPLoadSpec") -> bool:
"""
Decide whether a checkpoint key belongs to a non-local expert.
"""
"""Decide whether a checkpoint key belongs to a non-local expert."""
pos = raw_name.find(_EXPERTS_SEPARATOR)
if pos < 0:
return False
@@ -69,15 +67,14 @@ class LoRAModel:
*,
modules_to_save: dict[str, LoRAFullModuleWeights] | None = None,
) -> None:
"""
Args:
lora_model_id: The integer id for the lora model.
rank: lora rank.
loras: module name -> weights for lora-replaced layers.
is_3d_lora_weight: Whether the on-disk MoE adapter is in the 3D
fused (gate_up_proj / down_proj) layout. Propagated from the
originating LoRARequest. Only consulted by the LoRA model
manager when enable_mixed_moe_lora_format is on.
"""Args:
lora_model_id: The integer id for the lora model.
rank: lora rank.
loras: module name -> weights for lora-replaced layers.
is_3d_lora_weight: Whether the on-disk MoE adapter is in the 3D
fused (gate_up_proj / down_proj) layout. Propagated from the
originating LoRARequest. Only consulted by the LoRA model
manager when enable_mixed_moe_lora_format is on.
"""
self.id = lora_model_id
@@ -93,7 +90,8 @@ class LoRAModel:
def clone(self, lora_model_id: int) -> "LoRAModel":
"""Return a copy of the object with different ids.
Will share the underlying tensors."""
Will share the underlying tensors.
"""
return self.__class__(
lora_model_id,
rank=self.rank,
@@ -103,7 +101,7 @@ class LoRAModel:
)
def get_lora(self, module_name: str) -> LoRALayerWeights | None:
"""Get LoRA for a given module by name"""
"""Get LoRA for a given module by name."""
return self.loras.get(module_name, None)
def get_module_to_save(self, module_name: str) -> LoRAFullModuleWeights | None:
@@ -114,7 +112,7 @@ class LoRAModel:
@staticmethod
def _should_skip_module(module_name: str, skip_prefixes: list[str]) -> bool:
"""Check if a module should be skipped based on skip prefixes"""
"""Check if a module should be skipped based on skip prefixes."""
for prefix in skip_prefixes:
if f".{prefix}" in module_name or module_name.startswith(prefix):
return True
@@ -222,6 +220,12 @@ class LoRAModel:
a global counter.
device: Device where the lora model is loaded.
dtype: dtype of the lora model weights.
model_vocab_size: Vocab size of the base model, used to size the
embedding deltas.
weights_mapper: Optional mapper rewriting checkpoint weight names
to vLLM names.
tensorizer_config_dict: Optional tensorizer config used to load
the checkpoint via tensorizer instead of from disk.
skip_prefixes: List of module name prefixes to skip during loading.
Models can define this to skip modules not used in inference
(e.g., MTP layers). Format: ["mtp."]
@@ -233,6 +237,7 @@ class LoRAModel:
Returns:
Loaded LoRA Model.
"""
lora_tensor_path = os.path.join(lora_dir, "adapter_model.safetensors")
lora_bin_file_path = os.path.join(lora_dir, "adapter_model.bin")