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:
co-authored by
Claude Opus 5
parent
804e5377aa
commit
8c1557a79c
@@ -30,8 +30,7 @@ def maybe_get_oot_by_class(class_type: type) -> type:
|
||||
|
||||
|
||||
class PluggableLayer(nn.Module):
|
||||
"""
|
||||
Base class for pluggable layers.
|
||||
"""Base class for pluggable layers.
|
||||
|
||||
A PluggableLayer is a *module-composing* abstraction: it may instantiate other
|
||||
``torch.nn.Module`` objects as sub-layers, and its functionality depends on
|
||||
@@ -101,8 +100,7 @@ class PluggableLayer(nn.Module):
|
||||
|
||||
|
||||
class CustomOp(nn.Module):
|
||||
"""
|
||||
Base class for custom ops.
|
||||
"""Base class for custom ops.
|
||||
Dispatches the forward method to the appropriate backend.
|
||||
"""
|
||||
|
||||
@@ -137,7 +135,8 @@ class CustomOp(nn.Module):
|
||||
|
||||
def forward_native(self, *args, **kwargs):
|
||||
"""PyTorch-native implementation; OOT plugins override via
|
||||
:meth:`forward_oot`."""
|
||||
:meth:`forward_oot`.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def forward_oot(self, *args, **kwargs):
|
||||
@@ -172,8 +171,7 @@ class CustomOp(nn.Module):
|
||||
return self.forward_native
|
||||
|
||||
def maybe_compile(self, fn, *, enable: bool = True):
|
||||
"""
|
||||
Compile fn if compilation enabled.
|
||||
"""Compile fn if compilation enabled.
|
||||
Useful for CustomOp instances called from within a torch custom op,
|
||||
meaning the forward call is hidden from the model-level torch.compile.
|
||||
|
||||
@@ -255,8 +253,7 @@ class CustomOp(nn.Module):
|
||||
|
||||
@staticmethod
|
||||
def default_on() -> bool:
|
||||
"""
|
||||
Behavior controlled by `CompilationConfig.custom_ops`: On by default if
|
||||
"""Behavior controlled by `CompilationConfig.custom_ops`: On by default if
|
||||
'all', off by default if 'none'.
|
||||
When PyTorch Inductor is used, 'none' is the default value,
|
||||
otherwise 'all'.
|
||||
|
||||
@@ -10,7 +10,8 @@ from vllm.model_executor.hw_agnostic.custom_op import CustomOp
|
||||
@CustomOp.register("rms_norm")
|
||||
class RMSNorm(CustomOp):
|
||||
"""``x -> w * x / sqrt(E[x^2] + eps)``. With ``residual``, fuses
|
||||
``residual += x`` then RMSNorm and returns ``(normalized, residual)``."""
|
||||
``residual += x`` then RMSNorm and returns ``(normalized, residual)``.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user